Installation on Software RAID

Added by Elena GAVRILOVA 11 months ago

Introduction

RAID (Redundant Array of Independent Disks) is a data storage virtualization technology that combines multiple physical disk drive components into a logical unit for the purposes of data redundancy (except RAID 0) and performance improvement, or both. You do not need a RAID controller to set up a RAID array. As it does not require specific hardware, a RAID array can be, if needed, relocated to another Linux-run server anytime.

However, please note that the RAID technology does not replace backup. Your data are only protected from one of disk components becoming inoperative. They can be lost as the result of file system problems or accidental file removal. Besides, the second disk may be damaged during the data recovery, due to its high-rate use during this operation.

To install Calculate Linux on a software RAID, you have to partition a disk, copy the resulting partition table to the other disk drives and, finally, create a RAID array from these identical partitions. For instance, let’s create a RAID 5 array on the /dev/sda, /dev/sdb and /dev/sdc volumes. Note that you can use a two-disk RAID 1 as well, two being the minimum size.

First make sure that Calculate Utilities were updated to v3.5.7.

Creating a RAID array

We suggest partitioning your disk as recommended by Calculate. It means creating a swap volume, a system volume, a partition to update your CL from and user partitions containing user settings.

Partition a disk with fdisk:

fdisk /dev/sda

# create a new GPT partition table
g <Enter>
# create the "BIOS boot” partition
n <Enter><Enter><Enter> +50M <Enter> t <Enter> 4 <Enter>
# create a partition for the RAID array
n <Enter><Enter><Enter><Enter> t <Enter> 2 <Enter> 29 <Enter>
# save and exit
w <Enter>

You may also want to use a script. Just replace with your preferred sizes for the swap and system partitions:

DISK=/dev/sda
echo -e "g\nn\n\n\n+50M\nt\n4\nn\n\n\n+n\n\n\n\nt\n5\n29\nw" | fdisk $DISK

Copy the partition table to the second disk:

# copy the partition table from /dev/sda to /dev/sdb
sgdisk -R /dev/sdb /dev/sda
# copy the partition table from /dev/sda to /dev/sdc
sgdisk -R /dev/sdc /dev/sda
# regenerate UUID tables on sdb
sgdisk -G /dev/sdb
# regenerate UUID tables on sdc
sgdisk -G /dev/sdc

You can now create your RAID 5.

mdadm --create /dev/md0 --level=5 --raid-devices=3 --metadata=1.2 /dev/sda2 /dev/sdb2 /dev/sdc2

Wait for the array to be completed:

watch cat /proc/mdstat

System installation

Install Calculate Linux on RAID:

cl-install -D /dev/md0

Congratulations, your system has been installed! You may reboot now.

Data recovery

If a RAID component is down, booting your system may take much more time. The reason is that the bootloader waits for the RAID to be completed.

To add a disk, proceed as follows:

  • copy the partition table to the new disk(that is, from /dev/sda to /dev/sdb)
    sgdisk -R /dev/sdb /dev/sda
    sgdisk -G /dev/sdb
    
  • add the partition to the array
    mdadm /dev/md0 -a /dev/sdb2
    
  • wait for the RAID to be built
    watch cat /proc/mdstat
    

Note: If a disk is replaced with a bigger one, you can use the extra space to create new partitions.

Notification settings

You can configure your notification policy to be notified whenever your RAID fails.

Any SMTP mailer will do. We recommend nullmailer, supplied with Calculate Linux Desktop. To configure nullmailer, run:

emerge --config nullmailer

Then specify an operating SMTP server in /etc/nullmailer/remotes, as shown below:

smtp.example.org smtp

Now launch the nullmailer daemon and add it as an autostart job:

/etc/init.d/nullmailer start
rc-update add nullmailer

In /etc/mdadm.conf, add the addresses your mails will be sent from and to:

MAILADDR inbox@mail.address
MAILFROM outbox@mail.address

Send a test message to see if everything works:

mdadm --monitor /dev/md2 --test --oneshot

Constant RAID disk names

On a newly installed system, all disk names will be different from what they were at creation time. It doesn’t matter for bootup, as we in Calculate use UUIDs instead of boot addresses. Nevertheless, if you need specific naming, feel free to edit the /etc/mdadm.conf file:

mdadm --detail --scan >> /etc/mdadm.conf

Here is an example etc/mdadm.conf:

ARRAY /dev/md/0 metadata=1.2 name=calculate:0 UUID=70f5926c:34e9e21f:b54b65d6:938a99ab

As it must be called at bootup, you should add it to /etc/dracut.conf.d/mdadm.conf:

mdadmconf="yes" 

You may now reset the boot settings:

cl-setup-boot

softraid.gif (21.4 KB)


Comments

Thank you!