This article is about the Proxmox ve backup. My intention was to document how I store backups using a local HD, restoring and scheduling backups for my Linux and Windows KVM virtual machines at the work place. I am using the powerful Proxmox Open Source Server Virtualization Platform, based on KVM and OpenVZ.
Backing up virtual machines on Proxmox VE
Not having a huge IT budget common with larger operations we had to come up with a cost-effective solution to store our virtual machine backups. The solution we decided to use was to install a pull out HD bay which we bought from Micro Center. This setup will allow us to swap the backup HD without needing to shut down the Proxmox server. Our policy is to replace the backup HD every Friday so we can take a copy offsite.
To manage the backup HD preparation and setup I am going to use the versatile Webmin web-based interface for systems administration. I am aware Proxmox developers discourage installing other software programs such as Webmin to manage the box where Promox is installed. When the time comes where I can mount or prepare a disk using entirely Promox web interface then I wouldn’t have to use Webmin. On Webmin, navigating to hardware -> partitions on local disks I found the un-formatted disk which I added using the pull out bay it is named SATA device C. The one labeled SCSI device A is where my Proxmox install resides including all the running virtual images.
I am going to add a partition on this drive by clicking the drive name SATA device C, then click, add primary partition then create.
With the primary partition created I then have to format the disk using the EXT3 filesystem. Clicking the label number 1 or Linux.
Which then takes me to this part. Clicking on create filesystem, accepting default settings starts the process. This could take a while depending on how fast the server or large the drive is.
Typing top on the command line I can verify the filesystem is being created as shown by the running mkfs.ext3 process. When Webmin completes the filesystem creation it will give out a message.
Which brings up the following information. There is only one partition on this disk /dev/sdc as shown as /dev/sdc1.
With this information I know which disk to mount using Webmin. On Webmin going to hardware -> partitions on local disks then clicking on SATA Device C, -> clicking 1 or Linux will bring up the image below. Note: If you’re planning on clustering your Proxmox host nodes, from my experience it is better to mount this backup storage location in /var/lib/vz.
On the box mount partition on I added /var/lib/vz/LOCAL-BACKUPS/PULL-OUT-HD-HP, then clicked mount partition on.
Which then takes me to the part where I can mount the partition. Do NOT use SCSI Device A, partition 1 & 2. These are used by the Proxmox OS. Clicking the drop down for disk I picked SATA Device C partition 1, then save.
The operating system is now aware a device has been mounted called on a directory called LOCAL-BACKUP.
From the Promox web interface I go to datacenter then storage tab. Clicking on add I am going to choose directory. Putting in LOCAL-BACKUP for the ID, then the directory part I put in /LOCAL-BACKUP (the name I used for the mounted device earlier) including the / otherwise it won’t add! For the content I clicked off the rest except for backups. I only want to use this storage strictly for backups. I am only keeping two copies of backups for each virtual machine. I also chose to share this directory so I can connect to it from my other Proxmox servers on the same network to use it as a backup repository. Then clicking add to make it active.
At the moment this storage space appears empty. I am going to create a backup to test this storage. I will click on the virtual machine I want to back up then the backup tab.
Clicking backup brings up the image below. The storage device I added earlier shows up. The type of backup I will do is called a snapshot. I really like this feature for it allows me to back up a running virtual machine without freezing it up. I’ll use LZO to speed up the backup. All there is left to do is click backup to start the process.
As soon as I manually start the backup the process window comes up. I can see the backup is using the device I added earlier. The virtual machine being backup has a 20 GB virtual drive assigned to it. But the actual size being used by the virtual machine is only 3.60 GB. The backup process took only three minutes to complete using consumer grade SATA Western Digital HD which we paid $99.00 for.
Now that I have confirmed Proxmox is able to use the HD I added for backups I will create a backup schedule. To do this using the Proxmox web interface I had to go to datacenter -> backup tab click add. When the schedule window opens I will click on the days I want the backup to occur for. Then clicking on the virtual machines I want to be part of this backup schedule. I also added the storage location to contain the backups. When the backups are done I want to get an email to confirmation indicating whether the backup was successful or unsuccessful. The backup scheduler allows creating multiple schedules. In case a back schedule fails the place to look for clues would be /var/log/vzdump.
Restoring a virtual machine is very easily done through Proxmox web interface by shutting down the virtual machine I am about to restore from backup. After stopping the virtual machine I will click on the backup menu tab which will now show all available backups for all the virtual machines hosted on this Proxmox server. Using the virtual machine ID I will pick the correct backup to restore from. According to Proxmox developers there will be an option to rename the backup outputs soon than relying on virtual machine IDs to find the associated backup. For this example I will click on the virtual machine ID 101 to restore. Choosing the most recent backup based on date. After clicking restore I get a window showing which virtual machine storage space to restore to. Promox stores all KVM virtual machine images in the directory /var/lib/vz/images. If I was using OpenVZ containers they will be stored instead in /var/lib/vz/private.
I only have one storage space for virtual machines not counting the storage space reserve for backups only.
Clicking restore brings up a confirmation message it will permanently delete all data. It is a good idea to double-check the virtual machine being overwritten is the correct one. Once the restore process is underway a window pops up indicating progress.
This restore took only 110 seconds using an ordinary WD 7200 rpm HD!
After testing my back up schedule and restore I want to test if I can swap out the backup hard drive with another set of back up HD using the pull-out-bay. Before un-mounting the backup HD I will first remove it from the Proxmox storage.
With that done I can now un-mount the HD by using Webmin’s web interface going to system -> disk and network file systems. Once there I will click on the local HD I have mounted for my back up storage. Clicking don’t save for the save mount option. Then clicking un-mount for the mount now option. Then clicking save will allow me to pull this HD out so I can put in my other rotational back up HD. Note of caution this HD could be very hot to the touch!
After the drive has been un-mounted it no longer shows up, only the mounted file systems used by Promox appears.
After swapping out the HD for another set. I only have to go back into the Hardware menu > Partitions on Local Disk. Clicking SATA device B > Linux > Mount Partition On > browsing to the directory I last mounted it on /var/lib/vz/LOCAL-BACKUPS/PULL-OUT-HD-HP. Click create. Proxmox will recognize the added HD for backup use.
I also like to be able to monitor the health of my backup HD. For this I have to install the tool called smartmontools.
apt-get install smartmontools
With this installed a new menu on Webmin appears under hardware called SMART drive status after refreshing the page. Clicking SMART drive status > drop down choosing SATA device B > show. I get the following output.
On the system information of Webmin it shows the current drive temperature of the local backup HD.
Being able to back up all of my virtual machines easily using Proxmox integrated backup scheduler gives me a lot of confidence using Proxmox as my virtualization platform. I also don’t have to use some other kind of third-party software to do my backups! All of the backup management is also done through the Proxmox web interface without needing to install a client program on a separate Windows machine. Best of all the Proxmox hypervisor won’t set us back for about $5000 just for the license using commercial virtualization solutions. By the time you include hardware costs you’re looking at about $10000 easily! If you feel confident working with Linux, Proxmox is a great Virtualization platform. If you feel more comfortable having someone to reach out to for support Proxmox provides commercial support. For the DIY crowd there is a thriving community of helpful users on the Proxmox online forum.
References used for this article could be found here.