shared virtual disks among different VMs on same host

shantanu

Well-Known Member
Mar 30, 2012
112
11
58
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
 
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.
 
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


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.
 
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
 
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
 
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

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.
 
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
Hi Guys,

I do know this post is really old, however I am trying to do the same "Sharing the same virtual disk with 2 VMs" but unfortunately only adding the same disk line to the other vm is not enough , proxmox cannot start the remaing VM because it cannot activate the same disk (lvm disk) whicj is already active on the other vm, could you please tell how exactly did you define the path on the other vm?


Error message: can't activate LV '/dev/iscsivg/vm-200401-disk1': Failed to find logical volume "iscsivg/vm-200401-disk1"

thanks
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!