Copying USB stick fails with device errors

Alex mysqlstudent at gmail.com
Mon Jun 11 18:43:44 UTC 2012


Bryn,

>>>>> Use an offset, e.g.
>>>>>
>>>>> # mount -o loop,offset=4 ....
>>>>
>>>> Thanks, I should have thought of that. Alas, it didn't work.
>>>>
>>>> # mount -o loop,offset=4 -t vfat myusb_sdb.dd /media/desktop/
>>>> mount: wrong fs type, bad option, bad superblock on
>>>> /dev/loop0, missing codepage or helper program, or other error
>>>> In some cases useful info is found in syslog - try dmesg | tail
>>>> or so
>>>>
>>>
>>> I believe the offset is in bytes, not sectors.  If I'm right,
>>> then you need: mount -o loop,offset=2048 -t vfat myusb_sdb.dd
>>> /media/desktop/
>>
>> That was it. Thanks so much. It's now mounted successfully.
>
> If you're trying to access partitions within a disk image it's usually
> much easier to use the loop device and kpartx (from multipath-tools
> but installed in a separate sub-package in recent Fedora).
>
> Bind the image to a loop device:
>
> # losetup /dev/loop0 /tmp/sda.img
> # kpartx -a /dev/loop0
>
> This will map partitions defined in the image as new device-mapper
> devices with names like /dev/mapper/loop0p1 (for the partition one)
> and has the advantage of supporting all common partition tables and
> making all partitions available with a single command.

That's awesome. Worked beautifully. That makes it incredibly easy.

How long has this functionality been around? Is there someplace where
is this is more formally documented, besides just the manpages for
each?

Thanks,
Alex


More information about the users mailing list