Restore a single Proxmox OpenVZ Container From The command Line

Restore a single Proxmox OpenVZ Container From The command Line

Get Social!

proxmox logo gradI mostly use Proxmox from the command line, or terminal, and I have created a few scripts to perform common and repetitive tasks.

The below script will restore a single OpenVZ container to the latest backup file available in the dump directory. The scripts takes a parameter for the container VMID to restore from backup. If the container exists, it will be stopped and removed before restoring the latest backup file available in the backup directory.

The script iterates through all of your backup files and only restores the latest based on the date in the file name, and not the date of the file creation or modified.

You will need to set the BACKUP_PATH variable to the location of your backup folder with no trailing slash, and BACKUP_EXT with the extension used for your chosen backup format.

If you save this script in the /bin then you can call the script from the terminal without having to move to the scripts directory. Create the file and paste the below script into it.

Make the script executable using chmod.

Use the below command, and substitute [VMID] with the container VMID to restore, to run the script.

See my other script on restoring multiple OpenVZ containers in Proxmox.


Related posts:


Leave a Reply

Visit our advertisers

Search

Quick Poll

Are you using Docker.io?

Visit our advertisers