Building a VMware Shared Disk
When you use a lot of VMware servers and/or desktops, you will need a lot of harddisk space. Also you need to copy software and data from one virtual machine to the other. This can be made very easy when you build a shared disk.
A shared disk is a disk that is used as a D: or E: drive in many images. But building a shared disk that is used by many machines instead of copying it for every machine is not that easy. I had to search over the internet and take the information from many forums to finally get a working solution.
In this tutorial I'm going to explain how to build a shared disk, and how to use it in your environment. For the tutorial I will build one shared disk that contains all my software and all my data so every machine thinks it is local on the D drive.
Remember to always have a good backup of the data on the shared disk. This will eventually prevent you from loosing a lot of data.
Also remember that if you just build a virtual disk, it is actually a shared disk that can be used by one machine at a time. The tutorial below will help you make a real shared disk that can be used by many machines at the same time.
1. Building Your VMWare Shared Disk
First you need Virtual Windows 2003 server.
Edit your Windows Server 2003 Virtual Machine Settings and add 2 virtual disks. Your machine must be stopped to do this. Proceed as following:
- create a empty folder on your harddisk where you will place your virtual disks.
- Edit your Windows Server 2003 Virtual Machine Settings.
- Click on add hardware.
- Create a new virtual disk.
- Disk size 20Gb or less or more. (do not allocate disk now)
- Define your destination path as created previously + name your disk DATA-SHARED>
- Select the advanced options: select the virtual device node to "SCSI 1:0" and the mode to "Independent" and "Persistent"
2. VMWare Device Configuration
Now you have to attach it to the other machines.
- Edit the VM settings. Again the machine should be stopped before you can perform this task.
- Click on add hardware and select harddisk
- Select existing virtual harddisk and give the correct path to the disk.
3. Adding Line in VMWare Configuration File
This entire configuration is stored in the vmx file of your Virtual Machine. Edit it and take a look at it. You may want to do some cleaning but make sure you first create a backup of the configuration file before you edit it.
You'll need to add some lines to make VMWare use a shared disk as it would do in real cluster hardware.
Go to the bottom of the vmx file. There you will see the following lines:
scsi1.present = "TRUE" scsi1.sharedBus = "none" scsi1.virtualDev = "lsilogic" scsi1:0.present = "TRUE" scsi1:0.fileName = "D:\Virtual Machines\Shared Disk\SHARED-DISK.vmdk"
Change them in the lines below:
disk.locking = "FALSE" diskLib.dataCacheMaxSize = "0" #scsi1 data storage scsi1.present = "TRUE" scsi1.virtualDev = "lsilogic" scsi1.sharedbus = "none" scsi1:0.present = "TRUE" scsi1:0.fileName = " D:\Virtual Machines\Shared Disk\SHARED-DISK.vmdk " scsi1:0.mode = "independent-persistent" scsi1:0.shared = "TRUE" scsi1:0.redo = ""
The lines will ensure you that VMWare will not take a local copy of the disk in each client or server, and it will prevent the started Vmware to lock the file. When the file is locked you receive an error and the second and third machine will not startup.
Without adding the lines to a Vmware server or ESX server, the file will just be copied by every next machine, and you will have a shared disk that is not shared.
In that case you will notice that your harddisk will be getting full with copies of the shared disk.
4. Initialize and Convert Shared Disks
Start your Virtual machine by clicking and open the "Computer Management" dialog (Start > All Programs > Administrative Tools > Computer Management). Click on the Disk Management tree node and you'll immediately be prompted with the "Initialize and Convert Disk Wizard".
- Do NOT convert any of the disks to dynamic since we need them to be basic so make sure that the disk is unchecked.
- Create the disk to be an extended partition of all the available size
- When this is done, create the partition as a logical drive of the available size, assign a drive letter and format it with NTFS with the quick format checkbox enabled.
The disk will now be formatted and completely prepared for the use.
5. Prepare Your Second Node
To build the second server or client to use the shared disk, just power off your actual server (we'll call it Server 1) and duplicate the VMWare files (separate them into different folders).
You'll then need to power on the copy of the Server 2, change the machine name in Server 2 and give a new IP Address.
When you do this with a client, just copy the client and start the copy as client2.
6. Start Using Your Shared Harddisk
Now all your clients and servers that are cloned from the original will use the shared disk. This will save you a lot of harddisk space in your virtual environment.
The shared disk created in this article can be used for many tasks.
It can be used as a disk for a SQL cluster, a Disk for a file cluster, or just as a datashare. Your servers will see it as a local disk.
Regards
Erik Westhovens
www.DinamiQs.com

Comments 14 Comments • Jump to latest comment
Can't you mount a secondrive to each vm session point to a physical drive? have them each think its a d: drive
Lee Wilburn
Suzlon Wind Energy
If your question has been resolved, please click "Mark as Solution"! Thank you. Hope it helps!
it is not possible to mount a real disk to a Vm.
there should be a way to share a physical disk, but all we seeis that the physical is actually copied and than the copie is attached to the VM.
Regards
Erik
www.DinamiQs.com
Regards Erik www.DinamiQs.com Dinamiqs is the home of VirtualStorm (www.virtualstorm.org)
*************************************************************
If your issue has been solved, Please mark it as solved
***********
In vmware you can mount a physical drive for sure:
Click Edit Virtual Machine Settings
Click Add
Click Next
Choose Hardrive
Click Next
Choose Use a physical disk (for advance users)
You can use the whole disk or partitions:
http://www.vmware.com/info?id=127
Vmware workstation 5.X and 6.X VMWARE server have this ability not sure about ESX / ESXi
Lee Wilburn
Suzlon Wind Energy
If your question has been resolved, please click "Mark as Solution"! Thank you. Hope it helps!
Hello,
On VM server 2 - I tried your solution and when powering on the first server just after creating the second disk and modifying the vmx file I'm getting an error "SCSI Reservation requires that disk locking be disabled. Please refer to the documentation of this feature for instructions on how to disable this and what precautions should be taken when running with disk locking disabled.
Module DevicePowerOn power on failed."
Please advice,
Thank you
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedbus = "none"
scsi1:0.present = "TRUE"
scsi1:0.fileName = " D:\Virtual Machines\Shared Disk\SHARED-DISK.vmdk "
scsi1:0.mode = "independent-persistent"
scsi1:0.shared = "TRUE"
scsi1:0.redo = ""
You see, i take away the line starting with the #.
the issue you dexcribed is a known issue in Server version 2. it reads the line with the # wrong.
Give it a try and let us know.
The line scsi1:0.mode = "independent-persistent" makes sure the disk is not aleterd by the machines. The machines keep a redo log with all changes inside.
scsi1:0.mode = "undoable" will change the disk at onze in every machine.
scsi1:0.mode = "independent" will give you the option to save changes or to undo them.
Regards
Erik
www.DinamiQs.com
Regards Erik www.DinamiQs.com Dinamiqs is the home of VirtualStorm (www.virtualstorm.org)
*************************************************************
If your issue has been solved, Please mark it as solved
***********
Erik,
Finaly I have shared disk for my VM servers. Thanks!!
Tested on 2 servers by now - both see same disk but when Writing new file on serer1, the file don't show on server2 - even after booting both VM's.
Also, after booting both VM's I lost file saved in server2.
Please advice
Thanks,
Gabi
the 1st server VMX file:
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "none"
scsi1:0.present = "TRUE"
scsi1:0.fileName = "D:\Virtual Machines\Share-Disks\Data-Shared.vmdk"
scsi1:0.mode = "independent-persistent"
scsi1:0.shared = "TRUE"
scsi1:0.redo = ""
scsi1.pciSlotNumber = "36"
Erik,
I found I didn't followed your instructions completly. Instead of copying the 1st server file to the 2nd, I created new VM and added a new "Existing" disk drive without modifying the vmx file (server2).
After copying the new disk setion from server1 vmx to server2, I can see all existing files/folders on both - But, I still don't see the changes when applied (new files..).
When trying the "undoable" option, the VM failed to start with "Failed to power on: A general system error occurred: " message.
Thanks again,
Gabi
Hi Erik.
I've gotten everything up and running; both machines see the files, and they resynchronize after a reboot. BUT, they will not see the file updates in real time. I tried modifying the setting scsi1:0.mode = "independent-persistent" to scsi1:0.mode = "undoable", but when I do that, the VMs refuse to boot with an error: "Startup was interupted by user". In the log, the following error:
Jan 17 16:31:53.942: vmx| SNAPSHOT: Illegal mode for 'scsi1:0': undoable.
I'm think this may be a version issue. I'm running ESXi 4.0. Do you have any clue as to what may be happening here? Or more to the point... how to fix it?
Thanks much,
Bill
Hi Bill,
Did you got a solution to this problem.
Hi Erik,
I am also facing the same issue,I can see the Drive but its not getting synchrnoized until I restarts the Servers.
Any help will be appreciated.
Thank you
"independent-persistent" They will not see the file updates in realtime since the sync happens when it shutsdown based on will give you the option to save changes or to undo them.
Lee Wilburn
Suzlon Wind Energy
If your question has been resolved, please click "Mark as Solution"! Thank you. Hope it helps!
when finished from step no 1 i have got error ( Error: A file was not found. )
can you help me please ?
Now i can used the same disk or vmdk files to be another disk and initialize with Windows 2003 but for other VM (XP,Vista,7 or any windows) they can use same disk but it not sync data.
Examples :When I create "New Folder" at windows 2003 other windows not see update and can create with same name.
So i need your help.
Thanks in Advance.
PS.I'm using VMWare ESXi 4.0 update2
Im following the steps with Win 2003 on VMWare v6 but i get presented with the following message when I attempt to create the cluster and access the shared drives.
thx
could not locate a sharable quaram and a local quaram will be created
Hi Guys,
I want to share another disk to other virtual machines. What would be the script?
Is this correct?
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
#data shared
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedbus = "none"
scsi1:0.present = "TRUE"
scsi1:0.fileName = "C:\\data-shared\shared.vmdk"
scsi1:0.mode = "independent-persistent"
scsi1:0.shared = "TRUE"
scsi1:0.redo = ""
#another shared disk
scsi1:1.present = "TRUE"
scsi1:1.fileName = "\data-shared\shared2.vmdk"
scsi1:1.mode = "independent-persistent"
scsi1:1.shared = "TRUE"
scsi1:1.redo = ""
Thanks.
Would you like to reply?
Login or Register to post your comment.