User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
parted [2022/03/17 13:17] normanparted [2025/10/02 12:05] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Mount single partition from image of entire disk (device) ======
 +
 +Get the partition layout of the image
 +
 +<code>fdisk -lu sda.img</code>
 +
 +
 +<code>...
 +Units = sectors of 1 * 512 = 512 bytes
 +Sector size (logical/physical): 512 bytes / 512 bytes
 +...
 +  Device Boot      Start         End      Blocks   Id  System
 +sda.img1            56     6400000     3199972+    W95 FAT32 (LBA)</code>
 +
 +
 +Calculate the offset from the start of the image to the partition start
 +
 +Sector size * Start = (in the case) 512 * 56 = 28672
 +
 +Mount it on /dev/loop0 using the offset
 +
 +<code>losetup -o 28672 /dev/loop0 sda.img</code>
 +
 +Now the partition resides on /dev/loop0. You can fsck it, mount it etc
 +
 +<code>fsck -fv /dev/loop0
 +mount /dev/loop0 /mnt</code>
 +
 +
 +Unmount
 +
 +<code>umount /mnt
 +losetup -d /dev/loop0</code>
 +
 +
 +Source: [[https://askubuntu.com/questions/69363/mount-single-partition-from-image-of-entire-disk-device|External Link]]
 +
 +====== Attach IMG file ======
 +
 +<code>
 +losetup --find --show --partscan fred.image.dd
 +</code>
 +there should be partitions ( /dev/loopXpY )
 +Find one, You need:
 +<code>
 +cat /proc/partitions
 +ls -l /dev/loop*
 +</code>
 +
 +<code>
 +mdadm -A -R /dev/md9 /dev/loop1p4
 +</code>
 +
 +<code>
 +mount /dev/md9 /mnt/loop
 +</code>
 ====== Parted Use ====== ====== Parted Use ======