How can i mount a Partition of a VM-LVM

Discussion in 'Proxmox VE: Installation and configuration' started by trendco, Feb 7, 2012.

  1. trendco

    trendco Member
    Proxmox Subscriber

    Joined:
    Jan 9, 2012
    Messages:
    279
    Likes Received:
    1
    Hi,

    i have installed a Ubuntu-VM on a LVM.

    When the VM is running

    shows

    But when the VM is off, the fdisk-command shows nothing.

    Is it possible to mount the partitions of "/dev/Raid-VG/vm-103-disk-1p1" from the host?


    Alex
     
  2. e100

    e100 Active Member
    Proxmox Subscriber

    Joined:
    Nov 6, 2010
    Messages:
    1,235
    Likes Received:
    24
    You need to use a utility named kpartx

    Install it:
    Code:
    apt-get install kpartx
    Run it:
    Code:
    kpartx -a /dev/Raid-VG/vm-103-disk-1
    
    See new mappings:
    Code:
    ls /dev/mapper/ 
    Mount the first partition:
    Code:
    mount /dev/mapper/Raid-VG-vm--103--disk--1p1 /mnt
    Unmount:
    Code:
    umount /mnt
    Undo what kpartx did and return system to normal:
    Code:
    kpartx -d /dev/Raid-VG/vm-103-disk-1
     
  3. Faye

    Faye Member

    Joined:
    Jan 2, 2012
    Messages:
    39
    Likes Received:
    0
    This is excellent. Any idea how to install grub on a VM image created this way? My goal is to use the same tar ball for VMs as containers. I struggled a lot and failed. There's probably a simple answer.
     
  4. trendco

    trendco Member
    Proxmox Subscriber

    Joined:
    Jan 9, 2012
    Messages:
    279
    Likes Received:
    1
    Hi e100,

    many thanks, exactly what I was looking for!


    Alex
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice