Accessing the partitions on an VLM volume

Posted by projix on Server Fault See other posts from Server Fault or by projix
Published on 2012-10-19T16:23:34Z Indexed on 2012/10/19 17:04 UTC
Read the original article Hit count: 158

Filed under:
|
|
|
|

Suppose you have an LVM volume /dev/vg0/mylv. You have presented this as a virtual disk to a virtualised or emulated guest system. During installation the guest system sees it as /dev/sda and partitions it into /dev/sda{1,2,5,6} and completes the installation. Now at some point you need to access those filesystems from within the host system, without running the guest system. fdisk sees these partitions just fine:

# fdisk -l /dev/vg0/mylv
           Device Boot      Start         End      Blocks   Id  System
/dev/vg0/mylv1            2048      684031      340992   83  Linux
/dev/vg0/mylv2          686078    20969471    10141697    5  Extended
/dev/vg0/mylv5          686080     8290303     3802112   83  Linux
/dev/vg0/mylv6         8292352    11980799     1844224   83  Linux

However, the devices such as /dev/vg0/mylv1 do not actually exist. I guess that because they're within an LV, the OS does not recognise this type of nesting by default. Is there any way I can prod Linux so that /dev/vg0/mylv1 or equivalent appears and thus becomes mountable within the host system?

I understand that it's possible with qemu-nbd, and will use this if necessary. However, I was hoping for something more direct if possible, rather than simulating a network block device and attaching that.

© Server Fault or respective owner

Related posts about linux

Related posts about lvm