Linux Disk Images
Mounting a Disk Image
Explains on how to mount an image (dd copied) from a disk containing multiple partitions.
Setup Loop Device
The command losetup sets up the device scanning for partitions.
The image and partitions are here mounted read-only as precaution only.
On success, it reports the loop device /dev/loopX in the output.
When looking in to the devices the partitions are visible as /dev/loopXp1 and /dev/loopXp2 and so on.
To remove the device(s) use the detach option on the new created loop device.
Mounting a Loop Partition
Alternate using a Mount Offset
List partitions
Use fdisk to find partitions sector offsets and the sector size.
Mount a partition
Needs calculation for the byte offset of the sector for the partition using a calculation.
Saving a Disk Image
Command(s) to save a disk image in a zipped form using a pipe to gzip.
Restoring a Disk Image
Command(s) to restore a disk image in a zipped form using a pipe to gzip.
Changing the UUID of a Partition
When a disk image is restored the partitions get the same UUID used by the original.
To have a different UUID a new one must be generated using uuidgen
Or all at-once The system might be complaining before executing a check must be performed on the partition.