Diary and notebook of whatever tech problems are irritating me at the moment.


Simple off-site backup of a MD RAID 1 system

Standard backup tools like BackupPC are great for backing-up moderate amounts of user data but they can be impractical with huge data stores such as multi-terabyte RAID arrays as they need a backup store that is larger than the source data. My simple solution is to clone the array with another drive and store it off-site.

For this to work I had to categorize the data between smaller dynamic files (like documents) and larger static files (videos). The smaller files are backed up daily with BackupPC. The larger files are not backed up. Both are stored on a RAID 1 (mirror) array for redundancy in case of drive failure. On my server BackupPC uses a different, smaller RAID 1 array for a backup store. Since it is only backing up part of the data it doesn't have to be the same size as the main array. For backing up the larger/static files (and everything else) I simply add another drive to the main array, let it sync, then remove it and store off-site.

Ideally this system would use hot-swap but I don't have removable bays so I have to power-off the server each time. The rest of the procedure is relatively easy. With a RAID 1 array I have two drives (sda, sdb) and the added drive may show up as sdc. I say "may" because Ubuntu uses UUIDs for drive mappings and the actual device assignments may change. I always check with:

cat /proc/mdstat

to verify what devices are being used. I also check the partition sizes of all drives using "fdisk -l" and make sure the new drive has the same size partitions as the original RAID members. The partitions need to be of type fd "Linux raid autodetect" but no formatting with mkfs is necessary. Next I grow each RAID 1 MD device from 2 to 3 devices. For example:

mdadm -G -n 3 /dev/md0

This just tells the kernel that the array will now have three devices but does not assign another device to it. To allocate the device:

mdadm -a /dev/md0 /dev/sdc1

Resync should begin immediately. To monitor, I just use "cat /proc/mdstat" but the kernel will also send status messages to the console. After resynching, I disable the backup device by failing it:

mdadm -f /dev/md0 /dev/sdc1

This results in the RAID degradation warnings to be emailed to root. Next I remove it:

mdadm -r /dev/md0 /dev/sdc1

Finally, I shrink the array back to two devices:

mdadm -G -n 2 /dev/md0

This works well for my simple server setup. Obviously some scripting could be used to automate it. While this works well for a 2-drive RAID 1 array, it doesn't scale well with a larger number of drives or other RAID types.


Jim said...

completely off topic:
I see you like electrical challenges? I probably should ask a local plumber but I'm trying to go cheap. I need to wire up my boiler - here's what I got:
Boiler: a Toyotami OM-180.
Radiant floor runs directly off boiler: has boiler circ pump and two zone valves and one room thermostat. Domestic hot water runs off flat plate heat exchanger - has its own circ pump and uses old electric water heater for storage tank.
Right now I have the two wires from the boiler hooked to line voltage, the pump, and the thermostat so when the thermostat calls for heat, everything starts up fine. Zone valves aren't wired in yet.
I want to use the water heater's thermostat to trigger it's call for action.. start the boiler circ pump and domestic hot water (dhw) circ pump, and turn on boiler if needing more heat. I assume I'm needing a relay or something in here. (I'm a neophyte hobby plumber). I should sketch all this out.
I assume dhw thermostat is closed when calling for heat so that just completes a circuit. Open when satisfied.

To complicate matters there is a little circuit called a timer on the boiler that shuts it down.. it is not line voltage just a loop of wire that makes the boiler stay hot. For efficiency you can open that circuit and it makes the boiler cold, so it isn't staying hot all summer but only fires up when a call for dhw. So it would be nice to figure out how to incorporate that feature too - have the boiler go cold until there is a call for heat from room thermostat or dhw thermostat.

So maybe this isn't your cup of tea - and I would be sorry for bothering you. But since you are a "plant operator" maybe this is second nature stuff. The manual for the OM-180 is online..
the zone valves are the motorized 4 wire type from .. drawing a blank but pretty common ones.. not Taco, but ...

cheers, JD

jhansonxi said...

Very off-topic. I haven't worked with piped heat/cooling, only fan-forced. A DPDT relay would probably be needed but the current (amp) rating will depend on if it is controlling the pump supply voltage or only a control signal. A tankless electric water heater installed between the existing tank and faucets might be a better solution for supplying dhw when the boiler is not being used.

Jim said...

Thanks for that. I'll look up a plumber who is familiar with this system. The tankless electric heater is elegant but our electricity is over $.20/kwh so still better to use heating oil here.


About Me

Omnifarious Implementer = I do just about everything. With my usual occupations this means anything an electrical engineer does not feel like doing including PCB design, electronic troubleshooting and repair, part sourcing, inventory control, enclosure machining, label design, PC support, network administration, plant maintenance, janitorial, etc. Non-occupational includes residential plumbing, heating, electrical, farming, automotive and small engine repair. There is plenty more but you get the idea.