Sometimes you need to backup your VMs on a USB drive to easily carry them away or because there is not enough space on your NFS/CIFS storage. So the question is, how to mount an external NTFS USB drive on Xenserver with read/write permissions.
First of all ssh to your xenserver and type in the
fdisk -l command.
fdisk shows the disks that xenserver knows about. Notice that the device name of the usb drive is
/dev/sdc and its first partition is
/dev/sdc1. If you try to mount the device, for example let’s create a usb directory and mount the drive on it:
mount -t ntfs /dev/sdc1 /mnt/usb
The problem is that xenserver supports only read access on NTFS formatted drives. So you may read anything or restore VMs under the /mnt/usb directory, but you cannot write any file including your backups. Let’s try to import a backup file.
xe vm-import filename='/mnt/usb/myBackupFile.xva'
If your drive is ext3 formatted, you will be able to mount it in read/write mode, but it will be difficult to mount it on a windows machine. We need to install to xenserver the appropriate NTFS-3G driver to be able to have write permission as well. Ok, let’s first unmount to USB drive.
The following is a summary of information from various pages regarding the installation of NTFS-3G drivers on xenserver and I successfully installed it on a xenserver 6.2.
Install DAG’s GPG key
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Verify the package
rpm -K rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm
Disable it by changing the following flag:
enabled = 1 to
enabled = 0 in the following file
Install the library/driver
yum --enablerepo=rpmforge --enablerepo=base install fuse-sshfs
yum --enablerepo=rpmforge install ntfs-3g
Finally mount the USB drive
mount -t ntfs-3g /dev/sdc1 /mnt/usb
Now the usb drive is NTFS writeable. Don’t forget to unmount the drive by issuing the umount command