Dakusan's Domain Forum

Main Site Discussion => Posts => Topic started by: Dakusan on December 18, 2012, 08:56:17 pm

Title: Selectively skipping data in a cPanel backup
Post by: Dakusan on December 18, 2012, 08:56:17 pm
Original post for Selectively skipping data in a cPanel backup can be found at https://www.castledragmire.com/Posts/Selectively_skipping_data_in_a_cPanel_backup.
Originally posted on: 12/18/12

I was having problems on one of our production Linux cPanel servers in which our backup drive was not able to hold all the data from our primary drive for both our daily and weekly backups. An easy hack to fix this is to mount any subfolders you wish to exclude (generally very large ones) as a readonly temp file system in the appropriate backup folder. With this method, you can selectively exclude individual directories to one or more of the daily/weekly/monthly backup folders.

The only downside to this method is that pkgacct (called by cpbackup) logs will throw readonly file system errors for each file that cannot be copied.


So, to have cPanel discard an individual directory during the backup, you need to do the following:
First, make sure the backup directory to exclude is created and empty by running:
rm -rf PATH;
mkdir -p PATH;
NOTE: BE CAREFUL WITH “rm -rf”, IT IS A DANGEROUS COMMAND

To manually mount the directory, run:
mount tmpfs PATH -t tmpfs -o defaults,ro
To permanently mount the directory (mount on boot), edit /etc/fstab and add the following line:
tmpfs PATH tmpfs defaults,ro 0 0
If you do the permanent fix, don’t forget to run “mount PATH” to have it mount it to the live system, since fstab will not mount all its listed file systems until the next boot.

An example of a PATH might be: /backup/cpbackup/weekly/dakusan/public_html/uploads

cPanel also recently added (experimental) hard linking for backups, which really helps out with space concerns, and makes the need for this script a bit less.

Title: Re: Selectively skipping data in a cPanel backup
Post by: Dakusan on January 31, 2016, 09:38:03 pm
Please note that this post is now obsolete. cPanel now has selective backup options for both users and on a global level.