Find the answer to your Linux question:
Results 1 to 2 of 2
Hi! I have several disks in one large raid5 array, which is /dev/md127 This one raid device is using lvm2, and is a physical volume in a volume group called ...
  1. #1
    Just Joined!
    Join Date
    Oct 2004
    Posts
    3

    [SOLVED] need to access a partition within an LV

    Hi!

    I have several disks in one large raid5 array, which is /dev/md127

    This one raid device is using lvm2, and is a physical volume in a volume group called lvm-raid.

    I then have many logical volumes within this volume group for various things, including virtualization.

    I have a VM (using kvm for full virtualization, set up using the graphical virt-manager) which uses one of these logical volumes as its disk. From the host, this logical volume is /dev/mapper/lvm--raid-lv_webserver, with a major number of 253 and a minor number of 6.

    Code:
    # ls -l /dev/mapper/lvm--raid-lv_webserver 
    brw-rw---- 1 root disk 253, 6 Feb  9 11:26 /dev/mapper/lvm--raid-lv_webserver
    When creating the virtual machine, I created two partitions: partition 1, ext4, for the root filesystem, and partition 2 as swapspace. I can see these using fdisk to print the partitions of my logical volume:

    Code:
    # fdisk -l /dev/mapper/lvm--raid-lv_webserver
    
    Disk /dev/mapper/lvm--raid-lv_webserver: 2013 MB, 2013265920 bytes
    255 heads, 63 sectors/track, 244 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
                                 Device Boot      Start         End      Blocks   Id  System
    /dev/mapper/lvm--raid-lv_webserver1   *           1         212     1697754+  83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/mapper/lvm--raid-lv_webserver2             212         244      262144   82  Linux swap / Solaris
    My issue is that I need to expand the size of these partitions, which are inside this logical volume.

    I am thinking I need to use mknod to create /dev/mapper/lvm--raid-lv_webserver1, but I cannot figure out the appropriate major and minor numbers to use. When I test is with a mount command, it always tells me "mount: /dev/mapper/lvm--raid-lv_webserver1 is not a valid block device"

    So, the question is, how do I access partitions within a logical volume?
    Last edited by gsgleason; 02-09-2011 at 08:41 PM. Reason: fixed

  2. #2
    Just Joined!
    Join Date
    Oct 2004
    Posts
    3

    Solved

    I found an answer. These forums will not let me link to where I found the answer, however, so I am unable to share it.

    The solution is to use kpartx.

    kpartx -a /dev/mapper/lvm--raid-lv_webserver

    That automatically created these:
    Code:
    # ls -l /dev/mapper/lvm--raid-lv_webserver*
    brw-rw---- 1 root disk 253,  6 Feb  9 11:26 /dev/mapper/lvm--raid-lv_webserver
    brw-rw---- 1 root disk 253,  9 Feb  9 14:09 /dev/mapper/lvm--raid-lv_webserver1
    brw-rw---- 1 root disk 253, 10 Feb  9 14:09 /dev/mapper/lvm--raid-lv_webserver2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...