XenServer \ XCP-ng: How to Create a Virtual Disk Larger than 2tb

So recently I ran into an issue where I needed to create a virtual disk 20TB in size. Unfortunately, XCP-ng does not allow doing this through its manager because it uses an older disk system. However, you can manually create an LVM partition and map it to the VM. Here is what you need to do:

 

Grab your SR UUID from the management console. The UUID I will be using for example commands is f8f32ef5-81d7-9154-d0f2-b92559b8ecbc. You will need to replace it with your UUID.

 

Now we need to get the volume group device name:

vgs | awk '{print $1}' | grep f8f32ef5-81d7-9154-d0f2-b92559b8ecbc

 

Now we create the volume. Make to change the “20T” to your desired size in TB:

lvcreate -L20T -n"LV-"$(uuidgen) VG_XenStorage-f8f32ef5-81d7-9154-d0f2-b92559b8ecbc --config global{metadata_read_only=0}

 

Finally, scan the SR and you should see a no name virtual disk.

xe sr-scan uuid=f8f32ef5-81d7-9154-d0f2-b92559b8ecbc

 

Now you can attach the created disk to your VM. Just make sure to change the name in the management center.

 

There might be a way to thin provision it, but I don’t know how to do that. If you have found a way to do so, please comment down below.

 

About: Ryan Parker

I'm a former captain of the Cyber Defense team, Current Infrastructure Security Specialist. I also have a side job helping small to medium business with anything technology doing everything imaginable. One of my hobbies is building out infrastructures for myself, friends, and clients. I current maintain a homelab with about 2TB of RAM, 180+ TB of storage, tons of CPU cores, and 100gbit networking backbone.


13 thoughts on “XenServer \ XCP-ng: How to Create a Virtual Disk Larger than 2tb”

  1. How do you do this on a NFS Volume Group? The “vgs” command only shows my local storage volumes not NFS mounted ones.

  2. Could you provide more info about what you did. You created a new logical volume in LVM on host/dom0.
    How does this help to override a 2TB virtual disk limit? How did you attach this 20TB disk to a VM? Thanks

    1. Id imagine it will not work because it was essentially making a lvm volume. Id really only recommend this for a single host deployment, and honestly would not even really recommend it, I needed it for a one off

  3. It’s been a few years, but does this work in a pool with iSCSI storage? For instance, if you do this on host A, can the VM be live-migrated to host B or C, assuming the SR is accessible to all the hosts?

  4. I was able to create in LVM (thick provisioning worked but I failed with ext – thin provisioning), so thanks for the guide! This was a dry run before we get a new server with a lot of storage, so now I know not to create the new one as ext, which I like to do to save on space.

    One question is that I’m unable to rename it in XCP-Center 20.04.01 as it gets stuck at the “Size and Location” portion and won’t save the new name. I have a feeling this will cause problems during backups. Is there a workaround?

    1. I would not count on any GUI utility working for this… Since its a bit of a hack its unlikely it will be supported in xcpng’s graphical utilities. As for backups id bet they would not work either.

      1. Do you know of a CLI command to rename/add a description to the virtual disk? I’ve been hunting around with no luck.

        As far as backups, you’re right – I tried to back up my dummy VM to a Synology NAS and it got a “Not enough space” error (there was enough space). My guess is that the Synology didn’t allow the creation of a 2TB+ file.

        1. Sorry I dont actively use xcp-ng these days though I might when the UI gets improved in the next version… Good luck on your hunt though.

Leave a Reply

Your email address will not be published. Required fields are marked *