-   Slackware (
-   -   A Really Dumb Question about RAID 1 (

tronayne 10-15-2013 01:14 PM

A Really Dumb Question about RAID 1
It looks like Slackware 14.1 is pretty much a done deal. Yay.

I've got two servers sitting in their shipping cartons that have been waiting for 14.1 (while development work was going on somewhere else) and it's looking good for 14.1 pretty darn soon.

Both boxes have two 500G drives, there's supposed to be hardware RAID, and I'm feeling pretty dumb. The instructions for setting up RAID 1 look simple enough but my question is, can I partition the RAID array?

I partition my systems with root, swap, /opt, /var/lib/pgsql, /usr/local and /home, all mounted partitions (I also do /var/lib/mysql and /var/lib/virtual but those two will not be used on these machines). I will be adding [I]/hicl for Documents, Pictures and Videos (lots of big-butt files in those).

I do that so that when a new release of Slackware becomes available I do a clean install (you format the root partition during installation but only mount the others so you don't lose everything).

So, can you partition a RAID 1 array like this?


NeoMetal 10-15-2013 01:26 PM

Generally a hardware raid will appear to the OS as one drive, so yes, you should be able to partition it

kikinovak 10-15-2013 02:04 PM

I use RAID 1 and RAID 5 quite a lot on both servers and workstations.

Let's say I want ot have RAID 1 with 100 MB for a small boot partition, 1 GB for swap, and the remaining space for a root partition.

Launch fdisk on the first disk, and create these partitions. As partition type, choose "non-fs-data". Once you've done this, do the same thing on the other disk. Create the exact same partitions.

Now create your arrays:


# mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1
# mdadm --create /dev/md2 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda2 /dev/sdb2
# mdadm --create /dev/md3 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda3 /dev/sdb3

Make the swap partition manually so the installer will recognize it:


# mkswap /dev/md2
Launch the installer:


# setup
Now you can format /dev/md3 using the FS you want (ext4, ext3, whatever). This will be your main partition. Then you can format /dev/md1 as ext2, for example, and use it as /boot partition.

Now you can do the same thing with your personal partitioning scheme.

Beware, though. You *will* need to use the generic kernel with an initrd before the initial reboot, which is a bit tricky.

Another word of caution. When you experiment, you'll probably have to clean up any old array remnants from previous attempts. You'll have to do it like this:


# mdadm -Ss
# mdadm --zero-superblock /dev/sda1
# mdadm --zero-superblock /dev/sda2
# mdadm --zero-superblock /dev/sda3
# mdadm --zero-superblock /dev/sdb1
# mdadm --zero-superblock /dev/sdb2
# mdadm --zero-superblock /dev/sdb3

Last thing: don't forget to deactivate the hardware RAID in the BIOS. Otherwise you'll only see one disk.

Edit: if you don't want to go through all the hassle of a software RAID, just keep the hardware RAID and partition and format your disk as if it was one simple disk. No difference for the installer.

Have fun,


Richard Cranium 10-15-2013 09:52 PM

You should spend some time to learn about LVM. Honest.

Mark Pettit 10-16-2013 03:00 AM

Also - when doing raid with mdadm (or lvm), you should make sure the drives have the correct partition code (set from fdisk or gdisk).

All times are GMT -5. The time now is 06:11 AM.