accidentally dumped a FAT32 usb to my Linux drive

Using TestDisk to repair the filesystem
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
ajnabi
Posts: 3
Joined: 25 Apr 2012, 01:45

accidentally dumped a FAT32 usb to my Linux drive

#1 Post by ajnabi »

I just used dd to copy an ISO to a USB drive. Unfortunately I mistakenly dumped to my backup hard drive. OOPS!!!

fdisk still sees it as one large disk with a Linux partition, but the USB ISO file was a 366M fat32 file.

running:
$ testdisk /dev/sdc

Choosing Intel --> Advanced
leaves me with the following:
1 P Linux 0 1 1 121600 254 63 1953520002


running:
$ testdisk /dev/sdc1

Choosing Intel --> Advanced
leaves me with the following:
1 * hid. HPFS/NTFS 0 0 1 46 167 57 749568

I'm not sure what the next step should be. Most tutorials and problems deal with recovering files from the same file system. I tried changing the type to Linux 83 but got nowhere.

Any help appreciated.
Thanks

User avatar
remy
Posts: 456
Joined: 25 Mar 2012, 10:21
Location: Strasbourg, France.
Contact:

Re: accidentally dumped a FAT32 usb to my Linux drive

#2 Post by remy »

Please give feedback of testdisk scans (Quicksearch and deepersearch) on the full disk (/dev/sdc) not only the partition (/dev/sdc1).

Steps : You will probably recover your partition, try to list the files with testdisk ("P" key). Your filesystem will probabely be corrupt. Try to simulate recover with

Code: Select all

e2fsck /dev/sdc1 -n
to see if it can found info on superblocs. Try to mount using alternate superbloc. If you want to try to repair, you should first do a copy with dd, ddrescue or similar tools, then e2fsck -y /dev/sdc1... If you loose root info, your files (less the ones overwritten) will be in "Lost+Found" folder.

ajnabi
Posts: 3
Joined: 25 Apr 2012, 01:45

Re: accidentally dumped a FAT32 usb to my Linux drive

#3 Post by ajnabi »

Hi Remy, Thanks for the response and sorry for not answering. I was expecting an email notification but I see I didn't check the button to "Notify me when a reply is posted" so I thought nobody answered.
Please give feedback of testdisk scans (Quicksearch and deepersearch) on the full disk (/dev/sdc) not only the partition (/dev/sdc1).


I'm not sure what you mean here. I don't see those options. I assume you mean the Analyse option (Analyse current partition structure and search for lost partitions). I will run that and get back with the results.

I tried:

Code: Select all

# e2fsck /dev/sdd1 -n
e2fsck 1.40.8 (13-Mar-2008)
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/sdd1

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
Thanks!

User avatar
remy
Posts: 456
Joined: 25 Mar 2012, 10:21
Location: Strasbourg, France.
Contact:

Re: accidentally dumped a FAT32 usb to my Linux drive

#4 Post by remy »

I'm not sure if you did it because your disk changed, but first time it was sdc and you worked there with sdd...

For testdisk :

choose sdc (whole disk, not only the first partition), table intel, analyse, quickserach (give feedback) and then deepersearch (give feedback). If your ext partition wasn't aligned on cylinder, you'll perhaps have to do another scan with options "cylinder boundary : no" (or "align : no" depending on testdisk version)

ajnabi
Posts: 3
Joined: 25 Apr 2012, 01:45

Re: accidentally dumped a FAT32 usb to my Linux drive

#5 Post by ajnabi »

Ah, thanks... I see why I didn't get it. I didn't have those options in my version--TestDisk 6.8. I have upgraded to 6.13 and am running the tests and will post results.

Locked