You are not logged in.

#1 2015-10-27 08:18:29

zelnyok
Member
Registered: 2015-10-27
Posts: 2

[SOLVED] how to recover usb after installing arch with dd?

I used the dd command to create a live usb of arch on one of my usbs, and successfully installed arch on my pc. The problem is, the usb now has an unknown partition table and I cannot recover the usb to its original state. I bought an usb yesterday, testing if creating a live usb of arch will corrupt the usb, and now I cannot recover that usb either. I have tried creating partition tables, formatting and whatever I could find on the first few pages of google. Is it possible to recover my usb from this state? or should I just give it up and buy a new one?

Last edited by zelnyok (2015-10-27 23:55:26)

Offline

#2 2015-10-27 08:23:25

ayekat
Member
Registered: 2011-01-17
Posts: 1,468
Website

Re: [SOLVED] how to recover usb after installing arch with dd?

Welcome to the Arch Linux forums!

You might need to elaborate a little on what exactly you have done to come to the conclusion that the USB drive has an "unknown partition table".
What commands have you run? How exactly did you attempt to create a new partition table?


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#3 2015-10-27 08:59:51

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [SOLVED] how to recover usb after installing arch with dd?

As root, type:

dd if=/dev/zero of=/dev/sdb bs=512 count=1

Replace /dev/sdb with your USB key (be careful to choose the correct one this will erase any data presents on /dev/sdb). You can do fdisk -l /dev/sdb or dmesg if you are unsure (the first will show the size of /dev/sdb). Then do:

fdisk /dev/sdb

and make a single primary partition of type vfat (type c: W95 FAT32 (LBA)). Now format the partition with

mkfs -t vfat -F 32 /dev/sdb1

Note that you can also proceed with the disk management tool in Windows which is the Windows fdisk.

@ayekat: He has dd the archlinux iso on the usb key; which gives you an unknown partition table as expected. Anyway, whatever you may have done with your USB key, the procedure described above will restore it to a pristine condition, unless you have physically damaged it. (to be complete you should also destroy any trace of a possible GPT partition table with gdisk, but according to what he has done, this is unlikely relevant).

Last edited by olive (2015-10-27 09:05:48)

Offline

#4 2015-10-27 09:05:17

zelnyok
Member
Registered: 2015-10-27
Posts: 2

Re: [SOLVED] how to recover usb after installing arch with dd?

thank you it seems that did the trick(>.<)

Offline

#5 2015-10-27 12:34:04

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] how to recover usb after installing arch with dd?

Almost pristine condition. You've lost whatever data you had on it before. wink

Remember to mark this thread as [SOLVED]. Directions on how to are in the forum etiquette.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#6 2015-10-27 12:47:06

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [SOLVED] how to recover usb after installing arch with dd?

fsckd wrote:

Almost pristine condition. You've lost whatever data you had on it before. wink

Pristine mean in the same state as when you bought it from the shop. Once there is data on it, it isn't pristine anymore ;-) Note that advanced tols could recover some of the previous datas. If you want for security reason remove every possible trace of previous data, you should do

dd if=/dev/zero of=/dev/sdb

until there is no more space left on the device. There is even a tool: shred that overwrite the device with random 0 and 1 several time in case some very advanced techniques could recover some datas even after you have overwrite it (it is possible with hardware tool that analyse the surface of the disk physically, at least for traditional hard disk, I don't know for SSD or USB keys).

Last edited by olive (2015-10-27 12:48:36)

Offline

#7 2015-10-27 12:59:27

ayekat
Member
Registered: 2011-01-17
Posts: 1,468
Website

Re: [SOLVED] how to recover usb after installing arch with dd?

olive wrote:

He has dd the archlinux iso on the usb key; which gives you an unknown partition table as expected.

dd should usually just copy data and give output in the sense of "records in, records out, n bytes copied". So that "unknown partition table" message must come from another command.

Also, the installation image does contain a valid msdos partition table with two partitions of sizes 658M and 31M, which is why I'm irritated: fixing something that is broken might be fine, but then again it would also be nice to find why something was broken in the first place.

Last edited by ayekat (2015-10-27 13:00:01)


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#8 2015-10-27 13:29:51

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [SOLVED] how to recover usb after installing arch with dd?

ayekat wrote:

dd should usually just copy data and give output in the sense of "records in, records out, n bytes copied". So that "unknown partition table" message must come from another command.

The partition table (for the traditional MBR table) is written in the first 512 byte of the device. dd if=something of=/dev/sdb will therefore overwrite the partition table, possibly with something invalid.

ayekat wrote:

Also, the installation image does contain a valid msdos partition table with two partitions of sizes 658M and 31M, which is why I'm irritated: fixing something that is broken might be fine, but then again it would also be nice to find why something was broken in the first place.

The partition table of the image is weird:

Disk archlinux-2015.10.01-dual.iso: 658 MiB, 689963008 bytes, 1347584 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4a2b7da2

Device                         Boot Start     End Sectors  Size Id Type
archlinux-2015.10.01-dual.iso1 *        0 1347583 1347584  658M  0 Empty
archlinux-2015.10.01-dual.iso2        172   63659   63488   31M ef EFI (FAT-12/16/32)

This is done on purpose in order that the image is bootable if you write it to a cdrom (which is not supposed to contain a partition table) or a hard disk. Just see that the first partition begin at sector 0, so the sector 0 contain the beginning of the filesystem of the first partition as well as the partition table itself! You can't use the USB key with such a partition table (even if it is technically not invalid). After having dd the archlinux iso to the usb key, you have to restore a correct partition table if you want to continue to use it. I mean a single partition beginning at a sensible sector like 20148 (certainly not 0) spanning the whole key. The partition table above bis not technically invalid but make the USB key unusable except for booting the installation media.

Last edited by olive (2015-10-27 13:39:03)

Offline

#9 2015-10-27 13:37:19

ayekat
Member
Registered: 2011-01-17
Posts: 1,468
Website

Re: [SOLVED] how to recover usb after installing arch with dd?

Yes, the partition layout is bizarre, and I agree this is probably to allow for usage as a hybrid image, and one cannot use the drive without recreating a new partition table (or at least recreating the partitions).

But I just wanted to point out that having an "unknown partition table" is the result of OP attempting to do something with it, and not just a message randomly popping up on the screen.


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#10 2015-10-27 13:41:50

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [SOLVED] how to recover usb after installing arch with dd?

ayekat wrote:

Yes, the partition layout is bizarre, and I agree this is probably to allow for usage as a hybrid image, and one cannot use the drive without recreating a new partition table (or at least recreating the partitions).

But I just wanted to point out that having an "unknown partition table" is the result of OP attempting to do something with it, and not just a message randomly popping up on the screen.

Maybe he has formatted the first partition, which because it overlaps the partition table, would have make the partition table invalid. Or maybe he wanted just to say that the key was unusable and have not used the term "invalid" in a technically correct way. Does it really matter after all?

Last edited by olive (2015-10-27 13:42:58)

Offline

#11 2015-10-27 13:43:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,907
Website

Re: [SOLVED] how to recover usb after installing arch with dd?

olive wrote:

There is even a tool: shred that overwrite the device with random 0 and 1 several time in case some very advanced techniques could recover some datas even after you have overwrite it (it is possible with hardware tool that analyse the surface of the disk physically, at least for traditional hard disk...)

Not according to the evidence presented in this thread


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#12 2015-10-27 13:53:55

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [SOLVED] how to recover usb after installing arch with dd?

Trilby wrote:
olive wrote:

There is even a tool: shred that overwrite the device with random 0 and 1 several time in case some very advanced techniques could recover some datas even after you have overwrite it (it is possible with hardware tool that analyse the surface of the disk physically, at least for traditional hard disk...)

Not according to the evidence presented in this thread

I am not a specialist but I think it is possible despite this thread claiming otherwise. This is discussed here and there on the internet, for example: here. It is at least plausible that a weak magnetic signal is left on the device, inaccessible with a normal hard disk controller (and thus with any software tools) but maybe not if you have the budget of he NSA.

Last edited by olive (2015-10-27 13:55:49)

Offline

#13 2015-10-27 14:03:42

ayekat
Member
Registered: 2011-01-17
Posts: 1,468
Website

Re: [SOLVED] how to recover usb after installing arch with dd?

olive wrote:

Does it really matter after all?

You're right, I'm just too picky. I'm sorry. Problem is solved, after all.


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#14 2015-10-27 14:12:09

frostschutz
Member
Registered: 2013-11-15
Posts: 1,090

Re: [SOLVED] how to recover usb after installing arch with dd?

olive wrote:

It is at least plausible that a weak magnetic signal is left on the device

It's not plausible at all. If such a method existed it would have been exploited ages ago to increase data density.

It's a nice example how science can go wrong. Someone wrote a scientificky paper claiming that it was possible, and people took that as proof and people repeat that nonsense to this day; but the paper itself never did provide any proof whatsoever (lack of proof being discussed in the link you provided), it has never been done, and every newer study shows that it just can't be done. (But of course they're all bought by the NSA.)

https://digital-forensics.sans.org/blog … rive-data/

In many instances, using a MFM to determine the prior value written to the hard drive was less successful than a simple coin toss.

The purpose of this paper was a categorical settlement to the controversy surrounding the misconceptions involving the belief that data can be recovered following a wipe procedure. This study has demonstrated that correctly wiped data cannot reasonably be retrieved even if it is of a small size or found only over small parts of the hard drive. Not even with the use of a MFM or other known methods.

The belief that a tool can be developed to retrieve gigabytes or terabytes of information from a wiped drive is in error.

Offline

Board footer

Powered by FluxBB