Backup

David Fletcher dave at thefletchers.net
Fri Nov 4 09:19:21 UTC 2016


On Fri, 2016-11-04 at 07:55 +0200, Errol Sapir wrote:
> Hi Dave
>  I've started reading about using rsync and it looks the way to go
> but what does  --delete in the command line mean?
> Errol

rsync is indeed definitely the way to go.

The --delete option deletes from the destination directory files which
no longer exist in the source directory. If you want to protect
yourself from accidentally losing files you might want to leave it out.
As somebody else suggested you should have a read of the manual. For
instance if I recall correctly there is a subtle difference in
behaviour depending on whether you have trailing slashes on the end of
the source and destination directories. I always create the destination
directory first and include the trailing slashes.

Something you should probably do is make a tar archive (similar to
using WinZIP) of all the data files from time to time and copy them to
other storage. You will find that learning Linux is a rich experience
which provides the tools to make your life easier. For instance this
command:-
tar cvpPzf /root/home`date +%Y%m%d%H%M`.tar.gz --exclude-
from=/home/BackupThisPCExcludes /home/*

which needs to be used with sudo, creates an archive file automatically
named with the date and time that the command was run. If this is of
interest to you, you should also look at man date. BTW the backticks
enable you to embed the output of e.g. the date command into another
command such as the one I give you above. Play with the date command on
its own, then play with the tar command incorporating the date and see
what happens.

--exclude-from refers to a file which is a list of things in /home/
which I don't need backed up. The BackupThisPCExcludes file contains
entries such as:-
.cache/*
.googleearth/*
.thumbnails/*

which would needlessly make the archive file huge and are not needed
because they will be automatically regenerated. You should probably
take out the --exclude-from at first to make everything simpler.

Some of the tricks I am giving you here such as the backticks were
shown to me by a friend who at the time was a Red Hat Certified
Engineer. Others I found out for myself by reading manuals.

Above all, have fun and enjoy learning Linux. When you're happy with
rsync and tar, get back to us and we'll get you going with scripts so
that you can automate things that you do repeatedly.

BTW do you know about using CTRL-R at the terminal, to reverse search
for commands that you've previously used? That save you a whole load of
typing.

Dave




More information about the kubuntu-users mailing list