Archy.net Blog

21.05 200988

Adding local storage to XenServer 5.x


Updated post HERE : XenServer 5.6 FP1 add local drive to backup VMs with OpenFiler

BE AWARE !! To follow instructions in this blog post you have to know linux shell and XenServer command line usage. You can wipe data if you don’t understand what you’re trying to do. Try in a TEST environment before making any change in production.

A Citrix KB is available here : http://support.citrix.com/article/CTX121313

Today I had to add two 500Gb SATAu hard drive to my XenServer. Plug this two hot plug drive in this Dell 2950 III was the easy part, configure the new RAID1 in the Perc 6i controller wasn’t so easy… This bios is very annoying and after 2 hours we found the good menu and where to create the new volume…

Once this step done, and after 16Gb of memory more, XenServer started without any problem, the drive wasn’t available through the XenCenter so I though I had to mount it or something like that.

So here comes the few steps to add a local storage to your XenServer 5.5 :

Type : fdisk -l

you’ll see the list of all volumes and hard drives, then :

Type : pvcreate /dev/sdb

sdb is my new volume

and then to configure it as a local storage :

Type : xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/scsi-SATA_ST3320620AS_5QF7QZZL name-label=”LOCAL SR”

scsi-SATA_ST3320620AS_5QF7QZZL is the name of my volume, you’ll have to change this value with your own, and name-label is the name you want to give to your local storage.

and this is it !

Remark : If your XenServer is a pool, you need to put it off, follow above steps and put back the XenServer in your pool.


88 Comments for "Adding local storage to XenServer 5.x"

  1. Pingback: Cloning a Xen Server?

  2. Stephane THIRION February 11, 2010

    thx Schtebo ! :)

  3. Anand kumar March 2, 2010

    Thanks. :-)

  4. ac4000 March 31, 2010

    Thanks.

  5. Jay April 27, 2010

    I have a 4 disk configured in raid 5 (hardware raid). How can I know the volume name (scsi-SATA_ST3320620AS_5QF7QZZL in your article)?

    I’m reading XE command manual now, but still can’t find the right command to use.

  6. Jay April 27, 2010

    I just saw “Older comments” link and say “dooh!”

    I found my raid drive at /dev/cciss/c0d0

    Thanks, great tutorial!

  7. jairus May 18, 2010

    hi,Stephane. i need your help so much and it confused me almost two days.

    I have another harddisk with raid 1 to add to the xenserver.after pvcreate /dev/sdb, it couldn’t be sr-created sucessfully

    [root@xenserver-dxvoqzrt ~]# ll /dev/disk/by-id/
    lrwxrwxrwx 1 root root 9 May 18 19:10 scsi-3600508e00000000075badb6461956405 -> ../../sdb

    [root@xenserver-dxvoqzrt ~]# xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/scsi-3600508e00000000075badb6461956405 name-label=’LOCAL SR’
    Error code: SR_BACKEND_FAILURE_19
    Error parameters: , No such device [opterr=Device /dev/disk/by-id/scsi-3600508e00000000075badb6461956405 does not exist],

  8. Stephane THIRION May 18, 2010

    Hi Jairus,

    What is you raid controller ? I bet XenServer doesn’t see your raid configuration because no drivers are associated.

    Regards,

  9. jairus May 19, 2010

    Thanks for your reply. The drive is avariable. My server is Dell R410

    [root@xenserver-dxvoqzrt ~]# fdisk -l /dev/sdb

    Disk /dev/sdb: 146.1 GB, 146163105792 bytes
    255 heads, 63 sectors/track, 17769 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Disk /dev/sdb doesn’t contain a valid partition table

  10. Stephane THIRION May 19, 2010

    Jairus :
    try this command and past the output here :
    sg_map -x
    and
    pvs
    then
    vgs

    Cya

  11. jairus May 19, 2010

    [root@xenserver-hhmkdkmr ~]# sg_map -x
    /dev/sg0 0 0 0 0 0
    /dev/sg1 0 0 1 0 0
    /dev/sg2 0 0 2 0 0
    /dev/sg3 0 0 3 0 0
    /dev/sg4 0 1 0 0 0 /dev/sda
    /dev/sg5 0 1 2 0 0 /dev/sdb
    /dev/sg6 3 0 0 0 5 /dev/scd0
    [root@xenserver-hhmkdkmr ~]# pvs
    PV VG Fmt Attr PSize PFree
    /dev/sda3 VG_XenStorage-e5a7dd4b-7679-f14b-dc04-f4f6d85971c3 lvm2 a- 128.46G 128.46G
    /dev/sdb lvm2 — 136.12G 136.12G
    [root@xenserver-hhmkdkmr ~]# vgs
    VG #PV #LV #SN Attr VSize VFree
    VG_XenStorage-e5a7dd4b-7679-f14b-dc04-f4f6d85971c3 1 1 0 wz–n- 128.46G 128.46G

  12. Stephane THIRION May 19, 2010

    Ok,
    I think your XenServer is in a pool, remove it from tehre, add your storage and put your XenServer back in the pool.

  13. jairus May 20, 2010

    stephane,thank you so much,it works! You are great.

  14. Stephane THIRION May 20, 2010

    Good !

    Cheers

  15. Manuel June 8, 2010

    Dear Stephane,
    i have one problem:
    I want to add a SSD with following command:

    xe sr-create type=lvm content-type=user device-config:device=dev/disk/by-uuid/ohnuu0-4eP3-pj0j-JXs0-xhzf-aDMu-x19pw6 name-label=”SSD”

    But then I get the error

    Error code: SR_BACKEND_FAILURE_91
    Error parameters: , The device is not a valid path [opterr=path is dev/disk/by-uuid/ohnuu0-4eP3-pj0j-JXs0-xhzf-aDMu-x19pw6],

    how can i fix it?
    Hope to hear you soon

    Regards
    Manuel

  16. Manuel June 8, 2010

    Because of the missing edit-function:
    XenServer 5.6, Console running via XenCenter 5.6
    30GB Memory
    4x 147 GB SAS HardDrives (RAID5)
    1x 32 GB SSD (want to add to the local storage)

  17. Stephane THIRION June 8, 2010

    Hi Manuel,

    Did you try the commands mention just before you post ?
    past the output here :
    sg_map -x
    and
    pvs
    then
    vgs

  18. Silvan July 23, 2010

    Hi,

    Thanks for this useful post.
    This post works for Citrix XenCenter 5.6 too.

    Regards
    Silvan

  19. Socrates August 19, 2010

    Note, you need not remove the host from the pool if you use host-uuid in your sr-create command:

    xe sr-create host-uuid= type=lvm content-type=user device-config:device= name-label=”Local storage”

    P.S. Using /dev/disk/by-id/ failed, while using /dev/disk/by-path/ worked in my case.

  20. Socrates August 19, 2010

    Add: some chars got stripped in my comment, host-uuid needs the uuid, and device needs the device ofcourse

  21. Klodovik October 30, 2010

    Hi,
    i have similar problem but i wasn’t able to find a solutions, maybe you could help me.

    I have few XenServers in resource pool and two iscsi storages with multipath attached on all servers. iSCSI is started and from Linux/XenServer point of view it can see both LUNs from both storages. I want to add both LUNs into one LVM VG and I want to tell XenServer when creates LV put Logical extents on both phisical volumes (I want to tune lvcreate options).

    all the time all servers has to stay in the resource pool and they all has to see new LVM file storage

    Do You know how to do this?
    Also, do you have an idea how to tune lvcreate options for VM storage creation?

    Kind regards,
    Klodovik

  22. Stephane THIRION October 31, 2010

    Hi Klodovik,

    I could say I have a solution, but I cannot test this issue in my lab.

    Maybe someone else will be able to bring some help. Did you try Citrix forums ?

    Cheers,

    Stephane

  23. Klodovik October 31, 2010

    Hi!

    Yes, I tried citrix forum as well but no one replied.

    Can you share ideas, I will test them on system directly, it is not in production yet so I can experiment, and I will give you feedback.

    Kind regards,
    Klodovik

  24. chris April 8, 2011

    if i have sda3 available, how to make it into two drive and store one as iso, another as local storage?

  25. Pingback: Luiz (fl0cker) Blog » Adicionando um novo disco ao XenServer

  26. Matt July 27, 2011

    I would not follow this procedure. The statement regarding pool and needing to leave and rejoin is not accurate, and the pvcreate command is not required.

    http://support.citrix.com/article/CTX121313

    I followed this process over 10 times, without a glitch… I went looking for the KB via google because it is easier, but this page came up first.

  27. Stephane Thirion July 27, 2011

    Hi Matt,

    You’re totally right, you MUST prefer official KB from Citrix than the one I made.

    BUT, if you’re looking date, this blog have been written in May 2009 and Citrix KB have been created On: Jul 28, 2009 and updated On: Jul 20, 2010

    So when I wrote that it was valid and it worked well as you might read along all the comments here.

    But you’re right, you must follow Citrix KB prior this blog :)

    Thanks to point this out, I modify the blog by adding this link

    Cheers,

    Stephane

  28. M.J November 7, 2011

    Hello,

    first of all thank you for the useful guide, please i need your help on this i’m new to using xen and linux.

    what i’m trying here is that i want to add a new hard disk to my server which is running xen as a hypervisor it has 3 virtual machines one of them is the domain controller, what i’m worried about here is that after the upgrade will the virtual machines bs able to start normally (i’m sorry if i’m being totally ignorant )

    i would really appreciate you help i’m really new to this and afraid that if i did the upgrade i would lose data and i can’t afford this to happen..

    again appreciate your help

  29. Stephane Thirion November 7, 2011

    Hi MJ,

    I would say if you really want to be sure to not lose your existing VMs, you need to back it up. You can do it through XenCenter.

    Cheers,

    Stephane

  30. M.J November 8, 2011

    Hi again,

    thank you for helping me out.

    i need to ask you one more thing if i shut down all the virtual machines properly then shut down the xenserver, upgraded the hard disks then started the physical server went to the xsconsole and from disks and storage repositories tried to configure the new harddisk will that work and what will happen to the old virtual machines (i read something about the uuid for each virtual machine do i need to change those), i’m worried here because previously i upgraded the RAMs and after i rebooted the xenserver the domain controller did not function and we couldn’t find anything wrong with it and we had to revert to a snapshot and that’s what is making me really worried here

    again sorry i’m being totally ignorant here but as i told you before i’m new to the administration world

    thank you again i truly appreciate your help

  31. Stephane Thirion November 19, 2011

    Don’t worry about asking questions, community and exchange is the main purpose of this blog.
    Before doing anything, you need to BACKUP you VMs, and before everything, you need to try to restore one to make everything works properly.
    Then you can proceed to your new hard drive/disk integration.

    Cheers,

    Stephane

  32. Roel Niesen December 28, 2011

    Hi,

    If you add a SR local to a server that is a member of a pool, you must add the host-uuid when you excecute the xe sr-create command.
    xe hsot-info gives you the relation machine name and uuid.

    This was the solution for me.

  33. Stephane Thirion December 28, 2011

    Hi Roel,

    Thanks for the tip !

    Cheers,

    Stephane

  34. M.J March 1, 2012

    Hi I know that this is unrelated to this post but can you please tell me if there is a way to connect to a virtual machine to Citrix from the physical box

    I am unable to connect to the virtual machine because of a network issue and the DC and DNS are VMs on the machine is there a way to connect to it other than xencenter as i need to troubleshoot what is the issue

    I would truly appreciate your help

    Thank you

  35. Stephane Thirion March 1, 2012

    Hi MJ,

    I don’t really understand what you mean by connecting the VM in another way than with XenCenter.
    If you have network issue, the only way you can access your VM is through XenCenter to open the console and check what’s wrong withing Windows.
    You don’t need DNS and AD to connection with XenCenter on your XenServer, you just need a computer with XenCenter, then you can connect to your XenServer using its IP address and you can check whatever what’s wrong.
    If you have network issue on your XenServer, there is no other way to troubleshot than to log into the console of the box.

    I hope it answers some of your questions

    Stephane

  36. GICOS March 7, 2012

    Hi I got this code, help me pls to initealize a local Storage

  37. John March 14, 2012

    Thanks for the post Stephane – I tried this on my XS602 install with 3 drives installed. pvcreate doesn’t seem to work, I get the message: Disk /dev/sdb doesn’t contain a valid partition table
    [root@xenserver2 ~]# pvcreate /dev/sdc
    Can’t initialize physical volume “/dev/sdc” of volume group “XSLocalEXT-29890e16-ae87-bf5e-56e3-176f5befea8e” without -ff

    This happens with each blank volume I want to use /dev/sdc and /dev/sdb

    Thoughts?

  38. Stephane Thirion March 14, 2012

    Hi John,

    You should use fdisk to prepare your drives, something like :
    # fdisk /dev/sdb
    a (for add)
    1 (partition number)
    then let it cover the entire disk, simply accept default start & end.
    w (write and exit)

    Let me know if it works, I didn’t tested this blog with XenServer 6.x

    Stephane

Leave a Comment

If you liked our post and you want to share your thought with us dont hesitate to leave a commnet, the mail will not be published.

Paris

02:00

New York

20:00