Matt, 

While I don't have hard links (mainly soft links) in my working directories, I am using hard links in my incremental backup strategy.  I implement the following simple script to create a rotating backup using rsync's --link-dest=[filename].  I would be curious to see what others thought of this approach to incremental backups:

Here is the script:

#!/bin/bash
# Backup script written by JHDugger 4/26/12.  

# Todays date in ISO-8601 format:
DAY1=`date -I`

# Yesterdays date in ISO-8601 format:
DAY0=`date -I -d "1 day ago"`

# The source directory:
SRC="/srv/tacs-host1/backup/"

# The target directory:
TRG="/srv/tacs-host1/archive/$DAY1"

# The link destination directory:
LNK="/srv/tacs-host1/archive/$DAY0"

# The rsync options:
OPT="-avh --delete --link-dest=$LNK"

# Execute the backup
rsync $OPT $SRC $TRG

#121 days ago in ISO-8601 format
DAY121=`date -I -d "121 days ago"`

#Delete the backup from 120 days ago, if it exists
if [ -d /srv/tacs-host1/backup/$DAY121 ]
then
rm /srv/backup/$DAY121
fi

This script creates a subdirectory with today's date under a directory called 'archive' and then proceeds to read changed files from the previous day's archive directory, copy and link any changed files from this directory to today's archive.  It then proceeds to delete the directory that is 121 days old.


On Wed, Jul 10, 2013 at 9:43 AM, Matt Graham <danceswithcrows@usa.net> wrote:
> Rusty.Carruth wrote:
>> First, if you are not using 'tar' or 'cpio' or other program which
>> correctly handles 'character (and block) special files' you will sooner
>> or later find yourself copying much more than you should (think pipes
>> and other character or block special files

rsync.  While rsync will not handle hard links in the optimal way by default,
how many people actually have hard links on their filesystems these days?
Also, char and block devices would only be found in /dev in just about any
case I can think of, and backing up /dev seems a bit like a waste of time
since udev manages it.

From: Michael Havens
> Yep,.... the advice to chown the file got lost in the shuffle

Yes, this is why it's important to read the whole message and understand it
when you're talking about semi-complicated technical things.

> however after I did that I click it and 'run in terminal'. then a shell
> opens and it says "building file list" and then something flashes
> across the screen and the terminal closes itself.

This probably means there's some sort of error happening.  So, open a konsole
or gnome-terminal and run the backup script inside that terminal, which will
allow you to see what the error is.  This is pretty basic, and I thought you
had done it already.

>> If you need to restore from the backup disk, just mount it.  The
>> command for doing that is in the script ("mount /mnt/backup").
> as for restoring the backup isn't there a way to retrieve one file?

If you mount a disk on /mnt/backup , then rsync your ~ to /mnt/backup/bmike/ ,
that means that /mnt/backup/bmike/ will contain an exact copy of your ~.  This
means that finding 1 file under /mnt/backup/bmike/ and copying it to
/home/bmike/ should be a very simple and easy thing.

--
Matt G / Dances With Crows
The Crow202 Blog:  http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see

---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss



--
James

Linkedin