Keeping cPanel backups on the same disk as the accounts is risky: if that disk fails, you lose both. A second disk, mounted at /backup, fixes that. This guide adds one to a cPanel server running AlmaLinux, CloudLinux or Ubuntu.
Quick answer
With the new, empty disk at /dev/sdb (check yours first in Step 1):
parted -s /dev/sdb mklabel gpt mkpart backup ext4 0% 100%
mkfs.ext4 -L backup /dev/sdb1
mkdir -p /backup
echo 'LABEL=backup /backup ext4 defaults,nofail 0 2' >> /etc/fstab
systemctl daemon-reload
mount /backup
Then check that WHM › Backup › Backup Configuration uses /backup as the Default Backup Directory. cPanel
What you need: root SSH access, and a new disk installed in the server (or attached to the VPS). Everything on that disk will be erased.
Step 1: Find the new disk
List the disks:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS,MODEL
Example output:
NAME SIZE TYPE MOUNTPOINTS MODEL
sda 447.1G disk SSD 480GB
├─sda1 1G part /boot
└─sda2 446.1G part /
sdb 931.5G disk HDD 1TB
The new disk is the one with the expected size and no partitions and no mount points, here sdb. On NVMe servers it is named like nvme1n1, and its first partition is nvme1n1p1 instead of sdb1.
Be certain you have the right disk: the next steps erase it. Replace /dev/sdb with your disk's name in every command below.
Step 2: Partition the disk
Create a GPT partition table and one partition that uses the whole disk:
parted -s /dev/sdb mklabel gpt mkpart backup ext4 0% 100%
GPT works for disks of any size. The older fdisk "DOS" layout cannot use more than 2 TB of a disk.
Check the result. sdb should now have one partition, sdb1:
lsblk /dev/sdb
Step 3: Format the partition
mkfs.ext4 -L backup /dev/sdb1
This creates an ext4 file system named (labelled) backup. XFS also works if you prefer it: mkfs.xfs -L backup /dev/sdb1.
Step 4: Mount it at /backup
If /backup already holds backups, move them aside first, so they are not hidden under the new disk:
mv /backup /backup.old
Create the mount point and add the disk to /etc/fstab, so it mounts at every boot:
mkdir -p /backup
echo 'LABEL=backup /backup ext4 defaults,nofail 0 2' >> /etc/fstab
If you formatted with XFS in Step 3, write xfs instead of ext4 in that line.
The nofail option lets the server finish booting even if the backup disk is missing or broken. Without it, a failed backup disk can stop the server from starting. systemd.mount
Mount it, and check for mistakes in /etc/fstab:
systemctl daemon-reload
mount /backup
findmnt --verify
findmnt --verify should report no errors. Then confirm the disk is mounted with its full size:
df -h /backup
If you moved old backups aside, move them onto the new disk now, then remove the empty folder:
mv /backup.old/* /backup/
rmdir /backup.old
Step 5: Point cPanel backups at it
- In WHM, go to Backup › Backup Configuration.
- Under Backup Directory, check that Default Backup Directory is
/backup. That is cPanel's default. cPanel - Leave Mount Backup Drive as Needed off. With it on, cPanel mounts and unmounts the drive around each backup run, and the File and Directory Restoration tools in WHM and cPanel stop working. cPanel
- Click Save Configuration.
The next scheduled backup is written to the new disk. To test now, run as root:
/usr/local/cpanel/bin/backup --force
When it finishes, ls /backup should show a folder named after today's date.
Troubleshooting
mount: /backup: can't find LABEL=backup. The partition was not formatted with the label. Run blkid /dev/sdb1 and check for LABEL="backup". Or use the UUID= value that blkid shows in /etc/fstab instead of LABEL=backup.
The server will not boot after editing fstab. Most likely a typo, or the line is missing nofail. Boot into rescue mode, fix or comment out the line in /etc/fstab with vi, and reboot.
Backups still fill the main disk. Check df -h /backup. If it shows the main disk's size, the new disk is not mounted. Run mount /backup and check findmnt --verify again.