You are here Home > Know-how > Linux > System Administration > Tips: Backup Files

Linux Reference

6.9 Tips: Backup Files


20.02.2008
6.8 logrotate [  up  ] - [ top ] - [ linux a-z ] 6.10 Firewall with iptables

X

List large files and directories first

du -ks *|sort -rn|head -10

#!/bin/bash

# -- Runs on source-host.example.org

# -rvztl =
# - recurse into directories / verbose / compress / preserve times /
# - copy symlinks as symlinks
#
# /usr/bin/rsync -rztl -e "ssh" /foo/[directory] backup@{host}:source-host.example.org/foo

# -- Backup with user 'backup'
echo "backup to another-host"
/usr/bin/rsync -rvztl -e "ssh" /var/www/cgi-bin backup@another-host.access.ch:source-host.example.org

# -- Backup as 'root' (preserves owner/group)
echo
echo "backup to foo"
/usr/bin/rsync -rogvtzl --exclude-from /root/.x_rsync.txt -e "ssh" /var/www/cgi-bin/ foo.example.org:/home/backup/source-host.example.org/var/www/cgi-bin/

/usr/bin/rsync -rogvtzl --exclude-from /root/.x_rsync.txt -e "ssh" /home/postgres/ foo.example.org:/home/backup/source-host.example.org/home/postgres/

/usr/bin/rsync -rogvtzl --exclude-from /root/.x_rsync.txt -e "ssh" /var/lib/mysql/ foo.example.org:/home/backup/source-host.example.org/var/lib/mysql/

/usr/bin/rsync -rogvtzl --exclude-from /root/.x_rsync.txt -e "ssh" /root/ foo.example.org:/home/backup/source-host.example.org/root/

/usr/bin/rsync -rogvtzl --exclude-from /root/.x_rsync.txt -e "ssh" /home/retoh/ foo.example.org:/home/backup/source-host.example.org/home/retoh/

/usr/bin/rsync -rogvtzl --exclude-from /root/.x_rsync.txt -e "ssh" /data/ foo.example.org:/home/backup/source-host.example.org/data/

[ Download / wget ]



See also /know how/rsync



copyright by retoh - created with mytexi