1

is there a way to mount and access a single partition on any mountpoint in my filesystem or must I use disk images and mount with offset?

I made a partiton image with dd bs=4M if=/dev/sdb1 of=~/part.img and tried to mount it on /mnt with mount -t vfat ~/part.img /mnt.

The output of mount is an Unknown Error -1

1
  • That should work.
    – goldilocks
    Nov 4, 2014 at 21:23

1 Answer 1

6

Yes, it is perfectly possible to mount partition images made with dd. You should add a -o loop (i.e., use a loopback device) to the mount command.

The final command should look like: mount -oloop -t vfat ~/part.img /mnt

Of course, you should have dd'ed from a valid and previously formatted vfat filesystem in the original partition.

4
  • 1
    +1 I've found that using -o loop is generally not necessary; man mount notes "The mount command automatically creates a loop device from a regular file if a filesystem type is not specified or the filesystem is known for libblkid..." -- but the last part is a bit of a qualifier, hopefully using -t vfat and -o loop together works.
    – goldilocks
    Nov 4, 2014 at 21:47
  • @Marcelo I tried the mounting procedure again with mount -t vfat -o loop ~/part.img /mnt and it works perfectly today. Now it seems I cannot reproduce the weird error. But many thanks anyway.
    – IlikePepsi
    Nov 5, 2014 at 17:50
  • @IlikePepsi, do you mean you cannot reproduce the error even when not specifying -o loop as you did the first time? That's weird indeed. Well, good that now it works.
    – Marcelo
    Nov 5, 2014 at 17:53
  • 1
    @Marcelo, yes. I thought that maybe the created loop device persists somehow but it doesn't. I tried losetup -l and the loop-device was gone after umount /mnt
    – IlikePepsi
    Nov 5, 2014 at 17:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .