Plug-in the external USB drive to ESX Server directly to backup or copy
Sometimes you would like to use your external USB drive to backup (transfer) your VMDK files directly from your ESX Server external USB drive. VMDK files are files with extention *.VMDK and those files are virtual hard disks of your virtual machines. You can also mount VMDK files directly into your Windows PC.
When you plug-in external USB drive to ESX host you need to enter some commands at the console. For those of you who don’t really know linux, there is some commands to remember. But they are not many…. -:) .
First of all you should know that not all filesystems are supported. For the supported ones there are those here:
- FAT32 read/write.
- Ext3 read/write
- NTFS read only (that means that you can’t use NTFS formated USB drives to copy your VMDK files, but you should create a partition with EXT3 or FAT32)
Now how-to copy data from Service Console to a USB device:
1. Plugin the external USB drive to your ESX host.
2. Run this command to find out to which device name the kernel assigned to it:
tail /var/log/dmesg
3. Now you will have to Run the following command to create a mount point (A mount point is a directory which a device or partition is attached to):
mkdir /mnt/usb

4. Run the following command to mount the drive ( When mounting, you must tell the mount command what is the device or partition you want to mount and what is the mount point. The mount point must be a directory that already exists on your system.:
mount /dev/[device_name] /mnt/usb -t [filesystem_type]
Please Note that you must:
* Replace [device_name] with your device name found in step 2
* Replace [filesystem_type] with vfat (FAT32) or ext3
5. After your copy(backup) you can type this command to unmount the device:
umount /dev/[device_name]
You might also want to export you VMDK files. Vmkstools is VMware ESX Server file system management tool. It is a program for creating and manipulating virtual disks, file systems, logical volumes and pyhsical storage device on the VMware ESX Server. Now what you need to do to export the VMDK (virtual disk)? You will use a command ‘vmfkstools’:
vmkfstools -i /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk /mnt/usb/[vm_name].vmdk -d 2gbsparse
And how-to import the VMDK (virtual disk):
vmkfstools -i /[path_to_USB_mount]/[vm_name].vmdk /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk
You might also want to copy the configuration files for a virtual machine. Those files are files with following extentions: *.vmx *.log *.nvram *.vmxf *.vmsd (you will not only copy the configuration files, but at the same time you will make a zip file in tar.gz format:
cd /vmfs/volumes/[datastore_name]/[vm_name]
tar -czvf [vm_name].tar.gz *.vmx *.log *.nvram *.vmxf *.vmsd
cp [vm_name].tar.gz /mnt/usb
Now you will be able to extract the configuration files of a virtual machine:
tar -xzvf [vm_name].tar.gz /vmfs/volumes/[datastore_name]/[vm_name]
Source: VMware Knowledge Base
Related Posts :
I was checking my stats for the last 3 months and I was just wondering which posts are most popu ...
Veeam backup 3.0 is available. With this new version is now possible to backup/restore ESXi serv ...
Veeam Backup and fast SCP is one of the favorite backup-copy-replication-restoration tool around ...
When you are using Acronis True Image Echo Workstation (or Server) to backup and create an imag ...
This looks like that I could upgrade my Home Lab... -:) New blog post on Chad's blog makes me r ...
Other posts from Server Virtualization
- Disable web access on VMware vCenter
- VMware ESX - Configuration of Service console via CLI
- Basic VMware ESX CLI networking commands
- How to change the default location of updates in vCenter
- Did you know that ESX 3.5 general support will end in less than 90 days?
- Starwind iSCSI HA Connection to ESX Server
- See a list of Storage Array Type Plugins on ESX Server
- New whitepaper released on PVSCSI
- Enable Jumbo Frames in ESXi 4
- How-to troubleshoot iSCSI connection to your SAN
- Starwind with ISCSI SAN Software can do High Availability for you...
- Overview Video from the new vSphere Pro video training from Train Signal
- New upgrade webpage for ESXi 4 pushes us to the right direction?
- You know how to collect diag information when your ESXi does PSOD?
- Use PVSCSI or not for lower intensive workloads
- Hardening guides for vSphere 4
- NTLDR missing - silly but can happend
- How To Shrink VMware Virtual Disk Files and disable shrinking
- vSphere Quick Start guide bonus download..
- ESXi - the past, the present and the future
- Farm commander - management tool for VI and TS or Citrix Farms
- How to collect log information from vCenter Server 4
- How to know where is my VM if vCenter is down?
- New patches for ESX 4 and ESXi 4
- Use VMware Converter to import 3rd party VMs, for example Virtual Iron's VMs
- Windows XP installation as a VM - trouble to see the disk or not?
- Vmware HCL for ESXi 4
- Time keeping for Windows VM's best practices
- Virtu-Al releasing 3rd update of PowerPack
- Not even tried Appspeed and new version is already available!



















Thanks for the great article I found it really useful
Hi, please help me!
I can´t mount the USB drive because the “device name” don´t appear when I connect a pendrive.
Look:
login as: root
root@10.10.92.21's password:
Last login: Thu Aug 13 17:37:50 2009 from 10.75.202.55
[root@UYMVDVMP02 root]# tail /var/log/dmesg
hub.c: USB hub found
hub.c: 7 ports detected
EXT3 FS 2.4-0.9.19, 19 August 2002 on cciss(104,2), internal journal
Adding Swap: 554200k swap-space (priority -1)
kjournald starting. Commit interval 5 seconds
EXT3 FS 2.4-0.9.19, 19 August 2002 on cciss(104,1), internal journal
EXT3-fs: mounted filesystem with ordered data mode.
kjournald starting. Commit interval 5 seconds
EXT3 FS 2.4-0.9.19, 19 August 2002 on cciss(104,6), internal journal
EXT3-fs: mounted filesystem with ordered data mode.
[root@UYMVDVMP02 root]#
Try using another USB drive… Each model is different..
Hello! I would NOT recommend to use an USB-disk as backup with ESX 3.5. I did that the way explained above. Everything seems to work well. But recently I wanted to restore a backuped vm to another server just as copy (what a luck!) and: The file was corrupt! I checked all backuped files with md5sum und nearly 50% of them were just shit! I blamed that on the USB-disk and tried three other disks. All the same! 30-50% of my backups were corrupt. But I had no error-messages during copy (dmesg an /var/log/message) but after checking the files: shit! I even tried other disk-vendors and even tried the backup from another esx-host (different hardware) but no luck! It also seems the bigger the file the greater the chance that it gets corrupted. Well let my clearly say: I tried different usb-disk, different usb-ports, different usb-cables, different esx-hardware at different locations. I always got that errors. Seems like the usb-driver of the esx runs out of sync with the drive and just produces garbage without realizing this. So. DO NOT BACK UP OVER USB WITHOUT CHECKING THE BACKUP-FILES
Well, it’s good to know. Me too I don’t trust those USB devices. Prefer SAN or disk to disk backups. Thanks for your experience Dennis.