You are on page 1of 9

Building a VMware Shared Disk

erikw
November 18th, 2008
Filed under: Compatibility, Endpoint Management and Virtualization

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.
NOTE: If you have a virtual machine already running, and you wish to attache it to the shared
disk, remember not to convert or format the drive because you will loose your data.
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
+4 (4 votes)

• Login or register to post comments


• Comments RSS Feed

wuzfuzzy
1 year 29 weeks ago
mount a physical drive
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!
0 votes

• Login or register to post comments

erikw
1 year 29 weeks ago
Unfortunatly
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)
+1 (1 vote)

• Login or register to post comments

wuzfuzzy
1 year 29 weeks ago
Actually you can with WMWARE workstation
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!
0 votes

• Login or register to post comments

Gabi
1 year 28 weeks ago
Getting error "SCSI Reservation requires that disk locking be.."
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
0 votes

• Login or register to post comments

erikw
1 year 28 weeks ago
The script can be altered a little bit to override the error
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)
+2 (2 votes)

• Login or register to post comments

Gabi
1 year 28 weeks ago
Now its working - Thank you Erik :-)
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"
+1 (1 vote)

• Login or register to post comments

Gabi
1 year 28 weeks ago
Now its working - Update!!
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
+1 (1 vote)

• Login or register to post comments

firecat
20 weeks 6 days ago
Not updating files on second server
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
0 votes

• Login or register to post comments

wuzfuzzy
19 weeks 4 days ago
I would leave the SCSI setting to independent-persistent"
"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!
0 votes

• Login or register to post comments

why not
16 weeks 6 days ago
Error: A file was not found
when finished from step no 1 i have got error ( Error: A file was not found. )
and virtual disk not created !!!!
can you help me please ?

• Configure ntp

Now edit /etc/ntp.conf in both the machines (RAC1,RAC2) and add the following two
lines

server rac1.localdomain

restrict rac1.localdomain mask 255.255.255.255 nomodify notrap noquery


In RAC1 machine start the ntp service The command is as follow:

#service ntpd restart

In RAC2 machine run the following command to sync the time

while [ true ]; do sleep 1; ntpdate -u 192.168.2.101 >>/dev/null;date ; done

while [ true ]; do sleep 1; date ; done

You might also like