Mounting filesystem image with CLI

Assume you have a image of an file system that needs to be mounted. This could be on a linux system in case you need to recovering data or for forensics reasons.

With the below command you will create a virtual device on your linux system. And in the last step you will mount the actual file that contains a filesystem. In our example we mount an ISO image file to our existing file system.

losetup -f
losetup -d /dev/loop0
losetup -P /dev/loop0 /path/file.iso # will create /dev/loop0 
ls /dev/loop0p* #the partitions in the format /dev/loop0pX

With the below command you will actually mount the loopback device to an directory that is accessible. Keep in mind that the /dev/loop0p* is the actual partition of the image. The * should be the partition number you want to mount.

mount -t ext3 /dev/loop0p* /mnt/imagedir
Share the Post:

Related Posts