Re: Salvaging data from USB flash disk



Hi Henrik,

Thanks for all the help and pointers, Henrik. Unfortunately, I am
still unable to mount the copy of the disk. :(

I'm not sure what file system type was on the disk. My mount thinks
it's not vfat, and it looks like I don't have fat* support, so I can't
use -t fat32, for example.
(I'm looking at another, working flash disk now, and it uses vfat, so I
assume the corrupt one also used vfat)

Is the only way I can get to this data through mounting the disk first?

Could I recover anything with Partition Magic or some such tool? (I'm
wondering if P.M. might still be able to see the flash disk and let me
copy its data onto a new valid partition on, say, a regular HDD)

Thanks.


Henrik Carlqvist wrote:
"OtisUsenet" <otis_usenet@xxxxxxxxx> wrote:
Then I tried this losetup...like this:

# losetup /dev/loop0 /tmp/lana-disk
# mount /dev/loop0 -r -t vfat -o loop /mnt/lanadisk
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
or too many mounted file systems
(could this be the IDE device where you in fact use
ide-scsi so that sr0 or sda or so is needed?)

Obviously there is nothing looking like the magic numbers of a vfat
file system in the partition table. You did forget the most important
part:

Before trying to mount the image there is one more important thing that
you have to think about. The image file comes from your entire disk,
not only the partition containing the file system with data. The first
512 bytes of your disk and also the first 512 bytes of your image
contains the partition table. You will not be able to mount the image,
as you would not try to mount /dev/sda. Instead you would try to mount
/dev/sda1.

Instead you will have to use losetup to define an offset where the
partition begins. My guess is that this offset is 512 bytes, but the
partition table could say something else. For more info on how to use
losetup and mount /dev/loop*, see the man page of losetup.

Try with an offset of 512 bytes and see if that helps, something like this:

# losetup -o 512 /dev/loop0 /tmp/lana-disk
# mount /dev/loop0 -r /mnt/lanadisk

If you don't want to use losetup you can also use dd to only copy some
data from the image file, something like:

dd if=/tmp/lana-disk of=/tmp/lana-partition bs=512 skip=1

Then you might be able to mount the image of a partition with:

mount -o loop /tmp/lana-partition /mnt/lanadisk

You can also use a tool like xxd to examine your disk image.
http://www.geocities.com/thestarman3/asm/mbr/MSWin41BRinHexEd.htm
describes what to search for. If you find keywords like FAT32 (clear text)
and 55AA (hexadecimal) you might be close. The boot record of the
partition is 3*512 bytes,

# fdisk -l /dev/sda

Disk /dev/sda: 1043 MB, 1043333120 bytes
33 heads, 61 sectors/track, 1012 cylinders
Units = cylinders of 2013 * 512 = 1030656 bytes

Disk /dev/sda doesn't contain a valid partition table

This looks bad. If you don't have any partition table the first 512 bytes
of the disk has probably been messed up in some way. If you are lucky only
the first 512 bytes are bad and all data in the file system is still
there. If you are unlucky also data after the first 512 bytes are messed
up. If so it will probably be very hard to recover any data.

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc8(at)uthyres.com Examples of addresses which go to spammers:
root@xxxxxxxxxxxxx root@localhost

.



Relevant Pages

  • Re: Found the chkdsk log [STOP error, data unviewable etc...]
    ... The type of the file system is NTFS. ... CHKDSK is recovering lost files. ... 33013543 KB total disk space. ... partition, etc. Oh well... ...
    (microsoft.public.win2000.file_system)
  • Re: Is FAT32 format gone?
    ... is nolimit> to partition size re FAT32-formatted partitions. ... FAT32 file system in a WinXPenvironment,> he or she can do ... Disk> Management utility, ...
    (microsoft.public.windowsxp.general)
  • Re: Help Failing Disk Problem
    ... and the FreeBSD OS on a hard disk that is failing. ... Either use sysinstall to slice and partition ... fdisk, bsdlabel and newfs. ... 512 MB I mount as /tmp ...
    (freebsd-questions)
  • Re: Chkdsk errors in SP2 installation
    ... Windows is on the first partition (that's the one I ... > the Error Checker in the disk Properties/Tools says the disk is OK. ... >>Windows found problems with the file system. ...
    (microsoft.public.windowsxp.general)
  • Re: Salvaging data from USB flash disk
    ... The image file comes from your entire disk, ... not only the partition containing the file system with data. ... You will not be able to mount the image, ...
    (comp.os.linux.hardware)