Adding Local Storage to XenServer 6.2 Post-Installation

If you’re like me and needed to add an extra disk (local disk) to the XenServer host, then you’ve probably realized that it’s not as simple as just adding the disk and re-scanning for storage. In fact, we have to make some modifications in the Xen Shell in order to add the extra disk.

Within the virtual machine (Nested XenServer host) we can easily add another disk by opening the settings of the virtual machine and adding another disk

xen-stor-ldAs you can see in the image above, I’ve decided to add a 100GB disk to the virtual machine. I then went a head and rebooted the virtual machine and quickly realized that the local disk was not added to the XenServer yet. It did however get detected by the XenServer host by running fdisk -l within the shell

xen-stor-ld1

xen-stor-ld2Since we now see the newly added disk, we need to create a new physical volume by running pvcreate /dev/sdb. (dev/sdb is how the disk is labled on my end, for you it could be different so please make the necessary adjustments.)

xen-stor-ld3

We now need to create a storage repository before it is presented to the XenServer for usage. We will need to run the following command, xe sr-create type=lvm content-type=user device-config:device=/dev/sdb name-label=LD2 (again, make sure to replace /dev/sdb with your info)

xen-stor-ld4Now when we go back to the host, we should see a new local disk called LD2 created on the XenServer host without the need to reboot

xen-stor-ld5

Andrey Pogosyan

Andrey Pogosyan is a Virtualization Architect who’s focus is on infrastructure virtualization involving mainly VMware and Citrix products. Having worked in the IT industry for 10+ years, Andrey has had the opportunity to fulfill many different roles ranging from Desktop Support and all the way up to Architecture and Implementation. Most recently, Andrey has taken a great interest in the datacenter technology stack encompassing Virtualization, mainly VMware vSphere\View, Citrix XenApp\XenDesktop and Storage (EMC, HP, NetApp).

19 Responses

  1. Techstur says:

    Excellent post with brief description.I’ve forgot to replace the /dev/sdb, and the result is that I’m unable to add extra space to the XenServer6.2. Please help.

    • Andrey says:

      Thanks!

      Have you tried rebooting XenServer and re-doing the whole process again? if that doesn’t work, if it’s a VM, you can delete the newly created disk and re-add it.

  2. Erik says:

    Wow. Thanks! I was pulling my hair why that nice 640GB disk was sitting there useless. Bookmarked your site.

  3. Jason says:

    Thanks for the concise instructions, it’s surprising this isn’t available through the GUI even in 6.2!

  4. ReyRey says:

    great stuff.. but onething though…will the data on the physical disk that you add via the shell command be wiped? does it initialize/reformat the newly added disk?

    • Andrey says:

      Thanks!

      I personally haven’t tested this, but since it’s going to create a new volume, the data on the disk would be deleted so I would recommend to backup everything before doing this procedure.

  5. Santanu Lahiri says:

    Great article. I had the HD for the local storage go bad on me and needed to replace it. Got me a 4TB Seagate for comparatively cheap, put it in, followed the directions, and had the system back up and running in short order.

    One thing I noticed though, lack of knowledge on my part, not in the directions. A 4TB drive is not compatible with the first command, the fdisk -l. It gave an error about /dev/sdb not having a valid partition table. I am not familiar with GNU Parted, so could not use that as instructed. However, the rest of the instructions starting with pvcreate worked just fine and added the disk properly. Here is to hoping I did not miss anything…

    • Andrey says:

      Good stuff and you’re correct, anything over 2TB (4TB in your case) would not work with fdisk utility. As you mentioned, GPT Parted would be a tool that will allow you to create partitions larger than 2TB using GPT partition tables.

  6. Edwin says:

    Thank you for making this instruction. Works like a charm. Just what i was looking for and worked for me (with no linux knowledge)

  7. iguimar says:

    I have two disk as storage in a machine. I want to add two disk at this storage, making them all as only one to the host. I used pvcreate to create the virtual disk but when I use xe sr-create type=lvm content-type=user device-config:device=/dev/sdb name-label=LD command didn´t work because it tell thereis no device, if a put sdb, sdc disks it creates the storage, but not a storage with the two but one by one disk. So how can I make this to disk be seen as only one and joining the previous storage that was in the machine and the host see them as only one storage?
    Thanks

    • If I understand this correctly, you want to combine your two disks in to one volume for XenServer? so if for example you have two disks that are 250GB each, you want to have one volume that is 500GB?

      • iguimar says:

        Yes, that´s is correctly. I want to add two disk in a computer, make them a volume as only one that could be see by xenserver.

  8. Erik says:

    Perfect. Thanks!

  9. Charles Dickson says:

    Whew! Much simpler than most suggestions, it worked to get my 750gb 3ware raid mirror up and running. Thanks a million!

  10. rony says:

    im facing probs, when using pvcreat command, it is:
    [[email protected] ~]# pvcreate /dev/sdb
    Device /dev/sdb not found (or ignored by filtering).
    can any one help me?

  1. August 17, 2013

    […] recently made a post on how to add local storage to a XenServer host. However in order to take advantage of some of the feature like HA and […]

Leave a Reply