single HDD LVM convert to RAID1 without LVM Problems

Issues related to applications and software problems

single HDD LVM convert to RAID1 without LVM Problems

Postby mclien » 2012/03/02 10:34:49

I hav to change a running single HDD LVM to a (software) RAID1:

I started following this howto: (which isn't exactly what I want, because it ends up in a RAID with LVM):

I successfully did the following so far:

on the additional HDD I created a raid array with the first drive missing:
Code: Select all
cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb3[1]       
157291319 blocks super 1.2 [2/1] [_U] 
md0 : active raid1 sdb1[1]       
530101 blocks super 1.2 [2/1] [_U] 
unused devices: <none>


I transfered the content of /boot to /dev/md0 and the content of / to /dev/md1 using rsync (because the lvm commands obviously won't work here).
I created the initrd image and edited /boot/grub/menu.lst to boot from the rai partitions and do a failback to the running system:
default=0
fallback=1
timeout=5
#splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu
title CentOS RAID (2.6.32-220.4.2.el6.i686)
root (hd1,0)
kernel /vmlinuz-2.6.32-220.4.2.el6.i686 ro root=/dev/md1 rd_NO_LUKS LANG=en_US.UTF-8 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys crashkernel=auto quiet
initrd /initramfs-2.6.32-220.4.2.el6.i686.img-raid
title CentOS (2.6.32-220.4.2.el6.i686)
root (hd0,0)
kernel /vmlinuz-2.6.32-220.4.2.el6.i686 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto quiet rd_LVM_LV=VolGroup/lv_root rd_NO_DM
initrd /initramfs-2.6.32-220.4.2.el6.i686.img

But grub complains it can't mount the selected file system.

My guess is the transfer via rsync is not the best way and the filesystem is deprected.
Can anyone hint me how to get the filesystem trasnferd corrctly or who to repair the filesystem on the raid partition?

Thanks
mclien
 
Posts: 43
Joined: 2012/01/23 15:15:41

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby TrevorH » 2012/03/02 11:33:15

Make sure you have the latest version of dracut installed and, if you built your initrd with the older one, rebuild it. There's a bug in the 6.2 version of dracut that affects booting from RAID 1 with a missing device.
User avatar
TrevorH
Forum Moderator
 
Posts: 9166
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby mclien » 2012/03/02 13:20:47

So I build the initrd with dracut instead of mkinitrd?
and this:
Release : 256.el6_2.1
is the corrct version of dracut. (at least the last I get via yum)

EDIT:
here is the missing "e"
mclien
 
Posts: 43
Joined: 2012/01/23 15:15:41

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby pschaff » 2012/03/04 02:43:04

Yes and yes.
Code: Select all
# rpm -q dracut
dracut-004-256.el6_2.1.noarch
# cat /etc/redhat-release
CentOS release 6.2 (Final)
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby TrevorH » 2012/03/04 02:47:52

There's still an /sbin/mkinitrd executable but it's a wrapper and calls dracut to do the work.
User avatar
TrevorH
Forum Moderator
 
Posts: 9166
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby mclien » 2012/03/05 10:08:20

There must be still a mistake in my way to do it...
-I have setup my RAID as stated above
-I boot the existing LVm system from the first HDD
-mount the RAID system:
Code: Select all
[root@localhost ~]# mount /dev/md1 /mnt
[root@localhost ~]# mount /dev/md0 /mnt/boot

-update dracut
-use rsync to copy the content of the LVm to the raid partitions:
Code: Select all
rsync -vax / /mnt
rsync -vax /boot/ /mnt/boot

-chroot to the raidsystem:
Code: Select all
chroot /mnt

-use dracut to generate the initrd:
Code: Select all
dracut --mdadmconf --force /boot/initramfs-2.6.32-220.4.2.el6.i686.img-raid 2.6.32-220.4.2.el6.i686

-leave chroot
-edit /mnt/etc/fstab to this:
Code: Select all
[root@localhost ~]# cat /mnt/etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Feb 16 14:29:40 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/md1                /                       ext4    defaults        1 1
/dev/md0                /boot                   ext4    defaults        1 2
/dev/sdb2               swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

reboot

Still "Grub error 17: cannot mount selected partition"

So where is my mistake?
Thanks
mclien
 
Posts: 43
Joined: 2012/01/23 15:15:41

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby pschaff » 2012/03/05 19:04:55

What's in /boot/grub/grub.conf on /dev/md0?
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby mclien » 2012/03/06 08:49:11

you mean this: ?
Code: Select all
[root@localhost ~]# mount /dev/md1 /mnt
[root@localhost ~]# mount /dev/md0 /mnt/boot
[root@localhost ~]# cat /mnt/boot/grub/grub.conf
.....
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-220.4.2.el6.i686)         
root (hd0,0)         
kernel /vmlinuz-2.6.32-220.4.2.el6.i686 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 \
  KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys rd_NO_MD rd_LVM_LV=VolGroup/lv_swap
  SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto quiet rd_LVM_LV=VolGroup/lv_root rd_NO_DM         
initrd /initramfs-2.6.32-220.4.2.el6.i686.img


OK, thats not correct. But isn't that irrelevant, because I boot from the existing grub entry of the first HDD, which contains this:?
Code: Select all
default=0
fallback=1
timeout=5
#splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu

title CentOS RAID (2.6.32-220.4.2.el6.i686)         
root (hd1,0)         
kernel /vmlinuz-2.6.32-220.4.2.el6.i686 ro root=/dev/md1 LANG=en_US.UTF-8  KEYBOARDTYPE=pc \
  KEYTABLE=de-latin1-nodeadkeys crashkernel=auto quiet         
initrd /initramfs-2.6.32-220.4.2.el6.i686.img-raid

title CentOS (2.6.32-220.4.2.el6.i686)         
root (hd0,0)         
kernel /vmlinuz-2.6.32-220.4.2.el6.i686 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 \
  KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys rd_NO_MD rd_LVM_LV=VolGroup/lv_swap \
  SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto quiet rd_LVM_LV=VolGroup/lv_root rd_NO_DM         
initrd /initramfs-2.6.32-220.4.2.el6.i686.img-raid
[Moderator edit: Wrap long lines.]

Or didn't I get the mechanism of grub right?
mclien
 
Posts: 43
Joined: 2012/01/23 15:15:41

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby mclien » 2012/03/06 11:37:48

or could it be that grub doesn't supports ext4 on md devices, while it supports ext4 on /dev/sda ?
mclien
 
Posts: 43
Joined: 2012/01/23 15:15:41

Re: single HDD LVM convert to RAID1 without LVM Problems

Postby pschaff » 2012/03/06 13:47:42

GRUB will boot from ext4 on software RAID1. I can't spot the problem but you will need to boot from the RAID to accomplish your goal. I'd fix the GRUB entry of /dev/md0, make it the first disk, and if still having problems, then read:
http://wiki.centos.org/TipsAndTricks/TroubleshootGRUB
http://wiki.centos.org/TipsAndTricks/ReinstallGRUB
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Next

Return to CentOS 6 - Software Support

Who is online

Users browsing this forum: No registered users and 10 guests