AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Linux disk map1/11/2024 ![]() Since it uses the device mapper, the devices it creates go under /dev/mapper, which may be somewhat confusing because that's also where other devices created using the device mapper (LVM volumes, SAN multipath devices), and against which kpartx may be run, live.ĭepending on the distribution, kpartx comes either as part of multipath-tools, or packaged separately. Here's where the neat utility kpartx saves the day.īasically, what kpartx does is to scan a device or file and apply some magic to detect the partition table in it, and create devices corresponding to those partitions. That obviously needs a device node to use, to avoid losing sanity. Guest.img3 1120 13012+ 82 Linux swap / SolarisĪnd also for some software (md) RAID devices.Īnyway, in all these cases, it sometimes happens that one needs to do "something" with the inner partitions (eg, mount them, or recreating or resizing a file system, etc.). The same can happen for plain disk images: # sfdisk -l guest.imgĭisk guest.img: 1305 cylinders, 255 heads, 63 sectors/track dev/mapper/vg0-guestdisk4 0 - 0 0 0 Emptyīut those mysterious devices /dev/mapper/vg0-guestdisk1 etc. dev/mapper/vg0-guestdisk3 0 - 0 0 0 Empty dev/mapper/vg0-guestdisk2 4377 45207+ 82 Linux swap / Solaris Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0ĭevice Boot Start End #cyls #blocks Id System On the host, you just see, say, /dev/vg0/guestdisk, yet it does contain partitions: # sfdisk -l /dev/mapper/vg0-guestdiskĭisk /dev/mapper/vg0-guestdisk: 4568 cylinders, 255 heads, 63 sectors/track Ever wondered why for normal disk devices (eg /dev/sda), device files for the contained partitions are usually available (eg /dev/sad1 etc.), while for other non-disk devices (eg, disk images, LVM or software RAID volumes) there are no such device files? How to access such partitions?Ī typical scenario is an LVM logical volume that is used as virtual disk by a guest VM, and the guest OS creates partitions on it.
0 Comments
Read More
Leave a Reply. |