Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
topics:disk-image-mount-partition [2017/03/26 05:51]
orzfly
topics:disk-image-mount-partition [2017/03/26 05:58]
orzfly
Line 1: Line 1:
 ====== Mount Partitions in Disk Image ====== ====== Mount Partitions in Disk Image ======
 +
 +  * [[#losetup_partscan]]: If you have util-linux v2.21 or higher (for example, Ubuntu 16.04).
 +  * [[#partprobe]]: If you have a recent kernel, and pass loop.max_part=63 on boot (if loop is built-in) or to modprobe (if loop is a module).
 +  * [[#kpartx]]: ''apt install kpartx''
 +  * [[#losetup_offsetsizelimit]]: AlwaysWorks™
  
 ===== losetup partscan ===== ===== losetup partscan =====
Line 84: Line 89:
 ==== Mounting ==== ==== Mounting ====
  
-  - Mount image as loop device<code> +  - Get partition details<code> 
-# losetup /dev/loop0 rpool.img+# fdisk -l rpool.img 
 +Disk rpool.img: 21 GiB, 22548578304 bytes, 44040192 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 
 +Disklabel type: gpt 
 +Disk identifier: B37248EB-F1D7-DA47-A42D-4C42AF20D328 
 + 
 +Device        Start      End  Sectors Size Type 
 +rpool.img1     2048 44021759 44019712  21G Solaris /usr & Apple ZFS 
 +rpool.img9 44021760 44038143    16384   8M Solaris reserved 1 
 +</code> 
 +  - Mount partition<code bash
 +# losetup /dev/loop0 rpool.img --offset $((512 * 2048)) --sizelimit $((512 * 44019712))
 </code> </code>
- 
 ==== Unmounting ==== ==== Unmounting ====