Backup using tar

From Wiki
Jump to: navigation, search

Before making the backup file you may want to add additional modules to the initial ramdisk.

/sbin/mkinitrd -v -f initrd-2.6.18-308.el5.img --with=ata_piix --with=ahci --with=3w-xxxx --with=megaraid_mbox --with=megaraid_sas --with=aacraid --with=sata_nv --with=sata_sil --with=mptbase --with=mptspi --with=sym53c8xx 2.6.18-308.4.1.el5

Next back up the server. The resulting file should be created on a disk that has ample space available. Here is a simple bash script to create the file.

#!/bin/bash

yum clean all

/usr/local/cpanel/bin/tailwatchd stop
/etc/init.d/mysql stop

cd /
rm -fv cpanel-template.tar.gz

screen /bin/tar -czvf cpanel-template-lwdefault.tar.gz --exclude=proc/* --exclude=selinux/* --exclude=home/* --exclude=sys/* --exclude=dev/.udev/* --exclude=*/lost+found --exclude=lost+found --exclude=tmp/* --exclude=var/tmp/* --exclude=mnt/* --exclude=etc/ssh/*key* --exclude=cpanel-template*.tar.gz --exclude=root/mk_backup.sh --exclude=root/.bash_history /

scp to backup server.