2012年3月28日 星期三

Linux 下清除 GPT

如何清除GPT標簽

--------------------------------
可以用 CENTOS 5.4 的 BOOT CD  進入 RESCUE MODE 然後就有 DD  跟 FDISK 可以用
--------------------------------
1) 看到GPT很不爽

# fdisk -l /dev/sdc

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

2)先把前兩個sectors洗掉

# dd if=/dev/zero of=/dev/sdc bs=512 count=2; sync
2+0 records in
2+0 records out
1024 bytes (1.0 kB) copied, 0.00061 seconds, 1.7 MB/s

3)GPT標簽還在

# fdisk -l /dev/sdc

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

4)再把后兩個sectors也洗掉 (500107862016 / 512 - 2 = 976773166)

# dd if=/dev/zero of=/dev/sdc bs=512 seek=976773166 count=2; sync
2+0 records in
2+0 records out
1024 bytes (1.0 kB) copied, 0.000616 seconds, 1.7 MB/s

5)完成。

# fdisk -l /dev/sdc

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table


------------
another way

parted /dev/sd*

mklabel msdos

quit