====== Virtual Machine Backups ======
Since now we have a Server PC with much more features, the need to **take regular backups** is more urgent. Our setup makes it easier to take backups.
We will take backups at least from the 3 virtual machines running on the Server PC.
* **lserver** : Server vm with all **services**, **users**, **files** and **LServerAdmin** administration software. It is running on Ubuntu LTS or Debian stable.
* **ltsp** : Ltsp server vm providing **network boot** to old machines and **remote connection to Linux OS**. It is running on Ubuntu LTS or Debian stable.
* **win2016ts/win2019ts** : Windows vm with remote access enabled so that we can **connect remotely to Windows** from old machines booted from network.
===== Initial Configuration =====
We do the following:
* We connect an **external usb3 hard disk** with at least **1000GB** free space to the usb3 port of the Server PC.
We need to format the hard disk to **ntfs** or **ext4** filesystem. **Do not use fat32** since files over 4GB will be created.
* [[en:quickstart:connect2server|We connect to Server PC]] from Proxmox.
* On the left pane we select **Datacenter** and double click on **hosta**
* From the buttons in the upper toolbar we select **Shell**.
* A terminal opens and we can directly execute commands on Server PC. We execute **lsa-host**.
* We go to menu **Maintenance / Add usb disk**. We select the partition of the usb disk e.g. **/dev/sdd1** to mount it permanently as **/mnt/usbdisk**.
* We close the terminal window of the Server PC.
* On the left pane we click on **Datacenter**, we go to **Storage** tab, click on **Add** button and select **Directory**.
* We set ID: **''usbdisk''**, Directory: **''/mnt/usbdisk/backup''**, Content: **''VZDump backup file''** και Max Backups: **''2''** (to keep only the last 2 backups and delete older. If our storage is 2ΤΒ or more we can set 4-6 to keep)
===== Άμεση Λήψη Αντιγράφου Ασφαλείας =====
* On the left pane we click on **Datacenter**, we select **hosta** and click on the virtual machine we want to take backup e.g. **lserver**.
* We go to **Backup** tab and click on **Backup Now** button.
* We select Storage: **usbdisk** and leave the other options as they are.
* A new **Task Viewer** window opens to monitor the backup process. We can close the window.
* The backup process is still running on the background. We can select it on the bottom **Tasks** pane and double click to view it.
===== Scheduled backups =====
Since the backup process takes long to finish, it is not practical to wait for it each time.
We will see how to schedule backups.
* On the left pane we click on **Datacenter**, select the **Backup** tab and click on **Add** button.
* We select Storage: **usbdisk**, day **Sunday** and time **01:00**, Selection Mode: **All** (or **Include Selected VMs** and check only the virtual machines we want). We press **Create**.
The backups can be done with the virtual machines running. They must be scheduled on the time the virtual machines are not used, e.g. **late at night**, when no changes are made and **no operating burden is caused**.
===== Recommended backup procedure =====
For the backup procedure, it is good to have at least 2 usb disks for rotation of backups. Also we should always keep a backup disk away from where the server is located
Server is already configured to automatically mount usb disks after 11 on the evening to allow backups and unmount them on the morning at 7. So at any time between 7 a.m. and 11 p.m. we can disconnect securely the first usb disk and connect the second.
External disks can fail like any hardware. This problem we will not show up, until we try to restore, when we actually need it. Having at least 2 disks we cover this situation.