mounting partition images made with dd

5,213

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.

Share:
5,213

Related videos on Youtube

IlikePepsi
Author by

IlikePepsi

Updated on September 18, 2022

Comments

  • IlikePepsi
    IlikePepsi almost 2 years

    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

    • goldilocks
      goldilocks over 9 years
      That should work.
  • goldilocks
    goldilocks over 9 years
    +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.
  • IlikePepsi
    IlikePepsi over 9 years
    @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.
  • J doe
    J doe over 9 years
    @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.
  • IlikePepsi
    IlikePepsi over 9 years
    @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