Re: Copying USB stick fails with device errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/08/2012 04:03 PM, Alex wrote:
> Hi,
> 
>>>> 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.

The resulting device-mapper devices can then be mounted directly as
any other block device.

Options are available to control the delimiter ('p' by default) used
and whether to include it always or only when the device name ends in
a digit.

When done you can tear down a (non-busy) map with:

# kpartx -d /dev/loop0

If that fails for any reason (e.g. you removed the partition table
while the maps were active) then you can clean up manually with
"dmsetup remove <name>".

If you find yourself working with partitioned images a lot then it's
worth taking a look at libguestfs and guestfish - these are tools
designed for working with VM images but they should work just as well
with any partitioned disk image.

Regards,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/SIhYACgkQ6YSQoMYUY95BnQCfXhn83BajEd6u4licNlqBLcyH
PIkAn1FqCiCo9ZjXJ1EJu1386eENc1id
=HRlw
-----END PGP SIGNATURE-----
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux