[CentOS] Incremental backups?

Sat Mar 15 04:12:54 UTC 2008
Les Mikesell <lesmikesell at gmail.com>

Scott R. Ehrlich wrote:
> So I thought I'd get a head start for next week -
> 
> I have a low-power Linux box that has a few samba shares mounted, and 
> limited hard disk space.   This box is connected to a tape library via 
> SCSI card.
> 
> I want to find the best way to create a full, then incremental backup of 
> the samba mounts, directly to tape.  Some of the samba mounts are 
> appliances that cannot run any special client/agent.
> 
> I'm looking at tar as an option, with its --incremental switch.   Bacula 
> uses a mysql database.  I tried setting it up and it was not so easy, so 
> I opted to use my time for other tasks.  Same for Amanda.

If you spend a little time setting up amanda or backup, they'll take 
care of this for you with no attention for years.  If you roll your own, 
you'll probably be fiddling with it all the time to get it right.


> I would use dump, but samba connections are not device files.
> 
> How about rsync?   The tape library is LTO3 with hardware compression 
> available.  Google searching just now doesn't make rsync directly to 
> tape too hopeful.

You can't do rsync to tape.

> What are the simplest options for incrementals based on date/time modified?

The one that gets it right is:

cd /path/to/save
tar --listed-incremental /path/to/incfile -c -f /dev/nst0 .

where incfile is arbitrary filename that you choose for each run.  If 
the file doesn't exist, you'll get a full run and create the file.  If 
it does exist you get an incremental and the file is re-written in place 
for a subsequent incremental run.  If you want all incrementals based 
from the full so you only have to restore 2 tapes, you have to save the 
incfile from the full run and put it back after incremental runs modify 
it.  If you don't do it that way, you'll miss copying old files in their 
new positions under a renamed directory because a strictly time based 
check won't pick that up.

You are on your own keeping track of which tapes have to be restored in 
which order to match the incrementals with the parent fulls.  Bacula or 
amanda would do that for you.

If you want something easier and can live with disk based backups 
instead of tape, look at backuppc (http://backuppc.sourceforge.net/).  I 
still run amanda because I set it up about 10 years ago and never have 
to do anything but change the tapes, but I take the tapes offsite and 
would only restore from them after a disaster.  For day-to-day stuff it 
is much easier to grab a copy or do a restore from the on-line web 
interface of backuppc.

-- 
   Les Mikesell
    lesmikesell at gmail.com