How do I create a USB Storage Repository in XenServer
June 4, 2009 | by Steven Warren | Blog
Identify the device
- There are several ways to determine a USB device name. I found tail to be the most efficient and fun means to determine the device name. “tail –f /var/log/messages”. This will show you the last ten log messages and stay open to show you additional messages real-time.
- Plug in your USB HDD and watch the messages fly by. Your device name should show up somewhere in the messages. “Ctrl-C” will return you to the command line. You should see something along the lines of /dev/sdb or /dev/sdc
Format the device
- Enter “fdisk /dev/<device>” where <device> is replaced by the information you obtained in Step 2 above. You should be placed in the Fdisk command line with a prompt of “Command (m for help):”
- Enter “p” to see the partition table of the drive. The first line of output will also tell you the size of the drive. Double-check your size to verify that you are working on the correct drive.
- If there are any partitions on the drive they will be listed as numbered sequences (i.e. /dev/sdb1, /dev/sdb2). To delete these partitions enter “d”. Then the number of the partition you want to delete.
- Once you have deleted all existing partitions on the drive you are ready to create a new one encompassing the entire drive space available. Enter “n” then “p” to create a primary partition. Enter “1” for the partition number. If you keep the defaults for the start and end cylinder it will use the entire drive.
- You can use the “p” command again to verify your settings. Enter “Exit” to leave the FDisk utility.
- Enter “mkfs.ext3 –m 0 –v /dev/<device partition>” where <device partition> is replaced by the partition you created in Step 6. (i.e. /dev/sdb1)
Create the Storage Repository
- Enter “xe sr-create type=lvm name-label=USBSR device-config:device=/dev/<device> shared=false content-type=user” where <device> is replaced by the information you obtained in Step 2.







