use a directory as VM disk

Discussions related to using VirtualBox on Linux hosts.
Post Reply
BerndM
Posts: 23
Joined: 7. Oct 2011, 21:59
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: keine

use a directory as VM disk

Post by BerndM »

Hello,

I use more VMs on one PC and to square the PCIe SSD I have configured a RAM disk. In this I copy empty vdi files for every VM per script by power on. In this vdi is only the temp directories for Windows. SO is after power on every time the temp directories empty, the speed to this is verry hig and so reduce the write cycle into the SSD.

After 10 VMs ist this verry hard with the configuration and so.

Now I search for a better solution. I will create for every VM an directory in the RAM disk and mount this as disk into my VM.
The using of the shared folder is to slow and some software can't use it. This is mapped as network drive.

Exist a solution to configure an existing path on the Linux host as disk for the VM?

Thanks for our help,
Bernd
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: use a directory as VM disk

Post by scottgus1 »

BerndM wrote:Exist a solution to configure an existing path on the Linux host as disk for the VM?
To the best of my knowledge, no.

Virtualbox can only share a folder via Virtualbox Shared Folders, through Guest Additions. This VSF can be mounted in the VM OS as another drive, but full permissions access may be limited: normally only file copying is a sure thing.

Virtualbox can also make a secondary virtual drive file that will appear as another drive in the VM.

Virtualbox can also take a whole host drive or a partition of the host drive as a Raw Disk Access drive in the VM. (Raw Disk Access is described in section 9.7 of the manual. It is an Experts-Only feature which can result in data loss if done incorrectly, and we don't explain how to do it on the forum.)

You can also share a host folder using the host's folder sharing system, via a Bridged or Host-Only network.

Virtualbox cannot insert a host folder as a drive in the VM.

You'll probably do best as you were doing at the beginning: making a separate drive file for each VM, copying the drive files to the ram drive at host boot, then starting the VMs. Inside the VMs, set each secondary drive as the TEMP folder drive. Shared folders have extra networking overhead which may slow down the ram drive access.
BerndM wrote:After 10 VMs ist this verry hard with the configuration and so.
This should be scriptable as a loop, via an ini list of VM names, or the output of "vboxmanage list VMs".
BerndM
Posts: 23
Joined: 7. Oct 2011, 21:59
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: keine

Re: use a directory as VM disk

Post by BerndM »

Thanks, for your answer.

So I have use the correct way for VBox. Nice. First I have used the shared folder function. But this use the network and is slower.

Exists a solution via script to copy one VDI file for every VM and configure it as HDD to the VM? And this every startup of the PC. So I know is the VDIs konfigured in the Manager for virtual medien. And this contains all configured VDIs.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: use a directory as VM disk

Post by scottgus1 »

BerndM wrote:Exists a solution via script
Yes, see the "vboxmanage" commands in the manual. There's also an example of configuring a whole VM via command line somewhere in the manual, but I can't find it right off.

Of course, if your VM has a VDI it always expects to see, you can simply copy an existing source VDI to the place where the VM is set to expect it before starting the VM. This process would only be basic file-copying in script, without any vboxmanage commands needed.
Post Reply