PDA

View Full Version : Backup



lazy202
02-12-2008, 10:34 AM
dump -0aj -f /tmp/home0.bak /home
make a full backup of directory '/home'
dump -1aj -f /tmp/home0.bak /home
make a incremental backup of directory '/home'
restore -if /tmp/home0.bak
restoring a backup interactively
rsync -rogpav --delete /home /tmp
synchronization between directories
rsync -rogpav -e ssh --delete /home ip_address:/tmp
rsync via SSH tunnel
rsync -az -e ssh --delete ip_addr:/home/public /home/local
synchronize a local directory with a remote directory via ssh and compression
rsync -az -e ssh --delete /home/local ip_addr:/home/public
synchronize a remote directory with a local directory via ssh and compression
dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz'
make a backup of a local hard disk on remote host via ssh
tar -Puf backup.tar /home/user
make a incremental backup of directory '/home/user'
( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p'
copy content of a directory on remote directory via ssh
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p'
copy a local directory on remote directory via ssh
tar cf - . | (cd /tmp/backup ; tar xf - )
local copy preserving permits and links from a directory to another
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents
find and copy all files with '.txt' extention from a directory to another
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2
find all files with '.log' extention and make an bzip archive
dd if=/dev/hda of=/dev/fd0 bs=512 count=1
make a copy of MBR (Master Boot Record) to floppy
dd if=/dev/fd0 of=/dev/hda bs=512 count=1
restore MBR from backup copy saved to floppy