Repair GPT Table: Difference between revisions

From WikiMLT
Line 9: Line 9:
== Repair the GPT Partition ==
== Repair the GPT Partition ==
След това, с помощщта на <code>gdisk</code>, чрез използване на командите <code>p</code> '''print the partition table''', <code>v</code> '''verify disk''' и <code>w</code> '''write table to disk and exit''', таблицата е презаписана от ''вграденото'' бекъп копие:
След това, с помощщта на <code>gdisk</code>, чрез използване на командите <code>p</code> '''print the partition table''', <code>v</code> '''verify disk''' и <code>w</code> '''write table to disk and exit''', таблицата е презаписана от ''вграденото'' бекъп копие:
<syntaxhighlight lang="shell" line="1" class="mlw-continue mlw-shell-gray">
sudo gdisk /dev/sda
</syntaxhighlight>


<syntaxhighlight lang="shell" line="1">
<syntaxhighlight lang="shell" line="1">

Revision as of 10:27, 24 September 2022

Поп­ра­вя­не на GPT таб­ли­ца­та на /​​​dev/​​​sda1

First things first – cre­ate a back­up copy of the par­ti­tion ta­ble.

sudo sfdisk -d /dev/sda > /mnt/backups/gpt_table_sda_cx250.txt

Re­pair the GPT Par­ti­tion

След то­ва, с по­мощ­щта на gdisk, чрез из­пол­з­ва­не на ко­ман­ди­те p print the par­ti­tion ta­ble, v ver­i­fy disk и w write ta­ble to disk and ex­it, таб­ли­ца­та е пре­за­пи­са­на от вгра­де­но­то бе­къп ко­пие:

sudo gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Command (? for help): ?
b       back up GPT data to a file
c       change a partition's name
d       delete a partition
i       show detailed information on a partition
l       list known partition types
n       add a new partition
o       create a new empty GUID partition table (GPT)
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       sort partitions
t       change a partition's type code
v       verify disk
w       write table to disk and exit
x       extra functionality (experts only)
?       print this menu
Command (? for help): p
Disk /dev/sda: 488397168 sectors, 232.9 GiB
Model: CT250MX500SSD1
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 0AC2B894-BAE7-4790-80F9-1934C8F84E24
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 488397134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4397 sectors (2.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1050623   512.0 MiB   EF00
   2         1050624       488394751   232.4 GiB   8300
Command (? for help): v
No problems found. 4397 free sectors (2.1 MiB) available in 2
segments, the largest of which is 2383 (1.2 MiB) in size.
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.

Ref­er­ences