Difference between revisions of "CentOS 7.x Mount file or partitions of file as typically done for disks"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>CentOS_7.x_file_system_management|File system management</yambe:breadcrumb> =CentOS 7.x Mount file or partitions of file as typically done for disks= ==kpar...")
(No difference)

Revision as of 05:00, 26 September 2019

<yambe:breadcrumb>CentOS_7.x_file_system_management|File system management</yambe:breadcrumb>

CentOS 7.x Mount file or partitions of file as typically done for disks

kpartx

One option is to use Kpartx as it is straightforward and has been seen to work without any difficulty since quite some time.


losetup

Other option is to use 'losetup'

To use losetup see example given in 'man losetup' below:

         The following commands can be used as an example of using the loop device.
  
              # dd if=/dev/zero of=~/file.img bs=1024k count=10
              # losetup --find --show ~/file.img
              /dev/loop0
              # mkfs -t ext2 /dev/loop0
              # mount /dev/loop0 /mnt
               ...
              # umount /dev/loop0
              # losetup --detach /dev/loop0

That is, use

losetup --find --show -P <file-or-device>

if there are further partitions. Other option is to let device get created and then do

  partprobe /dev/loop1



<yambe:breadcrumb>CentOS_7.x_file_system_management|File system management</yambe:breadcrumb>