RAID arrays in (Puppy) Linux

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

Linux Software RAID

#41 Post by rufwoof »

tempestuous wrote:3. LINUX SOFTWARE RAID

If your RAID setup is running only under Linux, and there's no need to dual boot into Windows, this is the better RAID solution than bios-RAID.
For motherboards with onboard RAID (Host RAID) as mentioned in the previous section, disable the RAID function in bios. Yes, this sounds a bit strange, but Linux will take over all RAID configuration.
There's a HOWTO here -
https://raid.wiki.kernel.org/index.php/ ... _operation
Here's a summary. Let's assume you want RAID1 (mirroring for redundancy)
using /dev/sdb1 and /dev/sdc1 (your drives must be partitioned with GParted, first)
RAID0 support is built directly into the Puppy kernel, but RAID1 support is via the external kernel module "raid1", so we first need to load this module -

Code: Select all

modprobe raid1
Install the mdadm dotpet package attached to this post. Then run this command to configure the RAID array

Code: Select all

mdadm --create --verbose /dev/md0 --level=raid1 --raid-devices=2 /dev/sdb1 /dev/sdc1
You should hear the drives working as the array is initialised. Once this is complete, the new RAID configuration must be saved, with this command -

Code: Select all

mdadm --detail --scan >> /etc/mdadm.conf
(It's worth keeping a copy of this configuration file on a USB dongle, for example, in case your system drive fails in the future, and you need to be able to access the RAID array on a different installation.)
Your new RAID array is /dev/md0. Go ahead and format it with ext3 (alternative filesystems may be considered)

Code: Select all

mkfs.ext3 -v -m .1 -b 4096 -E stride=32,stripe-width=64 /dev/md0
All those extra formatting options I just included are explained in the RAID wiki I mentioned earlier.
Now mount the RAID array -

Code: Select all

mkdir /mnt/md0
mount /dev/md0 /mnt/md0
Now you can browse to /mnt/md0 with ROX, and test it by copying some files to/from.

That's it, but we also need to restore this configuration at each bootup. My mdadm dotpet includes a special mdadm udev rule which, in theory, will auto-detect software-raid arrays at bootup, and restore their configuration ... unfortunately testing under Puppy 5.28 has shown that this udev function fails!!
So you need to add some extra commands to Puppy's startup scripts - open /etc/rc.d/rc.local in Geany, and add these 3 lines -

Code: Select all

modprobe raid1
mdadm --assemble /dev/md0
mount /dev/md0 /mnt/md0
Save.
Now each time you boot Puppy, your RAID array will be ready to use at /mnt/md0
Just to add from a new-user angle, the

Code: Select all

mdadm --create --verbose /dev/md0 --level=raid1 --raid-devices=2 /dev/sdb1 /dev/sdc1
stage took over a hour for me (pair of 45GB USB/HDD). The command when entered 'finished' instantly, but the disks whirred for ages. Found a command that shows the progress of that stage

cat /proc/mdstat

that provides % done and estimated time to completion details.

Another useful command is

mdadm -D /dev/md0

to see the status of the RAID mirror. The standard Linux thing appears to be that the monitor will email root when one of a pair of RAID1 fails, but a Puppy doesn't have standard linux mail I guess you wouldn't find out that one disk had perhaps failed until the second one also failed - which isn't what is desired. Periodic manual checks using the above might indicate that one disk had failed enabling you to make a backup of the /mnt/md0 content before replacing the failed disk.

I've setup a software Raid1 for the purpose of storing one-time-pad keys for encrypted documents http://www.murga-linux.com/puppy/viewto ... 999#881999 that I store on googledrive, as the loss of the key is paramount to loss of data. Having encrypted data in the cloud, keys stored on USB, laptop/pc using both to decrypt/work/reencrypt without storing copies unencrypted means that if the laptop is lost/stolen data is still safe (thief can't access personal data without the key). Assuming cloud data is safe/backed up, but unreadable (encrypted) by the host, and two pairs of USB's hold the keys, then all-round that's pretty secure/safe.

On another note, whilst reading around I found the attached youtube report where a guy plugged in a multiple number of usb's into a usb hub and set them up as stripped arrays. The speed of two stripped USB's was significantly quicker than one USB, but then the speed benefit tailed off pretty quickly thereafter for 3, 4 .... 8.
Attachments
i.png
(68.1 KiB) Downloaded 292 times
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

Post Reply