Disk

刪除 GPT 磁碟標籤的所有痕跡

  • October 7, 2019

我有一個 USB 筆式驅動器,我想把它變成一個可啟動的 MBR 設備。但是,在其歷史的某個時刻,該設備上有一個 GPT,我似乎無法擺脫它。即使在我跑mklabel dos進去之後partedgrub-install仍然抱怨

Attempting to install GRUB to a disk with multiple partition labels.  This is not supported yet..

我不想保留任何數據。我只想清除以前 GTP 的所有痕跡,最好使用一些比 a 工作得更快的機制dd if=/dev/zero of=…來將整個驅動器歸零。我更喜歡基於終端(命令行或詛咒)的方法,但一些常見和免費的圖形工具也可以。

你可以這樣做wipefs

wipefs可以從指定設備中擦除文件系統、raid 或分區表簽名(魔術字元串),以使簽名對 libblkid 不可見。wipefs 不會擦除文件系統本身或設備中的任何其他數據。

如果您不想擺弄ddgdisk可以這樣做:

$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8

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
<snip>
w   write table to disk and exit
x   extra functionality (experts only)
?   print this menu

Command (? for help): x

Expert command (? for help): ?
a   set attributes
<snip>
w   write table to disk and exit
z   zap (destroy) GPT data structures and exit
?   print this menu

Expert command (? for help): z
About to wipe out GPT on /dev/sdb. Proceed? (Y/N): Y
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): Y

核實:

$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8

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

Creating new GPT entries.

Command (? for help): 

引用自:https://unix.stackexchange.com/questions/202749