Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Linux RAID1 mdadm installation
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
umka69
Tux's lil' helper
Tux's lil' helper


Joined: 31 Mar 2013
Posts: 124

PostPosted: Wed Jul 16, 2014 4:47 pm    Post subject: Linux RAID1 mdadm installation Reply with quote

Hello. I've got problems during installation gentoo with software mirror raid.
It is like that i do something wrong. There are my steps. Where is a miss or a mistake?
Please help!)

Step 1. Boot gentoo minimal with default kernel and without dmraid support.
Code:
boot: gentoo nodmraid


Step 2. Disks prepare with fdisk util.
Code:
livecd ~ # fdisk -l

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x5a889236

Device    Boot     Start        End    Blocks  Id System
/dev/sda1           2048      22527     10240  fd Linux raid autodetect
/dev/sda2          22528     227327    102400  fd Linux raid autodetect
/dev/sda3         227328   17004543   8388608  fd Linux raid autodetect
/dev/sda4       17004544 1953525167 968260312   5 Extended
/dev/sda5       17006592  436436991 209715200  fd Linux raid autodetect
/dev/sda6      436439040 1953525167 758543064  fd Linux raid autodetect


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device    Boot     Start        End    Blocks  Id System
/dev/sdb1           2048      22527     10240  fd Linux raid autodetect
/dev/sdb2          22528     227327    102400  fd Linux raid autodetect
/dev/sdb3         227328   17004543   8388608  fd Linux raid autodetect
/dev/sdb4       17004544 1953525167 968260312   5 Extended
/dev/sdb5       17006592  436436991 209715200  fd Linux raid autodetect
/dev/sdb6      436439040 1953525167 758543064  fd Linux raid autodetect



Step 3. Creation of RAID1 devices with file systems.
Code:

livecd ~ # mknod /dev/md1 b 9 1
livecd ~ # mknod /dev/md2 b 9 2
livecd ~ # mknod /dev/md3 b 9 3
livecd ~ # mknod /dev/md5 b 9 5
livecd ~ # mknod /dev/md6 b 9 6
livecd ~ # mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1
mdadm: array /dev/md1 started.
livecd ~ # mdadm --create /dev/md2 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda2 /dev/sdb2
mdadm: array /dev/md2 started.
livecd ~ # mdadm --create /dev/md3 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda3 /dev/sdb3
mdadm: array /dev/md3 started.
livecd ~ # mdadm --create /dev/md5 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda5 /dev/sdb5
mdadm: array /dev/md5 started.
livecd ~ # mdadm --create /dev/md6 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda6 /dev/sdb6
mdadm: /dev/sda6 appears to contain an ext2fs file system
    size=758542976K  mtime=Mon Jul 14 19:50:15 2014
mdadm: /dev/sdb6 appears to contain an ext2fs file system
    size=758542976K  mtime=Mon Jul 14 19:50:15 2014
Continue creating array? y
mdadm: array /dev/md6 started.
livecd ~ # mdadm --detail --scan > /etc/mdadm.conf


Step 4. Installing base gentoo system and kernel with raid support.
Code:

...
(chroot) livecd linux # emerge gentoo-sources genkernel mdadm
(chroot) livecd linux # rc-update add mdadm  boot
(chroot) livecd linux # make menuconfig
(chroot) livecd linux # make && make modules_install
(chroot) livecd linux # make install
(chroot) livecd linux # genkernel --no-dmraid --mdadm --install initramfs
(chroot) livecd linux # cat .config | grep RAID
# CONFIG_RAID_ATTRS is not set
# CONFIG_MD_RAID0 is not set
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
CONFIG_MD_RAID456=y
CONFIG_DM_RAID=y
# CONFIG_ASYNC_RAID6_TEST is not set
CONFIG_ASYNC_RAID6_RECOV=y
CONFIG_RAID6_PQ=y
(chroot) livecd linux # cat /etc/fstab
/dev/md2                /boot           ext4            noatime         0 2
/dev/md5                /ext4            noatime         0 1
/dev/md6                /home           ext4            noatime         0 0
/dev/md3                none            swap            sw              0 0


Step 5. Installing Grub2 as a bootloader.
Code:

(chroot) livecd init.d # emerge sys-boot/grub
(chroot) livecd init.d # grub2-install /dev/sda
Installation finished. No error reported.
(chroot) livecd init.d # grub2-install /dev/sdb
Installation finished. No error reported.
(chroot) livecd init.d # grub2-mkconfig -o /boot/grub/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.12.21-gentoo-r1
Found initrd image: /boot/initramfs-genkernel-x86_64-3.12.21-gentoo-r1
done

livecd init.d # cat /boot/grub/grub.cfg
...
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-6e251fc3-2c86-4727-81ba-0cb1090c89bf' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod part_msdos
        insmod diskfilter
        insmod raid
        insmod mdraid09
        insmod ext4
        set root='mduuid/096ac3e2c49295a2cb201669f728008a'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/096ac3e2c49295a2cb201669f728008a'  00b27b7a-5ae8-4061-831b-7a538d2921ff
        else
          search --no-floppy --fs-uuid --set=root 00b27b7a-5ae8-4061-831b-7a538d2921ff
        fi
        echo    'Loading Linux 3.12.21-gentoo-r1 ...'
        linux   /vmlinuz-3.12.21-gentoo-r1 root=UUID=6e251fc3-2c86-4727-81ba-0cb1090c89bf ro
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-genkernel-x86_64-3.12.21-gentoo-r1
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-6e251fc3-2c86-4727-81ba-0cb1090c89bf' {
        menuentry 'Gentoo GNU/Linux, with Linux 3.12.21-gentoo-r1' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.21-gentoo-r1-advanced-6e251fc3-2c86-4727-81ba-0cb1090c89bf' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos
                insmod part_msdos
                insmod diskfilter
                insmod mdraid09
                insmod ext2
                set root='mduuid/096ac3e2c49295a2cb201669f728008a'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint='mduuid/096ac3e2c49295a2cb201669f728008a'  00b27b7a-5ae8-4061-831b-7a538d2921ff
                else
                  search --no-floppy --fs-uuid --set=root 00b27b7a-5ae8-4061-831b-7a538d2921ff
                fi
                echo    'Loading Linux 3.12.21-gentoo-r1 ...'
                linux   /vmlinuz-3.12.21-gentoo-r1 root=UUID=6e251fc3-2c86-4727-81ba-0cb1090c89bf ro
                echo    'Loading initial ramdisk ...'
                initrd  /initramfs-genkernel-x86_64-3.12.21-gentoo-r1
        }
        menuentry 'Gentoo GNU/Linux, with Linux 3.12.21-gentoo-r1 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.12.21-gentoo-r1-recovery-6e251fc3-2c86-4727-81ba-0cb1090c89bf' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos
                insmod part_msdos
                insmod diskfilter
                insmod mdraid09
                insmod ext2
                set root='mduuid/096ac3e2c49295a2cb201669f728008a'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint='mduuid/096ac3e2c49295a2cb201669f728008a'  00b27b7a-5ae8-4061-831b-7a538d2921ff
                else
                  search --no-floppy --fs-uuid --set=root 00b27b7a-5ae8-4061-831b-7a538d2921ff
                fi
                echo    'Loading Linux 3.12.21-gentoo-r1 ...'
                linux   /vmlinuz-3.12.21-gentoo-r1 root=UUID=6e251fc3-2c86-4727-81ba-0cb1090c89bf ro single
                echo    'Loading initial ramdisk ...'
                initrd  /initramfs-genkernel-x86_64-3.12.21-gentoo-r1
        }
}
...


Some necessary outputs
Code:

livecd init.d # ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root  9 Jul 16 23:09 00b27b7a-5ae8-4061-831b-7a538d2921ff -> ../../md2
lrwxrwxrwx 1 root root  9 Jul 16 23:09 6e251fc3-2c86-4727-81ba-0cb1090c89bf -> ../../md5
lrwxrwxrwx 1 root root 10 Jul 16 21:03 72D6-D690 -> ../../sdc1
lrwxrwxrwx 1 root root  9 Jul 16 23:09 7686f6be-809f-49ec-b693-254140ea7dc9 -> ../../md6
lrwxrwxrwx 1 root root  9 Jul 16 23:09 9fd5a34f-f885-41fb-b4c4-bb45e56dc086 -> ../../md3
livecd init.d # cat /etc/mdadm.conf
ARRAY /dev/md1 metadata=0.90 UUID=5e30276f:f96cba83:cb201669:f728008a
ARRAY /dev/md2 metadata=0.90 UUID=096ac3e2:c49295a2:cb201669:f728008a
ARRAY /dev/md3 metadata=0.90 UUID=a65eab69:c8e2fd42:cb201669:f728008a
ARRAY /dev/md5 metadata=0.90 UUID=9670f2c9:0616dffc:cb201669:f728008a
ARRAY /dev/md6 metadata=0.90 UUID=7844d426:9318bf39:cb201669:f728008a


I've got a root devuce UUID error while fist boot.

My moutpoints are
Code:
   efi /dev/md1 - efi bios (not in use now)
ext4 /dev/md2 - boot
ext4 /dev/md3 - swap
ext4 /dev/md5 - root
ext4 /dev/md6 - home

_________________
Make a wish, this text is magic. :)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43221
Location: 56N 3W

PostPosted: Wed Jul 16, 2014 5:41 pm    Post subject: Reply with quote

umka69,

umka69 wrote:
I've got a root devuce UUID error while fist boot.

The exact text of the error woud be useful.

How did you make your kernel and initramfs?

As you have used raid metadata version 0.09 and flagged the partitions as type fd, you con use kernel raid autoassembly or mdadm in the initramfs.
Which do you expect to use?

Do yo see any signs of the raid sets being assembled is the boot messages?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Wed Jul 16, 2014 7:15 pm    Post subject: Reply with quote

Code:
(chroot) livecd linux # cat /etc/fstab
/dev/md2                /boot           ext4            noatime         0 2
/dev/md5                /ext4            noatime         0 1
/dev/md6                /home           ext4            noatime         0 0
/dev/md3                none            swap            sw              0 0


md5 does not have a mount point.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43221
Location: 56N 3W

PostPosted: Wed Jul 16, 2014 7:35 pm    Post subject: Reply with quote

limn,

/ is a mount point meaning root.

This line
Code:
/dev/md5                /ext4            noatime         0 1
is incorrect as you need some whitespace between the / and the filesystem type.

I have
Code:
UUID=bcd0b621-2027-4471-ac26-99c5f95ee2d3               /               ext4            noatime,discard         0 1
as I use UUIDs everywhere. Thats my /etc/fstab entry for root.
Your system has not got as far as reading /etc/fstab as that is on the root filesystem and your error occurs before root is mounted.

Please answer my original questions.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
umka69
Tux's lil' helper
Tux's lil' helper


Joined: 31 Mar 2013
Posts: 124

PostPosted: Wed Jul 16, 2014 8:07 pm    Post subject: Reply with quote

NeddySeagoon wrote:
umka69,

How did you make your kernel and initramfs?

As you have used raid metadata version 0.09 and flagged the partitions as type fd, you con use kernel raid autoassembly or mdadm in the initramfs.
Which do you expect to use?

Do yo see any signs of the raid sets being assembled is the boot messages?


Kernel was generated by following commands with those .config file:
Code:
(chroot) livecd linux # emerge gentoo-sources genkernel mdadm
(chroot) livecd linux # rc-update add mdadm  boot
(chroot) livecd linux # make menuconfig
(chroot) livecd linux # make && make modules_install
(chroot) livecd linux # make install
(chroot) livecd linux # cat .config | grep RAID
# CONFIG_RAID_ATTRS is not set
# CONFIG_MD_RAID0 is not set
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
CONFIG_MD_RAID456=y


I used --mdadm option for initramfs.
Code:
(chroot) livecd linux # genkernel --no-dmraid --mdadm --install initramfs


My mistake be like:
Code:
!! Could not find the root block device in UUID=6e251fc3-2c86-4727-81ba-0cb1090c89bf
!! Pleace spacefi another value or:
!! - press Enter for the same
!! - type "shell" for a shell
!! - type "q" to skeep
root block device(UUID=6e251fc3-2c86-4727-81ba-0cb1090c89bf) ::

_________________
Make a wish, this text is magic. :)
Back to top
View user's profile Send private message
umka69
Tux's lil' helper
Tux's lil' helper


Joined: 31 Mar 2013
Posts: 124

PostPosted: Wed Jul 16, 2014 10:16 pm    Post subject: Reply with quote

WIN! I've got it. :D
It seems like a bug of grub2-mkconfig.
You need to edit /boot/grub/grub.cfg file to solve the problem.
There is no domdadm option for kernel in autogenerated one.
Just add this one to kernel options, like here:
Code:

# cat /boot/grub/grub.cfg
...
linux   /vmlinuz-3.12.21-gentoo-r1 root=UUID=6e251fc3-2c86-4727-81ba-0cb1090c89bf ro domdadm
...

Is it realy bug? Bugrepost maybe?
_________________
Make a wish, this text is magic. :)
Back to top
View user's profile Send private message
vaxbrat
l33t
l33t


Joined: 05 Oct 2005
Posts: 731
Location: DC Burbs

PostPosted: Thu Jul 17, 2014 1:28 am    Post subject: Don't do it there Reply with quote

You don't need to edit the grub.cfg file directly. Just uncomment and put it here in your /etc/default/grub file:

Code:
# Append parameters to the linux kernel command line
#GRUB_CMDLINE_LINUX=""
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum