Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Simple backup copying to another HDD

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
build
Posts: 11
Joined: 2006-07-12 05:46

Simple backup copying to another HDD

#1 Post by build »

G'day All,
I've been looking around at backup utilities like Mondo but realised what I want to do probably has a simpler answer. All I want to to is copy files from /home that have changed since the last backup to another drive mounted as /home.bak.

Cron? all suggestions appreciated.

Thanks,
build

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#2 Post by lacek »

It can be done with a script like this:

Code: Select all

cd /home
    for file in `find . -mindepth 1 -newer /home.bak`; do
    cp -r $file /home.bak/
done
or this way:

Code: Select all

cd /home
find . -mindepth 1 -newer /home.bak -exec cp -r \{\} /home.bak \;
These examples take granted you never touch /home.bak by hand, I mean, you don't create a file in it, and you don't edit any files in it. If you do, it won't work, because it copies all files which was changed later than the /home.bak directory. If you touch the directory by changing one of the files in it, these will fail.
See the man page of find for more info and for the possible switches and tests.

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#3 Post by Grifter »

apt-get install rsync, man rsync
Eagles may soar, but weasels don't get sucked into jet engines...

build
Posts: 11
Joined: 2006-07-12 05:46

backup

#4 Post by build »

Thanks to you both. I like both answers but don't fully comprehend the bash.

With rsync is it really as simple as: # rsync -r /home/ /home.bak

looks far too easy.
(this R3.1 debian is really getting far tooo easy, not scary geeky stuff at all ;-)

cheers
build
Last edited by build on 2006-07-29 22:53, edited 1 time in total.

build
Posts: 11
Joined: 2006-07-12 05:46

#5 Post by build »

G'day All,
I ended up with a crontab entry of: 0 * * * * rsync -rogv --delete /home/ /home.bak to back up every hour.

The -r being recursive, -o & -g to preserve owner and group, the -v for verbose and --delete to delete obsolete files. However the -v is not providing a list of files printed to the screen and syslog has only the cron entry. Where is the output of verbose to be found?

Thanking you in anticipation.

btw, is the crontab entry correct? Is there a better way of doing it? Is there any other options I should be using? Thx

sofasurfer
Posts: 113
Joined: 2006-05-08 05:49

#6 Post by sofasurfer »

I tried the command... # rsync -r /home/ /copyhome and I got a stream of messages... 'skipping non-regular file "<filename>".

What does this tell me.
The copy DID get put into my 2nd drive like I wanted.
Now, assuming this DID work right, the next time I run # rsync -r /home/ /copyhome, the /copyhome will be updated with everything that has changed and only everything that has changed, right?

Post Reply