D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] backup mirror/swap setup

 

On 09/02/16 16:45, Gordon Henderson wrote:
On Tue, 9 Feb 2016, Tom wrote:

One of my backup drives has just gone dead. Going to get a pair of USB
drives with the intention of somehow exposing the two as one so that I
can take one away for safe keeping and then, when I plug it in it the
current active one will be mirrored to it and then unmounted for
taking out for safe keeping.
Anyone seen any scripts around to allow me to do this with relative ease?

You can use Linux software RAID mirroring as the back-end to this. Not
sure I recommend this way of keeping a backup though, however it can be
done.

Build the mirrored set, put your data onto it, then soft-fail the drive
you want to remove, (mdadm --fail /dev/md1 /dev/path/to/removing/drive)
remove it and store it.

System carries on.

Plug in the drive and re-sync the mirror with the right mdadm command

e.g.

   mdadm --add /dev/md1 /dev/path/to/removing/drive

wait for it to complete - watch -n cat /proc/mdstat then repeat the
soft-fail & remove process.

You might want to use /dev/disk/by-uuid/... to make sure you're using
the right device.

You can script that with a script fired off from the udev trigger when
the system sees the drive.

The huge downside of that, is that every sector on the in-use disk will
be read and every sector on the updating disk will be written. It takes
time and you need perfect drives all the time. (There is a bitmap option
to mdadm that came make this quicker, but I think it only supports
ext2/3 at present)

Plan B would be to not use a mirror system but to have a separate
filesystem on the removable drive and use rsync. With clever use of
rsync you can store many days/weeks/months of data, depending on how
much changes between backups. Again, scripts fired off from udev can do
the copy. This is the way I copy my camera to my desktop - however I
have a simple script, so I plug in the camera, run the script then
unplug it.

I think I'd simply off-site backup via this interweb thing to a remote
server in a bunker somewhere using e.g. rsync. (which is actually part
of what I do) - the downside being the time to recover it should it need
recovery.

Gordon

Cheers - re the off-site using the interweb - my last rsync on my laptop took 4 days - I don't think it would ever finish on a 2.25Mb adsl. I think I'll just walk the other disk to the shed - if I loose the house and the shed I think I'll not be here either to worry about it!
Tom te tom te tom


--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq