How create RAID 1 on working Slackware 14.2?
by infernalcucumber from LinuxQuestions.org on (#4W3WN)
Hi! I use Slackware 14.2 (with kernel 4.4.14-smp) on sda and I'm trying to create the RAID 1 with additional sdb. I'm using the VM VirtualBox.
First, I have cleaned the sdb:
Code:dd if=/dev/zero of=/dev/sdb bs=8M count=1000and copied the sda's partitions to sdb:
Code:sfdisk -d /dev/sda | sfdisk /dev/sdbNext, I've changed the type of partitions to "Linux raid autodetect":
Code:Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 8390655 8388608 4G 82 Linux swap
/dev/sda2 * 8390656 113248255 104857600 50G 83 Linux
/dev/sda3 113248256 209715199 96466944 46G 5 Extended
/dev/sda5 113250304 144707583 31457280 15G 83 Linux
/dev/sda6 144709632 176166911 31457280 15G 83 Linux
/dev/sda7 176168960 209715199 33546240 16G 83 Linux
and
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 8390655 8388608 4G fd Linux raid autodetect
/dev/sdb2 * 8390656 113248255 104857600 50G fd Linux raid autodetect
/dev/sdb3 113248256 209715199 96466944 46G 5 Extended
/dev/sdb5 113250304 144707583 31457280 15G fd Linux raid autodetect
/dev/sdb6 144709632 176166911 31457280 15G fd Linux raid autodetect
/dev/sdb7 176168960 209715199 33546240 16G fd Linux raid autodetectFor each partition (md1,md2,md5,md6,md7), I did next:
Code:mdadm --create /dev/md1 --level=1 --metadata=0.90 --raid-disk=2 missing /dev/sdb1and made filesystems on created arrays:
Code:mkswap /dev/md1
mkreiserfs -fq /dev/md2
mkreiserfs -fq /dev/md5
mkreiserfs -fq /dev/md6
mkreiserfs -fq /dev/md7saved the raid configuration:
Code:mdadm --examine --scan >> /etc/mdadm.confNext, /etc/fstab and /etc/mtab were edited by replacing sdaX->mdX and the initial ramdisk were prepared:
Code:mkinitrd -c -k 4.4.14-smp -f reiserfs -r /dev/md2 -m reiserfs:dm-raid -u -o /boot/initrd_raid.gzConfigured the grub:
Code:cp /etc/grub.d/40_custom /etc/grub.d/09_swraid1_setupCode:#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Slackware-14.2 GNU/Linux' --class slackware-14.2 --class gnu-linux --class os {
insmod raid
insmod mdraid
insmod mdraid09
insmod mdraid1x
insmod gzio
insmod part_msdos
insmod reiserfs
set root='md2,msdos2'
echo 'Loading Linux 4.4.14-smp ...'
linux /boot/vmlinuz-huge-smp-4.4.14-smp root=/dev/md2 ro
echo 'Loading inital ramdisk ...'
initrd /boot/initrd_raid.gz
}I have edited the /etc/default/grub by uncomment:
Code:GRUB_TERMINAL=console
GRUB_DISABLE_LINUX_UUID=trueFinally:
Code:grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda/
grub-install /dev/sdb/And data were copied from sda to sdb (cp -dpRx / /mnt/md2 and etc.).
After rebooting I got error that raid.mod and mdraid.mod not found and device 'md2,msdos2' not found.
The question is: which modules should I add to initrd and how should I config the grub?
Thanks.


First, I have cleaned the sdb:
Code:dd if=/dev/zero of=/dev/sdb bs=8M count=1000and copied the sda's partitions to sdb:
Code:sfdisk -d /dev/sda | sfdisk /dev/sdbNext, I've changed the type of partitions to "Linux raid autodetect":
Code:Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 8390655 8388608 4G 82 Linux swap
/dev/sda2 * 8390656 113248255 104857600 50G 83 Linux
/dev/sda3 113248256 209715199 96466944 46G 5 Extended
/dev/sda5 113250304 144707583 31457280 15G 83 Linux
/dev/sda6 144709632 176166911 31457280 15G 83 Linux
/dev/sda7 176168960 209715199 33546240 16G 83 Linux
and
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 8390655 8388608 4G fd Linux raid autodetect
/dev/sdb2 * 8390656 113248255 104857600 50G fd Linux raid autodetect
/dev/sdb3 113248256 209715199 96466944 46G 5 Extended
/dev/sdb5 113250304 144707583 31457280 15G fd Linux raid autodetect
/dev/sdb6 144709632 176166911 31457280 15G fd Linux raid autodetect
/dev/sdb7 176168960 209715199 33546240 16G fd Linux raid autodetectFor each partition (md1,md2,md5,md6,md7), I did next:
Code:mdadm --create /dev/md1 --level=1 --metadata=0.90 --raid-disk=2 missing /dev/sdb1and made filesystems on created arrays:
Code:mkswap /dev/md1
mkreiserfs -fq /dev/md2
mkreiserfs -fq /dev/md5
mkreiserfs -fq /dev/md6
mkreiserfs -fq /dev/md7saved the raid configuration:
Code:mdadm --examine --scan >> /etc/mdadm.confNext, /etc/fstab and /etc/mtab were edited by replacing sdaX->mdX and the initial ramdisk were prepared:
Code:mkinitrd -c -k 4.4.14-smp -f reiserfs -r /dev/md2 -m reiserfs:dm-raid -u -o /boot/initrd_raid.gzConfigured the grub:
Code:cp /etc/grub.d/40_custom /etc/grub.d/09_swraid1_setupCode:#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Slackware-14.2 GNU/Linux' --class slackware-14.2 --class gnu-linux --class os {
insmod raid
insmod mdraid
insmod mdraid09
insmod mdraid1x
insmod gzio
insmod part_msdos
insmod reiserfs
set root='md2,msdos2'
echo 'Loading Linux 4.4.14-smp ...'
linux /boot/vmlinuz-huge-smp-4.4.14-smp root=/dev/md2 ro
echo 'Loading inital ramdisk ...'
initrd /boot/initrd_raid.gz
}I have edited the /etc/default/grub by uncomment:
Code:GRUB_TERMINAL=console
GRUB_DISABLE_LINUX_UUID=trueFinally:
Code:grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda/
grub-install /dev/sdb/And data were copied from sda to sdb (cp -dpRx / /mnt/md2 and etc.).
After rebooting I got error that raid.mod and mdraid.mod not found and device 'md2,msdos2' not found.
The question is: which modules should I add to initrd and how should I config the grub?
Thanks.