repair FAT32 on stick

Hi all.

My wife gave me a stick with very important data, that won't mount under windows anymore. She only works under windows10.

The usb stick has FAT32 on it and had problems before, because windows doesn't unmount correctly. As soon as I mounted this stick on freeBSD, everything went fine for her for several weeks, than same procedure.

Now, I cannot mount the stick anymore to fix it:
% gpart show da0
=> 63 61439937 da0 MBR (29G)
63 1 - free - (512B)
64 61439936 1 fat32 [active] (29G)
% ls /dev/da*
/dev/da0 /dev/da0s1
% mount -t msdosfs -r /dev/da0s1 /mnt/jochen/
mount_msdosfs: /dev/da0s1: Invalid argument

Is there a way to fix this FAT32 partition, at least ro to save the data? Any ideas?

thanks
Jochen
 
My wife gave me a stick with very important data
The first thing I would do is to dump the entire drive into an image. dd is usually the tool of choice here.

Now, I cannot mount the stick anymore to fix it:
Can be for many reasons including hardware failure. USB sticks are not suitable for "very important data" by any means.

Does /dev/da0s1 actually exist after plugging it in?
 
Linux has a fsck.msdosfs. I don't know whether it is available on FreeBSD or running in the Linuxulator.
 
That's bad,
for me it is ,
file -s /dev/da2s1
Code:
/dev/da2s1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "BSD4.4  ", sectors/cluster 64, sectors/track 63, heads 255, sectors 60088257 (volumes > 32 MB), FAT (32 bit), sectors/FAT 7334, serial number 0x5047141f, label: "MSDOS      "
HOST:root: /home/x #
 
that is bad, it means at least the boot sector is clobbered
there is/was some software that recovered known file types by reading contigous blocks something like binwalk but i can't remember it's name
anyway if the stick was not written often and is not completely overwritten you may have a good chance to recover the data if you have enough patience
 
Now, I cannot mount the stick anymore to fix it:

Is there a way to fix this FAT32 partition, at least ro to save the data? Any ideas?

Yes, backup the whole stick to an image file, then you can mount it via mdconfig if you need to play. I'd use:

Code:
# dd if=/dev/da0 of=stick.img bs=512 conv=noerror,sync

It will be slow with 1-sector blocks, but if there are any bad input sectors they'll be zeroed in the image, but stay in sync.

Maybe the FAT is damaged, which fsck_msdosfs might fix, but I'd try that on the image first:

Code:
# mdconfig stick.img
md0    # perhaps
# ls /dev/md0*    # /md0s1?
# fsck_msdosfs /dev/md0s1    # hopefully
 
That's bad,
for me it is ,
file -s /dev/da2s1
Code:
/dev/da2s1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "BSD4.4  ", sectors/cluster 64, sectors/track 63, heads 255, sectors 60088257 (volumes > 32 MB), FAT (32 bit), sectors/FAT 7334, serial number 0x5047141f, label: "MSDOS      "
HOST:root: /home/x #
wouldn't that output only be for a bootable image (DOS/MBR boot sector...) ? The stick only contains a data partition.

dd based backup is running, I had to do some other urgent work done
 
Also try the old-school:
# fdisk /dev/da0

which may show if the MBR is damaged, and perhaps a clue to repair. Further:

Code:
% dd if=/dev/da0 of=mbr count=1
% hd mbr
 
fsck_msdosfs(8)
fsck_msdosfs /dev/da0s1
** /dev/da0s1
Invalid signature in boot block: 2250

Also try the old-school:
# fdisk /dev/da0

which may show if the MBR is damaged, and perhaps a clue to repair. Further:

Code:
% dd if=/dev/da0 of=mbr count=1
% hd mbr
fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=3824 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=3824 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
start 64, size 61439936 (29999 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 1023/ head 1/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

sysutils/testdisk is something I'll test tomorrow.

Guys, thanks so much so far
 
It seems sensible to work with a raw image made with dd. Then use the testdisk tool on it.
 
I had some success with This. It was to recover data from a camera that got mishandled.
For a full recovery, you may need to pay a professional. It depends on what the data is worth.
 
Back
Top