Rescuing a Damaged USB Stick
William Park
opengeometry-FFYn/CNdgSA at public.gmane.org
Mon Dec 19 07:13:21 UTC 2011
On Mon, Dec 19, 2011 at 12:17:04AM -0500, William O'Higgins Witteman wrote:
> I've got an nice clean image of a USB stick on my hard drive. I'm
> pretty sure there is still data on it - stings returns *oodles* of
> stuff. The problem is that there is no partition table on this thing -
> gpart says that there are no partitions.
>
> So, I can't mount the image (or the stick) 'cause there are no
> partitions. I'm pretty sure it was a FAT32 stick, so I'd love to
> somehow replace the partition table on the image I've got and see if I
> can pull off some of that data.
>
> Anyone have a set of documents for this? I've found lots of
> almost-useful information, including some really old docs, but nothing
> that says "do this!" for my situation.
>
> Thanks!
Odd that it doesn't have partition table. Windows always creates the
first partition. Unless it was created from Linux to use the whole
device. In any case, you can take a peek into the image:
# losetup usb.img
-- check /proc/partition to see that "loop0" is created
# fdisk -u -l /dev/loop0
-- if you see partitions, say loop0p1, then create loop device
for that. Calculate the offset into the first partition, like
# losetup usb.img -o $((2048*512))
-- check /proc/partitions to see "loop1"
# mount /dev/loop1 /mnt
-- if you don't see partition, then it's probably using the
whole device. Then, just mount it.
# mount /dev/loop0 /mnt
# losetup -d /dev/loop0
# losetup -d /dev/loop1
-- delete the loop devices
--
William
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list