tar rsync
======================================================
DEBIAN - SYSTEM ADMINISTRATION - BACKUP / TAR
======================================================
Theory:
----------
debian.pdf
jabber.pdf
ssh.pdf
shell.pdf
vi.pdf
mail.pdf
- Sysadmin: Backup / Copy Tools
- Sysadmin: Keep in time
System Administration: Backup / Copy tools
==========================================
As usual:
abbts1:~# apt-get update
abbts1:~# apt-get upgrade
Then, please use (and install if required) following commands and tools.
Check the corresponding man page and/or internet documents, and try to
achieve these tasksÿ:
(For reference, write down the command you used. If a directory
does not exist, make sure to create it before...)
1) cp
- copy (recursively and by preserving the file attributes)
the contents of your /etc/ directory to the target
directory /home/BACKUP/test/etc_20100202
2) tar / gzip
- backup the contents of your /etc/ and /boot/ directory to
a file named /home/BACKUP/test/etc_boot_20100202.tar
- do the same, but activate gzip compression : target file:
"/home/BACKUP/test/etc_boot_20100202.tar.gz
- do the same, but this time with bzip2 compression : target file:
/home/BACKUP/test/etc_boot_20100202.tar.bz2
- compare the size of the 3 files you just generated
- now extract the contents of
/home/BACKUP/test/etc_boot_20100202.tar.bz2
in /home/BACKUP/test/recovery/
- now backup the files from /var/log/status which have been
changed/added the last 7 days to /home/BACKUP/test/status_20100202.tar
hint1: you will need "find" with parameter "-mtime -7"
hint2: you can use "xargs" or the "-T" parameter of command tar
3) gzip / gunzip
- compress the fle /home/BACKUP/test/etc_boot_20100202.tar
- display the compression ratio of the new compressed file
- uncompress the file /home/BACKUP/test/etc_boot_20100202.tar.gz
4) bzip2
- compress the fle /home/BACKUP/test/etc_boot_20100202.tar
and display the compression ratio of the new compressed file
during the process
- uncompress the file /home/BACKUP/test/etc_boot_20100202.tar.bz2
5) rsync - http://samba.anu.edu.au/rsync/
A great toolÿ: please check the Features, FAQ, Examples part of the
website first, and/or the man page.
5.1) local backup:
- with rsync, backup your /var/log/status/ directory to
/home/BACKUP/test/status/. Make sure not to forget trailing "/"
at the end of the paths...
- run the same command again: it should only copy the files which
have changed in the mean time.
- same thing in target directory /home/BACKUP/test/status2/, but
exclude the files with a date ending with ".10":
5.2) remote backup: next week, on a live server.
System Administration: Keep in time
===================================
- current system time:
abbts1:~# date
Tue Feb 02 10:52:16 CET 2010
- change the system time by hand:
abbts1:~# date 080610001976
Fri Aug 6 10:00:00 CET 1976
abbts1:~# date
Fri Aug 6 10:00:01 CET 1976
- update the time automaticaly with a time server
abbts1:~# apt-get install ntpdate
abbts1:~# ntpdate ch.pool.ntp.org
02 Feb 10:53:50 ntpdate[2368]: step time server 134.34.3.19 offset 1026089592.703582 sec
abbts1:~# date
Tue Feb 02 10:53:55 CET 2010
- update the hardware clock (until now wo only updated the system
time, which gets lost on reboot)
abbts1:~# hwclock --systohc
abbts1:~#
- to stay "in sync", please add this line to your crontab,
to be run every day at 05h33, 08h33, 15h33 und 19h33
EOF.