Hello, On Sun, 07 May 2017, Bjoern Voigt wrote:
Wols Lists wrote:
On 07/05/17 15:57, Bjoern Voigt wrote:
What is the best way to wipe a GPT partition table completely from an USB key?
(Background: My USB key contains a GPT partition table, probably from an OS installation (FreeNAS, openSUSE installation media ...). Parted, fdisk, gdisk have functions to create a new MSDOS partition table, but they do not wipe the GPT completely. gdisk
*X*pert menu
*Z*ap gpt. Thanks. But it probably does not work. I called "z zap (destroy) GPT data structures and exit", re-created a MSDOS partition table and re-inserted the USB key (so that Linux scans the new partition table). But gdisk still complains about an invalid GPT:
Wrong. $ dd if=/dev/zero of=./t.img bs=1M count=200 $ gdisk ./t.img [..] Command (? for help): n Partition number (1-128, default 1): First sector (34-409566, default = 2048) or {+-}size{KMGTP}: Last sector (2048-409566, default = 409566) or {+-}size{KMGTP}: Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem' Command (? for help): v No problems found. 2014 free sectors (1007.0 KiB) available in 1 segments, the largest of which is 2014 (1007.0 KiB) 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 ./t.img. Warning: The kernel is still using the old partition table. The new table will be used at the next reboot. The operation has completed successfully. $ od -tx1z ./t.img 0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................< * 0000700 02 00 ee 7e 25 19 01 00 00 00 ff 3f 06 00 00 00 >..î~%.....ÿ?....< 0000720 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................< * 0000760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa >..............Uª< 0001000 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 >EFI PART....\...< [..] 1437777000 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 >EFI PART....\...< 1437777020 ec be a7 c4 00 00 00 00 ff 3f 06 00 00 00 00 00 >쟧Ä....ÿ?......< 1437777040 01 00 00 00 00 00 00 00 22 00 00 00 00 00 00 00 >........".......< 1437777060 de 3f 06 00 00 00 00 00 75 f6 ca 04 f9 25 d7 4c >Þ?......uöÊ.ù%×L< 1437777100 80 52 5f fe a2 0c 8b 6b df 3f 06 00 00 00 00 00 >.R_þ¢..kß?......< 1437777120 80 00 00 00 80 00 00 00 83 f4 bb dd 00 00 00 00 >.........ô»Ý....< 1437777140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................< * 1440000000 $ gdisk ./t.img GPT fdisk (gdisk) version 0.8.10 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Command (? for help): x Expert command (? for help): z About to wipe out GPT on ./t.img. Proceed? (Y/N): y Warning: The kernel is still using the old partition table. The new table will be used at the next reboot. GPT data structures destroyed! You may now partition the disk using fdisk or other utilities. Blank out MBR? (Y/N): y $ od -tx1z ./t.img 0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >................< * 1440000000 So there's NOTHING but zeroes left. $ gdisk ./t.img GPT fdisk (gdisk) version 0.8.10 Partition table scan: MBR: not present BSD: not present APM: not present GPT: not present Creating new GPT entries. Command (? for help): q $ HTH, -dnh -- printk(" Speed now 1x"); /* Pull my finger! */ linux-2.6.6/drivers/cdrom/mcd.c -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org