Page 1 of 1
[SOLVED] Possible for several users to share a VM?
Posted: 26. Apr 2011, 16:59
by kebabbert
Is it possible to create a base Windows installation in a common folder, and then allow every user to access it? So I mark the common VM as "immutable" and then create new VMs for every user. Every VM is based on the common VM, which makes them "differencing disks". Is this possible or are there any hindrances?
Re: Possible for several users to share a VM?
Posted: 28. Apr 2011, 22:47
by Sasquatch
I'm pretty sure this has been discussed before. It was with a single VDI for multiple users without the immutable part, but I think the general idea is still the same. Have you found anything that might help you? I'm sure there is info you can use.
Re: Possible for several users to share a VM?
Posted: 29. Apr 2011, 12:39
by kebabbert
Ok, thanx for your help. I have not found any info, but are considering doing like this, on a fresh install (I bought a SSD so I need to reinstall Solaris)
1) Install my Win7 just like normal in VB
2) Move my Win7 VDI folder to a common directory
3) Make the common VDI immutable
4) Set authorization on the common directory; "read-only" for the group "users"
5) Create a new VDI in my own personal folder, and point to the common VDI as the hard disk to use. Repeat step 5) for every user
This should work? Or do you see any hindrances?
Re: Possible for several users to share a VM?
Posted: 29. Apr 2011, 21:08
by Sasquatch
If every user will have no changes kept, then you would set it all once in a common location and use VBOX_USER_HOME with it. Any other way just beats the purpose, because setting a VDI as immutable is a per-user setting.
Re: Possible for several users to share a VM?
Posted: 1. May 2011, 15:36
by kebabbert
I want every user to keep their changes.
I was thinking of creating one, common immutable vdi, and then have several user vdis act as differencing disks. So I have one immutable disk, and base differencing disks ontop the immutable common vdi.
You are saying that my approach is not correct? Which step would need to be changed for my config to work? Do you know?
Re: Possible for several users to share a VM?
Posted: 1. May 2011, 15:51
by Sasquatch
I have to dive into the manual for that, as I'm my own user and don't deal with multi-user environments. But the idea is as follows, which is similar to your approach.
- Each user will get the drive added as immutable. As noted before, this is a per user setting so you have to be careful with this. One mistake can cause issues.
- You disable the auto-reset or create a snapshot that is mutable. This is described in the manual, section about the different types.
- Make sure that no user has write access to the base VDI, just to be sure errors are avoided.
- Make a backup of the base VDI in case something does happen.
- Test a lot. Instruct your users to NOT touch the VM settings, especially the storage part. Of course, they are allowed to mount CDs, e.g. to update the GA if needed.
This is quite similar to what you had in mind. Just be very careful with it.
Re: Possible for several users to share a VM?
Posted: 3. May 2011, 13:00
by kebabbert
Ok, thank you.
I will try it, and report back here how to do this, for future reference and future questions.
Re: Possible for several users to share a VM?
Posted: 25. May 2011, 15:37
by kebabbert
Sasquatch wrote:I have to dive into the manual for that, as I'm my own user and don't deal with multi-user environments. But the idea is as follows, which is similar to your approach.
- Each user will get the drive added as immutable. As noted before, this is a per user setting so you have to be careful with this. One mistake can cause issues.
- You disable the auto-reset or create a snapshot that is mutable. This is described in the manual, section about the different types.
- Make sure that no user has write access to the base VDI, just to be sure errors are avoided.
- Make a backup of the base VDI in case something does happen.
- Test a lot. Instruct your users to NOT touch the VM settings, especially the storage part. Of course, they are allowed to mount CDs, e.g. to update the GA if needed.
This is quite similar to what you had in mind. Just be very careful with it.
What do you mean with "this is a per user setting"? If I set the base VDI as immutable, it affects everyone, yes? Or, does that setting only affect the curent user I am configuring? If so, I need to set the base VDI as immutable for every user.
Re: Possible for several users to share a VM?
Posted: 25. May 2011, 22:06
by Sasquatch
The VDI setting is per user, because it's registered as immutable. Let's say you hook it up to a VM as immutable and your co-worker adds it through the GUI from his own account on the same computer, any changes he makes to the VDI will be permanent, because he didn't add it as immutable. The VDI isn't modified to be immutable in the file itself, it doesn't get an immutable flag inside. The immutable bit it set in the VB xml file or VM xml file, thus making it per user.
If you want to have it for all users, then you essentially make use of the VBOX_USER_HOME variable to give everyone the exact same VB environment. If you don't want that, then you have to set it immutable for every user manually. You could script it so they get a VM with the VDI attached to it as immutable.
Re: Possible for several users to share a VM?
Posted: 22. Jul 2011, 15:52
by kebabbert
Ok, with your help, and help from chronoboy I think I have got it now. So, I want to have one base image which is immutable, and several users will use differencing disks based on the immutable image. Here is how to do that. It works fine:
Code: Select all
1) Create, configure and setup the VM that is meant to be immutable, move the VM to the correct destination. And remove the VM from the VirtualBox GUI (because it does not exist anymore, it has been moved away).
2) Make the VM directory readable to everybody:
$ chmod go+r /path -R
3) For every user:
A) Make sure VirtualBox knows there is a new configured VM, by adding the VM via "Machine->Add" and then remove the VM from VB (do not delete the VM). This step might not be necessary. Try with B) directly. If you get error message at B), then do A) first.
B) Make the VM immutable:
$ VBoxManage modifyhd /path/image.VDI --type immutable
C) Create a new VM, and choose "Use existing hard disk" and point to the immutable image.
This creates a new differencing disk.
D) Switch off autoreset on the new differencing disk (otherwise, the new VM will always revert back to
the same state as the immutable disk upon reboot)
$ VBoxManage modifyhd --autoreset off DIFFERENCING_DISK_GUID
DIFFERENCING_DISK_GUID is found by looking in the "Virtual Media Manager"
done
References:
http://forums.virtualbox.org/viewtopic. ... ers#p52895
http://forums.virtualbox.org/viewtopic. ... rs#p179616
http://forum.virtualbox.org/viewtopic.php?f=1&p=156575
http://forums.virtualbox.org/viewtopic. ... 78&start=0
http://forums.virtualbox.org/viewtopic. ... rs#p184752
EDIT: corrected A) - D)
EDIT 2: This works fine. Confirmed to work.