On Mon, May 8, 2017 at 7:42 AM, Ruediger Meier <sweet_f_a@gmx.de> wrote:
On Monday 08 May 2017, Carlos E. R. wrote:
On 2017-05-08 08:17, Rüdiger Meier wrote:
On 05/07/2017 11:27 PM, Carlos E. R. wrote:
$ man wipefs
cer@Telcontar:~> man wipefs | grep -i gpt cer@Telcontar:~>
Maybe just read it ...
What for? If it doesn't mention GPT specifically, it is no good.
Does dd mention gpt specifically?
No, don't tell us to erase the entire disk: that will work but is terribly slow on an USB stick.
You have still not read the man page ...:
wipefs can erase filesystem, raid or *partition-table signatures* (magic strings) from the specified device to make the signatures invisible for libblkid.
wipefs *does not erase* the filesystem itself nor *any other data* from the device. When used without any options, wipefs lists all visible filesystems and the offsets of their basic signatures.
We need tools specific to erasing GPT tables.
wipefs can handle gpt and many other partition tables (GPT, MBR, Sun, SGI and BSD ) and even more. wipefs is exaclty the right tool to be used here. It's made for nothing else than such use cases like the OP posted. If it does not work then it would be a bug.
If you know how to do that, tell us instead of telling us to peruse man pages without knowing what exactly to seek for.
$ wipefs -fa /dev/sdX
Or just test it on a file:
$ truncate -s 100M /tmp/test.img $ echo -e "w\nY" | gdisk /tmp/test.img $ gdisk -l /tmp/test.img | grep -A4 "Partition table scan:" Partition table scan: MBR: protective BSD: not present APM: not present GPT: present
$ time wipefs -fa /tmp/test.img /tmp/test.img: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49. /tmp/test.img: 8 bytes were erased at offset 0x063ffe00 (gpt): 45 46 49. /tmp/test.img: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa ..
real 0m0.021s user 0m0.000s sys 0m0.002s
$ gdisk -l /tmp/test.img | grep -A4 "Partition table scan:" Partition table scan: MBR: not present BSD: not present APM: not present GPT: not present
As you see in wipefs output (offsets), it invalidates the GPT table, the backup GPT table and the (protective) MBR by writing 20 NULL bytes to the disk.
Seeing that result, it is clear wipefs does the job. Reading the man page, I had no certainty at all. It doesn't mention partition tables of any kind. Greg -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org