Ghetto backup of an array to multiple external devices (Linux)

bexamous

[H]ard|Gawd
Joined
Dec 12, 2005
Messages
1,670
First of all, don't expect this to work or be helpful at all. I was going to make something useful but its been long enough that its clear I'll never get around to doing so. Currently this is a horrible horrible script that works perfectly for me. Take it as is.

Okay with no expectations now:
http://dl.getdropbox.com/u/15520/backup.sh

This was only written to work on my system so don't expect it to be easy or possible to modify to use on yours. But it might help someone out there or something so I figured I'd post it. Or maybe just be a good example of what not to do. It does however work perfectly for me so the idea is valid.

I won't do tons of explaining because if you can't figure it out its of no use to you anyways.
------------------
Early on it does a find on '/data/bling' this should be your array... whatever this find command actually finds is what we're going to be backing up.

Edit that 'table' of drives data, check df for example to get a drives size in 1K blocks. Any drive set the used space to 0. Uh leave a little space empty, for example I leave 10GB free on each drive... first of all the file system will take up some of the space and secondly no one wants to mess with a 99.9% full file system.

All my backup drives are labeled backup0001 backup0002 backup0003 and so forth. When I plug one into my BlacX USB HD dock thing it they get auto-mounted as /media/backup0001 and so on. This is going to be hard for anyone to adapt... you might want to delete second half of script and just use that awk script and write your own ending half.

If all the files on array are yours you can run as user, if not you need to run as root.

This assumes that these backup drives will store nothing else... it WILL delete anything off the backup drive that isn't supposed to be there. Eg its mimicing rsync with --delete.
--------------------------


In the end I have an 4TB array or something full of data.

I have 7 drives sitting on my desk to backup array to. I run "./backup.sh update" and get a list of all files on the array, the list is divided up among the available drives.

I then start plugging in one drive at a time and run "./backup sync" when and it will check what drive(s) is/are connected and backup appropriate files to them.

Few weeks later or whatever repeat process. Rsync is being used so often most data is unchanged. This is like an alternative to having to burn to DVDs or something crazy like that. Or rather than having an entire separate system or requiring having to have every drive connected at same time.

On avg if you change 10GB of data you will need to copy 10GB of data in next backup.
On avg if you create 10GB of data you will need to copy [NumberOfDrives+1]/2*10GB of data.
On avg if you delete 10GB of data you will need to copy [NumberOfDrives]/2*10GB of data.

You're not having to copy ALL data every time but its not super efficiency.


Anyways....
 
Thank you for posting this. Every few years it seems i'm switching file systems for one reason or another and have to backup all my raid data to individual disks in the process, this script will come in handy next time around.
 
Back
Top