How to Configure Server Backups to SAN Storage on cPanel or Plesk
When you want server backups to be stored on separate SAN storage. This article explains how to configure backups to SAN storage on cPanel or Plesk servers.
cPanel SERVERS
It is always best practice to mount /backup as an additional partition in cPanel servers because if backups are enabled, the server will run out of space too frequently due to regular backup generation. Hence /backup can be mounted as an additional partition here, following the below steps:
1. RUN lsblk
Sample Output
~~
root@x.x.x.x [/]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 1000M 0 loop /tmp
vda 252:0 0 30G 0 disk
vda1 252:1 0 30G 0 part /
vdb 252:16 0 4G 0 disk [SWAP]
vdc 252:32 0 50G 0 disk
root@x.x.x.x [/]#
vdc 252:32 0 50G 0 disk >> this is our 50GB additional drive
~~
2. Now run mkfs.ext4 /dev/vdc
3. Rename current /backup directory to /backup1
4. e2label /dev/vdc backup
So e2label labels the drive with an easy to use name , instead of using the uuid (as you saw in fstab)
5. Now create a /backup directory and mount the newly added drive to /backup
mkdir /backup
mount /dev/vdc /backup
6. Lastly we need to add it into fstab so it stays on reboot
$ vi /etc/fstab
LABEL=backup /backup ext4 defaults 0 0
7. Once this is done please run the below command to check whether the entry in /etc/fstab is correct by mounting the device:
mount -a
8. We need to move the contents in /backup1 to /backup
cd /backup1
move * /backup
Once this is done, reboot the server and remove the /backup1 directory once this is up.
PLESK SERVERS
By default, all backup data is stored in the directory /var/lib/psa/dumps in Linux Plesk. We can change this default backup location to some other folder like /plesk_backups and then mount it as an additional drive.
First we will be mounting the additional drive to a new folder /plesk_backups which will be used as the default backup location for the server. Please follow the below steps for mounting the new drive
1. RUN lsblk
Sample Output
~~
root@x.x.x.x [/]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 1000M 0 loop /tmp
vda 252:0 0 30G 0 disk
vda1 252:1 0 30G 0 part /
vdb 252:16 0 4G 0 disk [SWAP]
vdc 252:32 0 50G 0 disk
root@x.x.x.x [/]#
vdc 252:32 0 50G 0 disk >> this is our 50GB additional drive
~~
2. Now run mkfs.ext4 /dev/vdc
4. e2label /dev/vdc backup
So e2label labels the drive with an easy to use name , instead of using the uuid (as you saw in fstab)
5. Now create a /plesk_backups directory and mount the newly added drive to it
mkdir /plesk_backups
mount /dev/vdc /plesk_backups
6. Lastly we need to add it into fstab so it stays on reboot
$ vi /etc/fstab
LABEL=backup /plesk_backups ext4 defaults 0 0
7. Once this is done please run the below command to check whether the entry in /etc/fstab is correct by mounting the device:
mount -a
Once this is done, reboot the server and remove the /backup1 directory once this is up.
Now you may also need to change the default backup directory following the below steps:
1. Set necessary ownership for the created backup directory /plesk_backups:
chown psaadm:psaadm /plesk_backups
chmod 755 /plesk_backups
Modify the backup location in the Plesk configuration file /etc/psa/psa.conf:
2.1. Open the file /etc/psa/psa.conf in a text editor
$ vi /etc/psa/psa.conf
2.2 Change the value of DUMP_D to /plesk_backups:
$ Backups directory
DUMP_D /plesk_backups
2.3. Save the changes and close the file.
2.4. Verify that the directory has been changed:
grep -v '#' /etc/psa/psa.conf | grep -w DUMP_D
DUMP_D /plesk_backups
3. Move all backup data and the hidden .discovered directory from the old location to new:
mv /var/lib/psa/dumps/* /plesk_backups/
mv /var/lib/psa/dumps/.discovered/ /plesk_backups/
4. Restart the "sw-cp-server" service:
service sw-cp-server restart
Now all backup files will be stored in the directory /plesk_backups