0%

Linux: backup

Important directory needed to backup

/etc
/home
/var/spool/mail
/var/spool/{at,cron}
/boot
/root
/usr/local
/var/www
/srv/www
/var/lib/mysql for apache server

backup methods

dd :

1
dd  if=/dev/sda of=/dev/sdb

let /dev/sdb keep all the backup for /dev/sda

cpio:

1
find / -print |cpio -covB > dev/st0

backup all / to the tape

xfsdump:
Fully backup:

1
xfsdump -l 0 -L 'home_full' -M 'home_full' -f /backupdata/home.dump /home

Incrementally backup:

1
xfsdump -l 1 -L 'full-1' -M 'full-1' -f /backupdata/home.dump1 /home

it means backup /home to /backupdata
tar:

1
tar --exclude /proc --exclude /mnt --exclude /tmp --exclude /backupdata -jcvp -f /backupdata/system.tar.bz2 /

f: filename
v:verbose
c:create
p:preserve-permissions
Add date to backup file :

1
tar -jcvpf   filename.`date +%Y-%m-%d`.tar.bz2    /var/lib/mysql

rsync:

1
rsync -av /home /backupdata/

Backup /home to /backupdata