I have a XenServer 6.2 host which will run a non-migratable VM for a file server.
It is non-migratable because th bulk of its data will live on the hard drives that are in this node. About 10.5 TB.
The Citrix documentation says that each PV Virtual Machine can have up to 16 virtual disks attached. However, when I tried to add more than 6 (1 for the VM, 5 for the data) using XenCenter, I get:
You have reached the maximum number of virtual disks allowed for this virtual machine.
...which may be because I am running free and unsupported.
Supposedly I can create a virtual disk and attach it to a virtual machine using the XE command line, but finding a simple example was time consuming. The documentation and blog examples were spread out and didn't just tell me how to do it. So... HERE:
Get some info.
From the console of the host I'd like to work with, get the UUID of the local Storage Repository (SR): xe sr-list
[root@node-x ~]# xe sr-list name-label="Local storage"
uuid ( RO) : a384983-1e83-f937-.......... <---- copy this uuid for the SR
name-label ( RW) : Local storage
name-description ( RW) :
host ( RO) : hostname.example.com
type ( RO) : lvm
content-type ( RO) : user
Get the UUID of the VM you want to attach the disk to: xe vm-list
[root@node-x ~]# xe vm-list name-label=[whatever name-label you gave the vm]
uuid ( RO) : 6c5b2133-fb91-a6......... <---- copy this uuid for the VM
name-label ( RW) : vmname
power-state ( RO) : running
Create the Virtual Disk (VDI) xe vdi-create
[root@node-x ~]# xe vdi-create sr-uuid=[the uuid of the sr you copied above] \
name-label=[whatever you want to call the VDI. Quotes if spaces.] \
type=user virtual-size=536870912000 <---- this was about 500GB
5a210b22-459e-5a71-2c6b398e93a7 <----- it returns uuid of the VDI, copy this
Create the Virtual Block Device (VBD) that the connects the VDI to the VM. xe vbd-create
In XenCenter, you can see the last "Position" I got on virtual disks was 6. So when I add this next block device, I will put it at position 7. In the vbd-create, device=[x] is that "position".
[root@node-x ~]# xe vbd-create vm-uuid=[uid of the vm copied above] device=[next position] \
vdi-uuid=[uid of vdi copied above] bootable=false mode=RW type=Disk
174ca333-36c5-916a-4be3153b01e <---- it returns uuid of the VBD. copy this.
Plug the VBD into the VM. aka "Activate". xe vbd-plug
At this point, the new disk will show up in XenCenter, but "Active" will say "No" and the Activate button will be available. You should be able to activate just fine here. This actually runs the xe vbd-plug command. You could run this command manually too.
[root@node-x ~]# xe vbd-plug uuid=[the uid of vbd copied above]
[root@node-x ~]# <-- doesn't return anything, just back to shell prompt.
Going back to XenCenter, you can see the virtual disk is now Active : Yes.
* Supposedly you can do the same thing to create virtual disks larger than 2TB, but I haven't tried it yet.
Actually, you can NOT create virtual disks larger than 2TB using this method. I got this error:
Error code: SR_BACKEND_FAILURE_79
Error parameters: , VDI Invalid size .... size cannot exceed 2093051 MB ...
But you may be able to manually create the LVM logical volumes and xe vdi-introduce them or something.
So to summarize, if XenCenter tells you " you have reached the maximum number of virtual disks", you might be able to manually create the VDIs, put the VDI in a VBD, and plug the VBD in from the XE CLI. Good luck, please let me know how it went.
If this was at least a little helpful, how about a +1, Like, or Tweet?