0

I am trying to mount a raw disk image created by dd command from whole one disk. My disk has a UFS file system on its drives. mount command needs a special drive to mount. How can I do it?

  • The entire disk, or just a partition? – psusi Sep 11 '18 at 17:10
5

My command trys to mount the image as read/write, however you should read this before using it: Mounting ufs partition with read/write permissions on ubuntu


First assign your image to a loop device:

$ sudo losetup -f $HOME/path/to/disk.img

You might want to use -P option as suggested in comments too.

Find in which path your image has been assigned:

$ sudo losetup -j $HOME/path/to/disk.img
/dev/loop0: [xxxx]: (/home/path/to/disk.img)

So it's on loop0.

Check and see if ufs module is loaded:

$ lsmod | grep ufs

If it's not, load it using:

$ sudo modprobe ufs

Then mount your partitions like:

$ sudo mount -t ufs /dev/loop0p1 /mnt

You might need to mount it with -o ufstype=ufs2:

$ sudo mount -t ufs -o ufstype=ufs2 /dev/loop0p1 /mnt 

The device is:

/dev/loop0

And partitions are:

/dev/loop0p1
/dev/loop0p2
...
| improve this answer | |
  • 1
    The module will be loaded automatically if needed. – psusi Sep 11 '18 at 17:10
  • @psusi I wasn't sure about it and not able to test it so I decide to load it manually, thanks :) – Ravexina Sep 11 '18 at 18:21
  • 1
    Did losetup automatically create the partition loops (loop0p1 & p2) itself, no -P required? – Xen2050 Jan 19 '19 at 0:31
  • @Xen2050 I had to use -P option to be able to get my partions to show up (without the -P option the partitions did not show up.) Thanks for hinting this out! :) – a.l Apr 5 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.