• View Communities
    • Citrix Developer Network
      The place for unfiltered straight talk on Citrix products. Blogs, code downloads, best practices, APIs, and more can all be found here.
    • Citrix Ready Community Verified
      Does it work with Citrix? Application compatibility questions are a thing of the past with the new Citrix Community Verified site.
    • Blogs
      Learn the latest from the Citrix employees who are building application delivery infrastructure technologies.
    • Blogosphere
      The Citrix Blogosphere is a window into the thousands of conversations taking place about Citrix and Application Delivery.
  •  Sign In
The Citrix Blog
Personal Blog
Olivier Withoff
Related Tags
posted by Olivier Withoff

Since your XenServer machine is Linux-based, there are some challenges in getting/putting data from/to a removable USB device. The lab I work in is isolated from our corporate network, so I've come up with four handy solutions that I'd like to share here over the coming weeks:

  • Accessing an NTFS USB drive in XenServer
  • Formatting a USB drive exclusively for XenServer
  • Accessing CIFS shares in XenServer
  • OpenFiler virtual machine, and getting data inside it for sharing

First off: Once you've plugged a USB drive into you XenServer machine, how do you access the data therein? The first thing to do is logon to the Control Domain, usually through XenCenter, and type the command:

fdisk -l
 
 

Notice that the fdisk command shows the disks that XenServer knows about. I've highlighted here (in red) an NTFS USB drive that I've plugged into the XenServer. Notice also that the device name is /dev/sdc, and that the first partition on that device has itself a device name of /dev/sdc1. In this example, the local disk on which I've installed XenServer is /dev/sda, which has three partitions (shown first in the listing).

Accessing an NTFS USB drive in XenServer

Here I've plugged in an NTFS USB drive, and I've established that XenServer (Linux) knows the first partition by the name /dev/sdc1.  Since this is a disk device, we need to "mount" it into the Linux filesystem. In this way, it will become a part of the filesystem hierarchy. The only thing I need is an empty directory to mount "over". Most Linux distributions come with an empty /mnt directory for just this purpose:

mount /dev/sdc1 /mnt

Note that the target directory of your mount has to exist, and any files that existed in that directory will be "hidden" until you un-mount the device (see later for un-mounting). There's nothing special about the directory you mount over - it's a regular directory. What I usually end up doing is creating another directory inside of /mnt to mount my disk over. That way I can have many "mount points" if I want to transfer data between them.

The big drawback with mounting an NTFS drive is that it's supported in read-only mode only. This isn't usually a problem with software like NTFS-3G being available, but Citrix doesn't support the installation of any software inside of the XenServer Control Domain.

But at least now I can use regular Linux commands to copy data from the drive, for example you could import an already backed-up VM straight from the drive, using something like:

xe vm-import filename='/mnt/backups/Windows XP.xva'

This assumes that there was an existing folder in the root of the mounted partition called backups.

Before unplugging the USB drive, you'll need to "un-mount" the drive, making sure that your current working directory is not somewhere down the /mnt path (or wherever you've mounted the device):

cd /
umount /mnt

Now you can safely unplug the USB drive from the XenServer machine.

Make sure you stop by for part 2 next week!

Labels

xenserver usb disk drive xenserver_usb_disk_drive Delete
lang-eng lang-eng Delete
nonspecific nonspecific Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jun 13

    Kevin Bacon says:

    Note that this no longer works in XenServer 5.5.

    Note that this no longer works in XenServer 5.5.

    1. Jul 22

      Anonymous says:

      I have just tried it with Xenserver 5.5 and it works fine !

      I have just tried it with Xenserver 5.5 and it works fine !

    2. Jul 22

      Anonymous says:

      I have just tried it with Xenserver 5.5 and it works fine !

      I have just tried it with Xenserver 5.5 and it works fine !

  2. Aug 10

    Anonymous says:

    working for me...boom! roasted!

    working for me...boom! roasted!

  3. Aug 11

    Anonymous says:

    This no longer works in XenServer 5.5. [root@xenserver iso_import]# mou...

    This no longer works in XenServer 5.5.

    [root@xenserver iso_import]# mount /dev/sda1 /mnt
    mount: unknown filesystem type 'ntfs'

    1. Sep 21

      Anonymous says:

      Hey. Did you find how to mount the ntfs usb flashdrive? When I try I always get...

      Hey. Did you find how to mount the ntfs usb flashdrive?

      When I try I always get the error: mount: unknown filesystem type 'ntfs'

      But I can't believe that XenServer can not supports NTFS.

      1. Sep 22

        Anonymous says:

        Confirmed, 5.5 no comes with NTFS support, piece of crap!!! ls /lib...

        Confirmed, 5.5 no comes with NTFS support, piece of crap!!!

        ls /lib/modules/2.6.18-128.1.6.el5.xs5.5.0.496.1012xen/kernel/fs/
        9p       binfmt_aout.ko  efs       gfs2     lockd       nls          squashfs
        adfs     binfmt_misc.ko  exportfs  hfs      minix       qnx4         sysv
        affs     cachefiles      ext3      hfsplus  msdos       quota_v1.ko  udf
        autofs   cifs            fat       hpfs     ncpfs       quota_v2.ko  ufs
        autofs4  coda            freevxfs  isofs    nfs         reiserfs     vfat
        befs     configfs        fscache   jbd      nfs_common  romfs        xfs
        bfs      cramfs          fuse      jfs      nfsd        smbfs

  4. Oct 13

    Anonymous says:

    I have ubuntu 8.04 server edition installed as a guest system and would like to ...

    I have ubuntu 8.04 server edition installed as a guest system and would like to mount a usb drive to the ubuntu guest operating system. could anyone hint me how to do it? thank you!!

    1. Oct 17

      Olivier Withoff says:

      Using XenCenter, under the Storage tab of the Ubuntu VM, the USB drive should be...

      Using XenCenter, under the Storage tab of the Ubuntu VM, the USB drive should be visible as an attachable drive. Once attached you should be able to use "fdisk -l" at the CLI in the VM to find what the device name is, then mount that device over a suitable mount point. Best regards, Olivier.

  5. Oct 17

    Anonymous says:

    Hi - Can someone please confirm that mounting an NTFS USB drive directly to Xen...

    Hi -

    Can someone please confirm that mounting an NTFS USB drive directly to XenServer 5.5 is supported?  Given the date of this posting (25 Feb, 2009), seems like it should work.  Thanks in advance!

    1. Oct 17

      Olivier Withoff says:

      Mounting NTFS disks is no longer supported since 5.5, apparently in an effort to...

      Mounting NTFS disks is no longer supported since 5.5, apparently in an effort to reduce the footprint of Dom0 (5.5 was released in spring of 2009). The only way I've found to solve this is to (effectively) plug the USB drive into a Windows VM. A USB drive plugged into the XenServer host will appear as a drive that you can attach using the Storage tab of the VM being used. This can then be used in the normal way as a removable drive in Windows (XP is easier, W2K3 seems to require a visit to the Disk Manager). Best regards, Olivier.

      1. Oct 17

        Chris Klann says:

        Hi Oliver - Thanks for the response - great approach.  If I attach the NTF...

        Hi Oliver -

        Thanks for the response - great approach.  If I attach the NTFS USB drive to a Windows VM, can I then copy it to a new VM as a bootable image?  If so, what's a good way to accomplish?

        Thanks in advance

        - Chris

        1. Oct 19

          Olivier Withoff says:

          Hello Chris, I'm not sure what it is you're copying, but my approach is to have ...

          Hello Chris,
          I'm not sure what it is you're copying, but my approach is to have a 1TB Buffalo network storage unit that I carve up into CIFS shares. That way I can copy whatever I need to it, from my USB drive (using an XP VM). CIFS is still supported using the usual CLI "mount" commands (in fact internally that's how we're able to use CIFS ISO stores).
          Cheers, Olivier.

  6. Oct 18

    Anonymous says:

    I just had a "duh" moment, and used FTP to get the files from the Windows VM to ...

    I just had a "duh" moment, and used FTP to get the files from the Windows VM to dom0.  Thanks again for the insights.

    - Chris

Add Comment