Admin Mount milti partition image
2018-06-02 15:44:33

To mount multi partition image file one can use offset option:

At first, using fdisk command in terminal

# fdisk -u -l rpi_image280914

we define partition structure of the image rpi_image280914. The output looks like

  
Disk rpi_image280914: 16.0 GB, 16012804096 bytes
255 heads, 63 sectors/track, 1946 cylinders, total 31275008 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cdac7

                   Device Boot      Start         End      Blocks   Id  System
rpi_image280914p1   *        2048      514047      256000    c  W95 FAT32 (LBA)
rpi_image280914p2          540672    31242239    15350784   83  Linux

Take the Start sector of the partition you want and multiply that value by the Units size. So if you want the second partition you will get 540672 * 512 = 276824064.

Further, you have to create a mount point and mount the partition:

# mkdir rpi_partition2

# sudo mount -o loop,offset=276824064 rpi_image280914 rpi_partition2/

To unmount the partition

# sudo umount rpi_partition2/

Comments
    Add Comment
    Welcome!
    • Boot Linux from USB. part I

      Multiple boot using GRUB2 from live ISO files located on USB
      Read more ...

    • Boot Linux from USB. part II

      Multiple boot using SYSLINUX from live ISO files located on USB
      Read more ...

    • Tweet update.

      Added tweet on @lloadm
      Read