Virtual filesystem images: Difference between revisions

From lippmann wiki
Jump to navigation Jump to search
(Created page with "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 kp...")
 
No edit summary
Line 15: Line 15:


and these are now visible in /dev/mapper:  
and these are now visible in /dev/mapper:  
[root@rkvm1 select_fun]# ls -lrt /dev/mapper/
 
total 0
[root@rkvm1 select_fun]# ls -lrt /dev/mapper/ |grep loop
lrwxrwxrwx. 1 root root      7 Jan 29 19:42 rl-swap -> ../dm-1
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p1 -> ../dm-3
lrwxrwxrwx. 1 root root      7 Jan 29 19:42 rl-root -> ../dm-0
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p2 -> ../dm-4
crw-------. 1 root root 10, 236 Jan 29 19:42 control
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p3 -> ../dm-5
lrwxrwxrwx. 1 root root      7 Jan 29 19:42 rl-var_lib_libvirt_images -> ../dm-2
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p4 -> ../dm-6
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p1 -> ../dm-3
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p5 -> ../dm-7
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p2 -> ../dm-4
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p6 -> ../dm-8
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p3 -> ../dm-5
lrwxrwxrwx. 1 root root      7 Jan 29 20:12 loop1p7 -> ../dm-9
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

Revision as of 04:14, 30 January 2024

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