Virtual filesystem images
Jump to navigation
Jump to search
kpartx
if you have a raw disk image, for example a disk drive for a hypervisor (raw file or vmdk) it may have multiple partitions.
to quickly create devices for these you can use kpartx. after they are created you can mount these devices on your filesystem:
e.g.:
[root@rkvm1 select_fun]# kpartx -v -a DataONTAPv-kvm.raw add map loop1p1 (253:3): 0 66464 linear 7:1 64 add map loop1p2 (253:4): 0 8390592 linear 7:1 66528 add map loop1p3 (253:5): 0 42336 linear 7:1 8457120 add map loop1p4 (253:6): 0 2 linear 7:1 8499456 add map loop1p5 (253:7): 0 3146976 linear 7:1 8500464 add map loop1p6 (253:8): 0 4196304 linear 7:1 11648448 add map loop1p7 (253:9): 0 5040 linear 7:1 15845760
and these are now visible in /dev/mapper:
[root@rkvm1 select_fun]# ls -lrt /dev/mapper/ |grep loop lrwxrwxrwx. 1 root root 7 Jan 29 20:12 loop1p1 -> ../dm-3 lrwxrwxrwx. 1 root root 7 Jan 29 20:12 loop1p2 -> ../dm-4 lrwxrwxrwx. 1 root root 7 Jan 29 20:12 loop1p3 -> ../dm-5 lrwxrwxrwx. 1 root root 7 Jan 29 20:12 loop1p4 -> ../dm-6 lrwxrwxrwx. 1 root root 7 Jan 29 20:12 loop1p5 -> ../dm-7 lrwxrwxrwx. 1 root root 7 Jan 29 20:12 loop1p6 -> ../dm-8 lrwxrwxrwx. 1 root root 7 Jan 29 20:12 loop1p7 -> ../dm-9