Software RAID + LVM2

Fredrik Eriksson fredrik.eriksson at axis.com
Wed Jan 19 14:25:10 CET 2011


Here we go again. I've been looking at our web proxy that seemed to fail 
randomly now and then, then I went sick and then I came back and 
upgraded the other web proxy to use that with our approx server etc... 
Anyways, I'm at our FAI configuration again.

Today I've upgraded our FAI server to 4.0~beta2+experimental50 and 
rebuilt the nfsroot I'm working with. We have a new disk_config that 
ought to correspond to our requirements

 disk_config disk1 bootable:1 preserve_lazy:1,2
 primary  -              512     -       -
 primary  -              0-      -       -
 
 disk_config disk2 bootable:1 preserve_lazy:1,2
 primary  -              512     -       -
 primary  -              0-      -       -
 
 disk_config raid preserve_lazy:0,1 always_format:0
 raid1        /boot   sda1,sdb1  ext4    rw,errors=remount-ro
 raid1        -       sda2,sdb2  -       -
 
 disk_config lvm preserve_lazy:vg0-home
 vg              vg0                   md1
 vg0-swap          swap                    4096        swap    rw
 vg0-local         /usr/local              10240       ext4    rw
 vg0-src           /usr/src                10240       ext4    rw
 vg0-usr           /usr                    10240       ext4    rw
 vg0-var           /var                    10240       ext4    rw
 vg0-tmp           /tmp                    2048        ext4    rw
 vg0-home          /home                   97280       ext4    rw
 vg0-root          /                       4096        ext4    
rw,errors=remount-ro

With this disk_config the system becomes unbootable, GRUB doesn't seem 
to install correctly so all you get when booting this system is a 
blinking cursor in the lower left corner.
In our PXE boot we have rescue-boot options with remote kernel and 
initrd image, with this it is kinda possible to boot the system. 
vg0-home is not preserved since the RAID isn't initialized prior to 
get_current_lvm.

Fredrik Eriksson wrote:
> when using these modifications
>
> --- /srv/fai/lennyroot64/live/filesystem.dir/usr/sbin/setup-storage    
> 2010-12-23 23:21:37.000000000 +0100
> +++ /srv/fai/squeezeroot64/live/filesystem.dir/usr/sbin/setup-storage    
> 2011-01-05 14:47:11.000000000 +0100
> @@ -135,8 +135,12 @@
>  # read the sizes and partition tables of all disks listed in $FAI::disks
>  &FAI::get_current_disks;
>  
> +# if they are on top of RAID we have to start mdadm first
> +system "/sbin/mdadm-startall";
>  # see whether there are any existing LVMs
>  &FAI::get_current_lvm;
> +# and stop mdadm
> +system "/etc/init.d/mdadm-raid stop";
>  
>  # see whether there are any existing RAID devices
>  &FAI::get_current_raid;
> @@ -177,7 +181,11 @@
>  $FAI::debug and print Dumper \%FAI::configs;
>  
>  # generate the command script
> -&FAI::build_disk_commands;
> +# build_disk_commands won't leave our partitions alone
> +#&FAI::build_disk_commands;
> +&FAI::push_command( "true", "" , "pt_complete_/dev/sda");
> +&FAI::push_command( "true", "" , "pt_complete_/dev/sdb");
> +
>  &FAI::build_raid_commands;
>  &FAI::build_lvm_commands;
>  &FAI::build_cryptsetup_commands;
>
>
> This seem to work as for preserving vg0-home and its contents and 
> everything gets installed, but makes the system unbootable, it cannot 
> find vg0 although the installation does.
>   
That is, it seems like it manages to preserve MBR with GRUB from a 
previously successful install but the initrd image doesn't seem to be 
built correctly, correct me if I'm wrong in my assumption here. We get 
our menu and it tries to boot but doesn't get further than this
>  Loading, please wait...
>    Volume group "vg0" not found
>    Skipping volume group vg0
>  Unable to find LVM volume vg0/root
>   
It is possible to boot with our rescue-mode here, with remote kernel and 
initrd image, but as earlier you have to press Ctrl-D to boot the system 
although, this time, vg0-home is preserved.

I've tried poking around at several different places in the 
setup-storage code but this is so far the closest we get to the 
functionality we're after, and perl isn't really my mother tongue since 
I haven't looked at it up until I started with this project. Personally 
I believe that I have to get my mind around the magic of 
build_disk_commands, that we just commented out and replaced with two 
lines, any pointers in the right direction are welcome.

I'll attach two log files. The format.log is  from an install without  
modifications to usr/sbin/setup-storage and format2.log is from an 
install with the modifications mentioned in the diff above.


Kind regards
--
Fredrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fredrike.vcf
Type: text/x-vcard
Size: 128 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20110119/ca4783c4/attachment.vcf>


More information about the linux-fai mailing list