Category: VM

Backing up VMware Workstation VMs

comments Comments Off on Backing up VMware Workstation VMs
By , October 17, 2017 12:45 PM

Backing up VMware Workstation VMs

We run a small number of VM instances which are mostly sandbox type environments and hence backups are not always essential, but if you are running something a bit more crucial and wish to back up a VM regularly, what are your options? Running ‘traditional’ third party backup s/w within the guest OS is one approach (and adopted widely) and more VM-centric enterprise solutions such as VMware’s own VCB (VMWare Consolidated Backup) are also well suited but only available for VMware ESX.

Where does that leave us if we run VMware Workstation and want to back up the entire VM Guest ‘image’? The easiest manual way of doing this is by selecting ‘suspend’ in VMware Workstation for the relevant guest, copy the VM files to another drive  (.vmx, .vmdk etc) and restart the VM. Easy. The con of this, of course, is that you are bringing down your VM for a short period but for most situations it does the job and has the advantage of being very easy to get the VM started again in a DR situation (i.e. simply take the backed up VM files and fire them up on a new host).

So how can we use the above ‘suspend and resume’ approach but automate it so it does this nightly for example? The command line comes to your rescue :-)

Before you start, ensure your relevant VM is not open on the desktop through the VMWare Workstation GUI, as this locks the instance.

Starting a VM instance from the command line

Use vmrun command with start parameter, for example:

“C:\Program Files\VMware\VMware Workstation\vmrun” start “F:\YourVMs\YourVMInstance\Windows Server 2003 Standard Edition.vmx”

Suspending a VM instance from the command line

Use vmrun command with suspend parameter, for example:

“C:\Program Files\VMware\VMware Workstation\vmrun” suspend “F:\YourVMs\YourVMInstance\Windows Server 2003 Standard Edition.vmx”

(for more switches, simply type vmrun with no parameters).

Creating a backup script

We’ve now got all we need to create a very simple windows cmd file, for example, create a VMBackup.cmd file and enter:

:: Suspend VM
“C:\Program Files\VMware\VMware Workstation\vmrun” suspend “F:\YourVMs\YourVMInstance\Windows Server 2003 Standard Edition.vmx”

:: ROBOCOPY (or xcopy) the files somewhere, pref a different box or network drive, for example
Robocopy.exe F:\YourVMs\YourVMInstance\ G:\externaldrive\backuparea\VMBackups\ /e /np /eta /r:1 /w:1 /log:F:\VMScheduledBackups\Logs\YourVMInstance-BackupLog.txt

:: restart the VM
“C:\Program Files\VMware\VMware Workstation\vmrun” start “F:\YourVMs\YourVMInstance\Windows Server 2003 Standard Edition.vmx”

You can now schedule this cmd file to run as a windows scheduled task in the normal way.  I use both a daily and weekly backup regime.

This is obviously a very simple backup approach and it does not alert backup failures etc (you’ve just got your trusty logs!) but for non-critical sandbox type environments it does the job nicely.


  1. if you want to extend this to include some log, it should be possible to add a line or two to your script to echo comments and run a md5 or similar on the source and backup.
    i am not about to add how to do this but a quick search of the internet should be enough to work it out


  2. Yes absolutely, all my backup scripts have full logging, but these were not included to keep the example short. Cheers Dave


  3. Hi – I completely powered off my VM and copied the entire VM directory. I then used the “Import” feature to add the VM to a different computer also running VMWare Workstation 7. The VM began booting, but blue-screened during Windows start-up. Can you see anything I did wrong?
    I am running VMWare Workstation 7 and my guest OS is Windows Server 2008 R2 Standard.


  4. I’ve not had any problems opening backed up VMs (we have DR tested a few times), although we have not upgraded to Workstation 7 yet. It is worth reading the release notes for version 7 to see if this helps you. Dave


  5. Its worth noting that you can save your commands as “jobs” in RoboCopy, which allows for really short commands to backup and restore on the fly if you can’t schedule this to be done regularly (like on my company laptop I take home every night).

    The /SAVE:jobname command will save the preceding command as a .rcj file, you can then run robocopy /JOB:jobname.rcj and it will execute the commands saved in the file.



comments Comments Off on DD-WRT VPN PIA
By , January 14, 2016 11:54 PM
I’ve read many users have trouble setting up the OpenVPN client on some DD-WRT flashed routers. There are DD-WRT builds that lack the ADVANCED OPTIONS button, here’s my solution:

Set Static DNS 1 to:
Set Static DNS 2 to:
or any other DNS servers you want.
2- Set TIME SETTINGS to match your current location.
Enable OpenVPN Server (Just click the enable button, do nothing else). This step you can skip. It only serves the purpose of enabling OPENVPN STATUS so that you can see the current state and log of PIA OPENVPN CLIENT.
Copy – Paste the text from link below to commands, don’t forget to edit Your_PIA_Username and Your_PIA_Password with your own credentials, if you want you can change the remote regional-gateway (us-west…) too:
6- That should do it, from now on every device that gets a IP address from your router will go through PIA’s VPN tunnel.
As you can see, we did nothing to the OpenVPN client in SERVICES – VPN. The script takes care of that for us.

# Add - delete - edit servers between ##BB## and ##EE##
remote 1194

#### DO NOT CHANGE below this line unless you know exactly what you're doing ####


OPVPNENABLE=`nvram get openvpncl_enable | awk '$1 == "0" {print $1}'`

if [ "$OPVPNENABLE" != 0 ]; then
   nvram set openvpncl_enable=0
   nvram commit

sleep 10
mkdir /tmp/pia; cd /tmp/pia
echo -e "$USERNAME\n$PASSWORD" > userpass.conf
echo "$CA_CRT" > ca.crt
echo "#!/bin/sh
iptables -t nat -I POSTROUTING -o tun0 -j MASQUERADE" >
echo "#!/bin/sh
iptables -t nat -D POSTROUTING -o tun0 -j MASQUERADE" >
chmod 644 ca.crt; chmod 600 userpass.conf; chmod 700
sleep 10
echo "client
auth-user-pass /tmp/pia/userpass.conf
management 5001
management-log-cache 50
dev tun0
comp-lzo adaptive
script-security 2
mtu-disc yes
verb 4
mute 5
cipher bf-cbc
auth sha1
tun-mtu 1500
resolv-retry infinite
remote-cert-tls server
log-append piavpn.log
ca ca.crt
status-version 3
status status
$REMOTE_SERVERS" > pia.conf
ln -s /tmp/pia/piavpn.log /tmp/piavpn.log
ln -s /tmp/pia/status /tmp/status
(killall openvpn; openvpn --config /tmp/pia/pia.conf --route-up /tmp/pia/ --down /tmp/pia/ &
exit 0

Dell Equallogic generic hard drive firmware update

By , March 5, 2013 1:24 AM
> This might be of some use - I've updated a ST31000340NS (ES.2 1TB > version) under Linux to MA0D using hdparm v9.27's --fwdownload switch on > Debian 5. You have to strip the first 256 bytes of Dell header from the > start of the Dell update binary using dd bs=256 skip=1 ... 
You're the man!! Your method worked like a charm (after rebooting in a clean,
live environment).
These are the steps I did to update the SATA HD firmware on my Dell R410
without SAS controller and in Debian:

1) boot the server from a live CD (Ubuntu 9.10 in my case)
2) downloaded from the Sid package of hdparm (v9.27)
3) installed it in the Ubuntu live session
4) downloaded the firware from and unpacked it
5) dd if=payload/MA0D.fw of=payload/MA0D.lod bs=256 skip=1
6) hdparm --fwdownload payload/MA0D.lod /dev/sda
7) then added the extra switches that hdparm needs to follow with this
dangerous operation
8) firmware updated!

Just to mention that I did the first hdparm --fwdownload with the HD *working*
(I was using the system installed on it, not a live one) and the updated
failed (due to the disk disconnecting from the SATA bus) but the disk worked
without problem. No fried disk, no bricking at all.

It’s seems it’s 208 bytes

I need to update firmware on my Seagate Constellation ES ST32000644NS branded as Dell Equallogic. Since I don’t use this drive in a Dell Server but in my Apple Mac Pro the only possible way to do this is to use Linux and hdparm.

Then I found this:

The correct firmware for my drive is Muskie/KA09.fwh

The only question is how many bytes I have to remove from the Dell header to able to flash it with hdparm ?

Files for comparision:

Create NFS Datastore for ESX in WIndows Server 2008 R2

comments Comments Off on Create NFS Datastore for ESX in WIndows Server 2008 R2
By , September 17, 2012 2:22 PM

Create NFS Datastore for ESX in WIndows Server 2008 R2

Here, I am going to explain step by step procedure to configure NFS share in windows 2008 R2 to use with ESX data storeAdding NFS Share Role in Windows

Choose Start -> Administrative Tools -> Server Manager
I have already File services installed on my windows server with default options. So, Go to file services role and click on add Role services and select “services for network file system”

Click on Install

Create a folder called “nfstest”. Right click the folder and click on properties

Click on the “NFS sharing” tab and click on “Manage NFS Sharing”

Select the check mark  “Share this folder” and remove the check mark Kerberos V5 integrity and authentication  & Kerberos V5 authentication.

Select the Allow anonymous access and click on Permissions tab

In Type of Access , choose “Read-Write” and check mark the Allow Root access and apply ok.

Adding  the NFS datastore to ESX\ESXi host

Make sure you have vmkernel port is configured in your ESX/ESXi host.

Goto Configuration Tab and select Storage. Click on Add storage.

Select Network File system.

Enter the Fully qualified domain name of the server or IP address, share name and Datastore name. Click on Next.

NFS datastore named “NFS DATASTORE” is created.

NFS datastore is created and we are ready to go.Thanks For Reading!!!!

Vmware ESX NFS datastore on Windows Server 2008

comments Comments Off on Vmware ESX NFS datastore on Windows Server 2008
By , September 17, 2012 2:20 PM

Vmware ESX NFS datastore on Windows Server 2008

So if this is the need for slow file transfers, you can do it that way:

1. Install Services for Network File System (NFS)
Server Manager – Add Roles – File Services – Services for Network File System

2. Edit Local policy(or GPO) to Everyone permissions apply to anonymous users
Administrative tools – Local Security Policy – Local Policies – Security Options – Network Access: Let Everyone permissions apply to anonymous users – Enabled
GPO – Computer Configuration – Policies – Windows Settings – Security Settings – Local Policies – Security Options – Network Access – Network Access: Let Everyone permissions apply to anonymous users – Enabled

3. set NFS to TCP only
Administrative tools – Services for Network File System (NFS) – Server for NFS Properties – Transport protocol to TCP only (default is TCP+UDP)
Reboot server!

4. Create Share and set IP access
Open Folder Properties – NFS Sharing – Manage NFS Sharing – select Share this folder – select Allow anonymous access – set Anonymous UID and Anonymous GID to 0 – Permissions – Add VMKernel IP to Add names, leave read-write, select Allow root access – ok – ok – ok – ok

5. Set datastore on esx server
Go to service console and type: esxcfg-nas -a -o (Windows 2008 IP) -s /(sharename) (datastore_name)

… and now can cpoy ISO images and backup files betwen esx and windows. For virtual machine running you beter to buy dedicated NAS or SAN system.

Thomas Challenger Thomas Challenger