In general, your files are NOT backed-up. Be assured that harddisks DO
crash. To avoid loss of weeks or months of work you should make sure to
back-up stuff yourself. An example for (almost) brute force automated
nightly back-up is given here:
I. Create a file c1
In c1 type the rsync commands to create your backup.
Here is an example for backing up /my_disk/my_uname/my_data on /backup_disk/my_uname/data_backup
Note: You will need to create the proper directory structure first.
(1) At the beginning of your c1 file copy the following function:
if [ $RandomSleep -eq 0 ]; then
if [ -z "$RANDOM" ] ; then
# A fix for shells that do not have this bash feature.
RANDOM=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c"1-5")
TIME=$(($RANDOM % $RandomSleep))
(2) Get rid of old backup log file:
rm -f /backup_disk/my_uname/Rsync_logs/data_backup_old.asc
(3) Move current backup log file to old.
mv -f /backup_disk/my_uname/Rsync_logs/data_backup.asc
(4) use rsync to create backup.
rsync -avzu --delete --force --stats --modify-window 5 /my_disk/my_uname/my_data/
chmod 700 /backup_disk/my_uname/data_backup
Note: the --delete switch means that files that have been
removed will be deleted in the new backup.
If you do not wish this to happen (e.g. in case you want to recover old
files), remove the --delete switch. However, in this case you
need to keep an eye
on your backup so it does not fill up the disk, preventing new data
from being backed up.
Another useful switch is --exclude-from which allows you to
exclude directories that you do not wish to back-up (e.g. large data
sets that are easily replaceable).
The syntax is --exclude-from=/path/to/file/which/lists/excluded/files/and/directories.
See the man page for additional possible switches.
II Create a file table.asc
Enter the time you wish the backup to be taken. You probably also want
to add some comments saying what the file is:
# Load: crontab table.asc
# List: crontab -l
#min hour day month dow command
22 02 * * * /your/path/to/c1
The "*" indicates it should be done every day, month, and day of the
Type: crontab table.asc
and you're done!
You can find further examples of rsync commands here:
Example cron tab for automated execution: