How to create virtual block devices from file? [duplicate]
After some more research I have found, there are at least two methods to test:
- According to this post,
kpartx
is applicable tool.- Unfortunately it didn't work on Arch Linux for me
- It's from AUR:
yaourt multipath-tools-git
, seems to be not well supported/finished and ended up with errors like:device-mapper: reload ioctl on loop0p1 failed: No such device
- Can be at least used to list the embedded partitions:
kpartx -l image
- EDIT: According to this post, it seems to be obsolete and the preferred method is the following one.
- According to this post,
losetup
can be used.- Firstly it didn't work:
losetup /dev/loop0 image
(missing the devices for particular partitions). - Trying again using additional
-P
option did the work:losetup -d /dev/loop0
,losetup -P /dev/loop0 image
and/dev/loop0pX
devices were created. - These devices are then mountable as expected, like
mount /dev/loop0p3 /mnt/x -t ntfs
- Firstly it didn't work: