The goal of the following blog is to have a cheap backup system for my XenServer @ Home. Remember snapshots are not backup and it’s not recommended to backup you VMs the way I will describe it in a production environment.
You can find a Citrix KB to add local storage here : http://support.citrix.com/article/CTX121313
The idea is to install a new hard drive in my XenServer @ Home, configure it and host an OpenFiler VM to share a NFS volume. As the NFS volume will be shared, I want to use it as a backup share to archive all my VMs snapshots with the VM Protection Policies option in Citrix XenServer 5.6 FP1. This option (VM Protection Policies) is available only with the platinum XenServer license.
So I plugged the new hard drive and plug it in my XenServer @ Home and switch on the box, then to enable and activate the drive, I needed first to check XenServer was able to see the new hard drive, i used the fdisk -l command :
[root@suomixen ~]# fdisk -l Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 523 4194304 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 523 1045 4194304 83 Linux /dev/sda3 1045 121601 968371393 8e Linux LVM Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table
My new hard drive is here, I can notice the /dev/sdb which is empty. Then I needed to create a physical volume by using the pvcreate /dev/sdb command line :
[root@suomixen ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created
Now the physical volume created I can create a logical volume by using the xe sr-create command line. Before I need to identify the ID of the new volume created with the xe pbd-list command :
[root@suomixen ~]# xe pbd-list uuid ( RO) : ea29b92e-ad26-9d80-92e1-b150d689b3aa host-uuid ( RO): cd260b4c-f311-4fae-852b-1b794bc8e276 sr-uuid ( RO): 862abbc4-b86e-bc98-c784-e24e323602c0 device-config (MRO): device: /dev/disk/by-id/scsi-SATA_ST31000340NS_9QJ2EXS0 currently-attached ( RO): true uuid ( RO) : b990f978-d89c-fa6a-b291-3d1f15245ce3 host-uuid ( RO): cd260b4c-f311-4fae-852b-1b794bc8e276 sr-uuid ( RO): 65e04d65-f30e-401d-18e3-ccf479a50bf4 device-config (MRO): location: /opt/xensource/packages/iso; legacy_mode: true currently-attached ( RO): true uuid ( RO) : 7397b1ec-d2e2-3681-51ef-a213806d9fc5 host-uuid ( RO): cd260b4c-f311-4fae-852b-1b794bc8e276 sr-uuid ( RO): fc5a979a-f6a4-7352-afab-296c149e8907 device-config (MRO): serverpath: /mnt/backup_group/backup_vms/Backup_Xen/; server: 192.168.0.98; options: currently-attached ( RO): true uuid ( RO) : ea85c804-5898-e449-342e-96f5c3dd9b44 host-uuid ( RO): cd260b4c-f311-4fae-852b-1b794bc8e276 sr-uuid ( RO): 829d7f51-0bc8-4ee9-66a4-5c8b8fc17423 device-config (MRO): username: suomi\administrator; cifspassword_secret: 4e912a17-a7c8-fb85-dff1-491460cdbf2c; SRmaster: true; type: cifs; location: //192.168.0.100/Isos currently-attached ( RO): true uuid ( RO) : 6aaa8610-ccc6-0ba9-0ed9-747128b5bd27 host-uuid ( RO): cd260b4c-f311-4fae-852b-1b794bc8e276 sr-uuid ( RO): 2b210a05-a1ff-01cd-62e7-8bf864f5e1b1 device-config (MRO): location: /dev/xapi/cd currently-attached ( RO): true uuid ( RO) : eed7d2dc-f7da-7149-28da-26a02d9f5fe7 host-uuid ( RO): cd260b4c-f311-4fae-852b-1b794bc8e276 sr-uuid ( RO): 79c6b13b-3876-64b1-e312-e97a87a9ab9e device-config (MRO): device: /dev/disk/by-id/scsi-SATA_ST31000340NS_9QJ1CRYN-part3 currently-attached ( RO): true uuid ( RO) : 5c190639-7111-6fe3-b38d-262e608b64e1 host-uuid ( RO): cd260b4c-f311-4fae-852b-1b794bc8e276 sr-uuid ( RO): 963e166b-763a-2b33-1117-e131f732542b device-config (MRO): location: /dev/xapi/block currently-attached ( RO): true
I can see my new volume, the path and its name, /dev/disk/by-id/scsi-SATA_ST31000340NS_9QJ2EXS0, the first one in the previous list. Now I can create the logical volume to make it ready to execute my backup plan idea, I use the xe sr-create command line.
[root@suomixen disk]# xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/scsi-SATA_ST31000340NS_9QJ2EXS0 name-label=LOCAL 862abbc4-b86e-bc98-c784-e24e323602c0
You need to use the command bellow but don’t forget to use your device ID, not mine, it won’t work 🙂 xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/YOURDEVICENAME name-label=MY_NEW_VOLUME_NAME and you should be just fine. The installation of the new drive is done and now we can download the OpenFiler appliance for XenServer here : http://www.openfiler.com/community/download/. Once downloaded, import the VM into XenServer and start it.
To import the Openfiler XenServer appliance you can follow the instruction or you can skip this small part if you know how to proceed.
Uncompress the archive you downloaded and in the Citrix XenCenter console do as follow :
That’s it, now you just need to wait a bit for the file to be send to the XenServer machine. Once the machine is started you will add a drive (in my case, big enough to backup the VMs snapshots 900GB)
Previous steps show you how to add a drive to your OpenFiler XenServer appliance. Don’t forget to reboot the OpenFiler. Now we can configure OpenFiler. To do so, go on the console tab in your XenCenter and check the main screen, you should find the following information :
Now you have the address to connect the we management interface, go on : https://the.ip.address:446
OpenFiler default UserName is openfiler and the default password is password. Proceed to logon and click on the system tab to configure the network regarding your own network settings:
Don’t forget to configure the network access as you can see on the previous screen shot on the bottom of the screen. Next we will configure the volumes and everything need to be setup to enable a NFS share, click on the Volumes tab and follow the next steps :
Now click on the Services tab and enable SMB / CIFS Server and NFS v3 Server :
Click now the the Shares tab to create and configure a share :
Chose a name for your share and click on Create Sub-Folder, the new folder is created so click on it :
Click on Make Share to enable the share of this new folder and continue the setup in the next window, go at the bottom of this page to find the Host Access Configuration part and change the option bellow :
Click on Update
Time to make a check point :
- The new hard drive has been install in the XenServer box
- The new hard drive has been setup and configure in XenServer
- The OpenFiler XenServer Appliance is up and running
- The OpenFiler XenServer Appliance is setup
- A new NFS share has been configured
Everything looks good so far, now the next steps are :
- Adding the NFS Share to XenServer as a New Storage
- Adding and configuring new VM Protection Policies
- Test everything
Adding the new NFS Share as a New Storage in XenServer is not mandatory to use it with VM protection Policies, I just do it to test the access and make sure everything is working well. In XenCenter proceed by following the next screen shots :
Now it’s time to configure the VM Protection Policies option, I do it all through XenCenter (I haven’t check how to script it yet…) to do so, follow the way :
And in the next screen is about the archive schedule backups :
Don’t forget to test the NFS share and click on Next
And Finish. AsI check th bow to run the job when I clicked on finish I’ve been able to see very quickly the snapshot result and everything went fine :
Of course the schedule archive backup on the NFS Share will take much more time so if you want to check if your job is still on the way, you can click on the Pool and chose the Logs tab :
This is copying, the operation is a success, it takes some time to copy the scheduled backup but it works. For example, the VM I wanted to backup for all the previous screen shot took 5 second to snapshot but 1h30 to copy. I had some issue trying to do the same with more than one VM at the same time, for an unknown reason snapshots were fine but the copy stopped. I chose to backup two VMs per night over the week and it works well. Finally, you might have notice you can copy your schedule snapshots only on a CIFS or a NFS share, nothing else for now.