You are not logged in.

#1 2014-01-10 16:26:46

103
Member
From: Cuba
Registered: 2014-01-10
Posts: 3

How to restore USB flash after installing

At: https://wiki.archlinux.org/index.php/US … _USB_drive

It clearly reads that with:

dd count=1 bs=512 if=/dev/zero of=/dev/sdx && sync

the media will be restore to it's full capacity after creating a new partition table. But, when USB flash drive media is prepared with dd to boot Arch Linux liveCD, a GPT is created. The previous code is for MBR, so I did the following to clear GPT:

BLOCKS=$(cat /sys/block/sdb/size)
dd if=/dev/zero of=/dev/sdb bs=512 count=34
dd if=/dev/zero of=/dev/sdb bs=512 count=34 seek=$((${BLOCKS}-34))

But some GPT information remains in the media.

What do you recommend to clear GPT information without wiping the flash drive,  just with dd and no other tool?

Last edited by 103 (2014-01-10 16:28:52)

Offline

#2 2014-01-10 20:52:58

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: How to restore USB flash after installing

Use GParted to re-format the drive to whatever filesystem you like.

I don't understand "without wiping the drive". You will have to change the partition table which means the drive will be wiped.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2014-01-10 21:00:43

103
Member
From: Cuba
Registered: 2014-01-10
Posts: 3

Re: How to restore USB flash after installing

This command:

dd count=1 bs=512 if=/dev/zero of=/dev/sdx && sync

just removes the partitions, bootstrap and signature when MBR partitioning is used, so no need to erase every device block. That is what I'm asking for. I just want to remove/clear GPT information. And I prefer to use dd.
Regards

Last edited by 103 (2014-01-10 21:03:30)

Offline

#4 2014-01-11 22:40:17

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: How to restore USB flash after installing

103 wrote:

This command:

dd count=1 bs=512 if=/dev/zero of=/dev/sdx && sync

just removes the partitions, bootstrap and signature when MBR partitioning is used, so no need to erase every device block. That is what I'm asking for. I just want to remove/clear GPT information. And I prefer to use dd.
Regards

sgdisk --zap-all /dev/sdx

Offline

#5 2014-02-19 16:30:39

103
Member
From: Cuba
Registered: 2014-01-10
Posts: 3

Re: How to restore USB flash after installing

teateawhy wrote:
sgdisk --zap-all /dev/sdx

Thanks, that worked flawlessly but, no way doing this using dd?

Why dd? I like it and portability.

Offline

Board footer

Powered by FluxBB