Mounting disk images
You probably know how to mount an image of a file system through a loopback device:
mount -o loop fs.img /mnt
But what if you have a disk image with partitions? Simple: Add the offset of the partition as a parameter:
mount -o loop,offset=1048576 disk.img /mnt
But how to get this offset? You can use fdisk -l
/sfdisk -l
to get the start of the partition and convert it from sectors to bytes by multiplying with 512 or use this small script:
https://github.com/thammi/stuff/tree/master/image_mount
Run it on a disk image and it will print the mount commands for all available partitions.
Written by thammi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Linux
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#