shared virtual disks among different VMs on same host

Discussion in 'Proxmox VE: Installation and configuration' started by shantanu, Sep 7, 2012.

  1. shantanu

    shantanu Member

    Joined:
    Mar 30, 2012
    Messages:
    95
    Likes Received:
    6
    Hi,

    Is it possible to create a shared virtual disk for *data* among VMs to
    simulate a "shared LUNs" (fiber channel) scenario.
    Is it possible to do this on a single physical host with just local disk(s) for
    storage.

    So, is the following scenario possible?
    Single machine with a SATA drive of 500GB+
    Three (or more) VMS created on this machine with its own install disk.
    Each VM created as a 64 bit Linux (say, CentsOS x86_64)

    Create a separate small virtual disk of 10 GB and "connect" them to all the
    three VMS.

    Each VM now has its own "OS installed" disk (/dev/sda) and the shared disk which
    is common across the three VMS.

    Of course access to the shared disk would need to be via a cluster file system like
    GFS2 or OCFS2 (which is what I want to perform experiments with)

    Regards,
    Shantanu

    P.S.
    I plan to experiment as suggested here:
    http://forum.proxmox.com/threads/81...o-Proxmox-2-0-How-to-use-an-existing-HD-image

    This seems to be the closest thing that I could find to what I want to do.

    Regards,
    Shantanu
     
  2. e100

    e100 Active Member
    Proxmox VE Subscriber

    Joined:
    Nov 6, 2010
    Messages:
    1,227
    Likes Received:
    23
    No idea if it will work but you will need to manually edit the VM config file since the GUI will not let you assign the same virtual disk to two VMs.
    How to manually assign a disk:
    http://pve.proxmox.com/wiki/FAQ#How_can_I_assign_a_physical_disk_to_a_VM.3F
    NOTE: the "disk" could be a partition, LVM volume, iSCSI lun, qcow/raw VM disk file etc

    Please post your results, I am curious to know if it works or not.
    This could be handy for testing things like GFS2 or other similar technology.
     
  3. spirit

    spirit Well-Known Member

    Joined:
    Apr 2, 2010
    Messages:
    3,220
    Likes Received:
    119

    Hi, i'm doing it in production, with iscsi disk (direct access without lvm).
    But It should you with local device too.

    I'm using ocfs2 in my guests vm.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. shantanu

    shantanu Member

    Joined:
    Mar 30, 2012
    Messages:
    95
    Likes Received:
    6
    I used e100's advice except couldn't set the virtual disk via command-line so I just edited the .conf directly.
    Couldn't believe it was that simple! :)

    I copied the 'ide0' line and made it 'ide1' and pointed to the same file in each VM.

    I do wish there was some straightforward way in the WebGUI to "add existing disk". ;)

    Also, while we are discussing "shared disks", are any special settings/precautions to be taken
    while creating a "shared" virtual disk?
    (VirtualBox has many options for the disk type (Shared, MultAttach ,etc)
    Dynamically resizing disk cannot be "Shareable" etc.)

    @spirit
    Sounds good, I could try that sometimes.

    For my experiments thought, the virtual disk as a disk image file works!

    Thanks and Regards,
    Shantanu
     
  5. shantanu

    shantanu Member

    Joined:
    Mar 30, 2012
    Messages:
    95
    Likes Received:
    6
    Hi,

    I tried the 'qm' command-line as e100 suggested, but could figure out how to specify the 'already existing' virtual disk file on the command-line.
    So, I just edited the conf file of the VMs and copy-pasted the ide1 line from the first VM into the other VMs.

    It was quite simple, though I wish there was a simpler WebGUI method of doing the same! :)

    @spirit:
    That sounds good ... maybe I could try it sometime as well.
    The shared virtual disk (file based) works for my current experiments.

    BTW, Are there any considerations to be done while creating such shared disk(s)
    (e.g. VirtualBox has some restrictions; 'Shareable' disk cannot be dynamically sized)

    Thanks and Regards,
    Shantanu
     
  6. spirit

    spirit Well-Known Member

    Joined:
    Apr 2, 2010
    Messages:
    3,220
    Likes Received:
    119
    you can't use cache=none or cache=writeback, because you can't have a writeback cache in your guest.
    (ocfs2 don't start)

    I don't think you can resize online.

    otherwise I don't have special setup to share disk.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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