LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-04-2019, 09:57 PM   #1
infernalcucumber
LQ Newbie
 
Registered: Dec 2019
Posts: 7

Rep: Reputation: Disabled
How create RAID 1 on working Slackware 14.2?


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=1000
and copied the sda's partitions to sdb:
Code:
sfdisk -d /dev/sda | sfdisk /dev/sdb
Next, 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
Code:
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 autodetect
For 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/sdb1
and made filesystems on created arrays:

Code:
mkswap /dev/md1
mkreiserfs -fq /dev/md2
mkreiserfs -fq /dev/md5
mkreiserfs -fq /dev/md6
mkreiserfs -fq /dev/md7
saved the raid configuration:

Code:
mdadm --examine --scan >> /etc/mdadm.conf
Next, /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.gz
Configured the grub:

Code:
cp /etc/grub.d/40_custom /etc/grub.d/09_swraid1_setup
#!/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=true
Finally:

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.
 
Old 12-08-2019, 07:46 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,345

Rep: Reputation: Disabled
At the time I post this, your post has been viewed 88 times but there have been no replies.

I believe this is because your post is quite confusing: it seems you haven't read the RAID How-Tos, and it also seems you've left out some information.

For instance:
Quote:
Originally Posted by infernalcucumber View Post
First, I have cleaned the sdb:

Code:
dd if=/dev/zero of=/dev/sdb bs=8M count=1000
Now, why would you do that? Surely, a new virtual disk is by definition empty?

Continuing on:
Quote:
Originally Posted by infernalcucumber View Post
and copied the sda's partitions to sdb:
Code:
sfdisk -d /dev/sda | sfdisk /dev/sdb
You mean you copied the partition table. It seems this procedure would also transfer the label ID of the source disk onto the destination disk, which is a bad idea if you want to have both disks connected to the same system.
Quote:
Originally Posted by infernalcucumber View Post
Next, I've changed the type of partitions to "Linux raid autodetect":
Quote:
Originally Posted by infernalcucumber View Post
For 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/sdb1
The fact that you're creating degraded mirror sets indicates that you want to copy existing data from the various partitions on /dev/sda and then add these partitions to the RAID sets afterwards, but why are you using metadata v0.90 for all the md devices?
Quote:
Originally Posted by infernalcucumber View Post
saved the raid configuration:

Code:
mdadm --examine --scan >> /etc/mdadm.conf
Next, /etc/fstab and /etc/mtab were edited by replacing sdaX->mdX
I'd just like to point out that this will only work if /etc/mdadm.conf is present in the initrd image.

The initrd boot script will indeed activate the RAID sets, but unless /etc/mdadm.conf is present, the RAID devices will be dynamically named using a particular numbering scheme, starting from /dev/md127 and counting downwards. This will obviously not match /etc/fstab on your root partition, so when the time comes for the startup script to remount root as read/write, it won't find root at all and you'll be unceremoniously dumped at a recovery console.

Consider using UUIDs or labels instead.

Also, you left out the part where you (presumably) transferred files from /dev/sdaX to the various md devices.
Quote:
Originally Posted by infernalcucumber View Post
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.gz
There are two issues with that command:

1. From man mkinitrd:
Code:
-R     This option adds RAID support to the initrd, if a static mdadm binary is available on the system.
2. dm-raid.ko has nothing to do with mdadm support. "dm" stands for "device mapper", aka LVM. The module you're looking for is called raid1.

I don't know how grub handles mdadm RAID sets, but it seems you've added more modules to grub.cfg than needed.

Last edited by Ser Olmy; 12-08-2019 at 07:47 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How create RAID 1 on working Slackware 14.2? infernalcucumber Slackware 11 12-08-2019 10:34 PM
Windows Raid-O install Virtualbox, will slackware install raid-o without raid driver? slkrover Slackware 1 03-01-2011 12:50 AM
LXer: Linux RAID Smackdown: Crush RAID 5 with RAID 10 LXer Syndicated Linux News 0 02-26-2008 09:40 PM
which raid level (RAID 5 or RAID 10) inspiredbymetal Linux - Server 4 11-25-2007 07:59 PM
HW RAID, fake-HW RAID or SW RAID? stromdal Linux - Hardware 5 08-10-2007 02:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration