📜 ⬆️ ⬇️

ArchLinux - Software RAID

Recently, I bought myself two Kingmax SMP35 SSDs with a capacity of 60 GB each. My father and I wrote down hardware RAID 1 using the motherboard and put the Eight (Windows) on them. Spat and demolished. I decided to try out the RAID in Linux and my choice fell on the arch (this is a less studied distr of all used by me). There will be no pictures under the cut, but I will post the conclusions of the programs (:

Hardware RAID vs. Software RAID


You probably already prepared for the test with a bunch of details, buns and gingerbread? However, everything is much simpler - the hardware array is not perceived in the archa as an array. That's it. So, make a software. Tests are conducted on the latest archa release with the pacstrap installation script. I will not give the whole installation process, but I will preserve the chronology and try to bring it to you.

Go!


Boot from the installation disk (flash drive). To begin with, we look at the output of the fdisk program in order to orient ourselves in the “tin”.
fdisk -l
Disk /dev/sda: 60.0 GB, 60022480896 bytes 81 heads, 63 sectors/track, 22973 cylinders, total 117231408 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x2d5689a5 Device Boot Start End Blocks Id System /dev/sda1 2048 117231407 58614680 fd Linux raid autodetect Disk /dev/sdb: 60.0 GB, 60022480896 bytes 81 heads, 63 sectors/track, 22973 cylinders, total 117231408 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0009e9af Device Boot Start End Blocks Id System /dev/sdb1 2048 117231407 58614680 fd Linux raid autodetect Disk /dev/sdc: 515 MB, 515899392 bytes 64 heads, 32 sectors/track, 492 cylinders, total 1007616 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x25086445 Device Boot Start End Blocks Id System /dev/sdc1 * 0 757759 378880 17 Hidden HPFS/NTFS Disk /dev/sdc1: 387 MB, 387973120 bytes 64 heads, 32 sectors/track, 370 cylinders, total 757760 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x25086445 Device Boot Start End Blocks Id System /dev/sdc1p1 * 0 757759 378880 17 Hidden HPFS/NTFS Disk /dev/mapper/arch_root-image: 707 MB, 707788800 bytes 255 heads, 63 sectors/track, 86 cylinders, total 1382400 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/arch_lib-modules: 98 MB, 98566144 bytes 255 heads, 63 sectors/track, 11 cylinders, total 192512 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/arch_usr-share: 438 MB, 438304768 bytes 255 heads, 63 sectors/track, 53 cylinders, total 856064 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes 

Find our SSD's (if you still haven't created partitions - it's about time. I used the Linux RAID Auto partition type, code is fd)
Next, create our software array:
')
 mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 


I created a mirror array, so the "level" is 1, and depending on the number of partitions in the array you change - -raid-devices

To the question whether we really want to create an array is answered in the affirmative. Done! It remains only to create a file system and mount a partition to install the system:
 mkfs.ext4 /dev/md0 mount /dev/md0 /mnt 

I created an ext4 file system, but you can create another. To see a list of all available fs write mkfs. and click tab.

System Setup and Boot Loader Configuration


According to the official manual, we put the system up to the “Install the bootloader” item. The whole problem is that the first is rude and does not support booting from a RAID array, but it is able to do the second. Therefore we write
 pacstrap /mnt grub2-bios 

Next, follow the same manual to the item "Creating a ramdisk'a . " The order is slightly different.
 grub-mkconfig -o /boot/grub/grub.cfg grub-install /dev/sda grub-install /dev/sdb mdadm --examine --scan >> /etc/mdadm.conf 

First, we generate a rough config, then put it on all the tins in the array, and then generate the config of the array itself. Next, add the array hook to the ramdisk config
 nano /etc/mkinitcpio.conf  HOOKS="- "     mdadm    : HOOKS="base udev autodetect pata scsi sata filesystems usbinput fsck mdadm" 

Next, we generate a ramdisk
 mkinitcpio -p linux 

If Custom /etc/mdadm.conf appears on the screen, it will be used in assembling arrays , it means that everything is fine (:
Exit the chroot , unmount the partition and reboot. After loading we check disks through fdisk -l
fdisk -l
 Disk /dev/sda: 60.0 GB, 60022480896 bytes 81 heads, 63 sectors/track, 22973 cylinders, total 117231408 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x2d5689a5 Device Boot Start End Blocks Id System /dev/sda1 2048 117231407 58614680 fd Linux raid autodetect Disk /dev/sdb: 60.0 GB, 60022480896 bytes 81 heads, 63 sectors/track, 22973 cylinders, total 117231408 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0009e9af Device Boot Start End Blocks Id System /dev/sdb1 2048 117231407 58614680 fd Linux raid autodetect Disk /dev/md0: 60.0 GB, 59987787776 bytes 2 heads, 4 sectors/track, 14645456 cylinders, total 117163648 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes 

Where md0 is the RAID array from which the system was booted

That's all! (: All good and good luck in your endeavors!

Thanks to user sergeyotro for correcting a semantic error.

Source: https://habr.com/ru/post/148601/


All Articles