3

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. Commented 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. Commented 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. Commented 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. Commented 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 Commented Nov 5, 2014 at 17:59

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.