LVM and RAID support

Erik Rossen rossen at freesurf.ch
Wed Oct 22 17:15:43 CEST 2003


On Thu, Oct 16, 2003 at 04:28:18AM +0100, Sam Vilain wrote:
> I've added RAID support to setup_harddisks.  It involved a slight
> refactoring of the script, and I didn't check functionality for the
> features I'm not using (eg, logical partitions - keep reading for
> why).
...snip...
> The new setup_harddisks is at:
> 
>   http://vilain.net/linux/fai/setup_harddisks
> 
> Still to-do:
> 
>   a) integration with GRUB/LILO so that it installs to the correct
>      location

Using the below config file based on the example in your email, I get an
/etc/fstab that refers to /dev/hda?.  How do I fix it to refer to
/dev/md? instead?

-----------------------------------------------------------------------
# <type> <mountpoint> <size in mb> [mount options]     [;extra options]

disk_config hda
primary  /              256         rw,errors=remount-ro ; raid(1,md0)
primary  swap           1024        rw                   ; raid(1,md1)
primary  -              0-                               ; raid(1,md2)

disk_config hdc
primary  -              256         rw,errors=remount-ro ; raid(1,md0)
primary  -              1024        rw                   ; raid(1,md1)
primary  -              0-                               ; raid(1,md2)
-----------------------------------------------------------------------

>   b) LVM support.

Looking forward to that!

> Feedback most welcome.

I tried the above simple install this afternoon and I discovered that
the calls to sfdisk were dying because I did not have a /dev/hdb on my
system.  The first time sfdisk encounters a non-existant device, it
ends.  Here is what I hacked together to get going:


-----------------------------------------------------------------------
--- setup_harddisks.vilain	Wed Oct 22 12:30:55 2003
+++ setup_harddisks	Wed Oct 22 17:08:58 2003
@@ -466,7 +466,9 @@
     my @disks;
 
     # FIXME - hardcoded list required because util-linux is lame
-    $result = `sh -c "LC_ALL=C sfdisk /dev/sd[a-z] /dev/hd[a-z] -g -q" 2>&1`;
+    # ERIK: the following does not work because sfdisk stops the first time it encounters a non-existant disk
+    #$result = `sh -c "LC_ALL=C sfdisk /dev/sd[a-z] /dev/hd[a-z] -g -q" 2>&1`;
+    $result = `sh -c "LC_ALL=C sfdisk /dev/hd{a,c} -g -q" 2>&1`;
 
     foreach my $line(split(/\n/,$result)){
 
@@ -490,7 +492,9 @@
 
     say "Disks found: @disks";
 
-    $result = `sh -c "LC_ALL=C sfdisk -d -q /dev/sd[a-z] /dev/hd[a-z] " 2>&1`;
+    # ERIK: the following does not work because sfdisk stops the first time it encounters a non-existant disk
+    #$result = `sh -c "LC_ALL=C sfdisk -d -q /dev/sd[a-z] /dev/hd[a-z] " 2>&1`;
+    $result = `sh -c "LC_ALL=C sfdisk -d -q /dev/hd{a,c} " 2>&1`;
 
     my %parts;
 
@@ -579,7 +583,7 @@
 
     my $config_file = shift;
 
-    open (FILE, "$config_file") or die "error opening config file: $config_file; $!\n";
+    open (FILE, "<$config_file") or die "error opening config file: $config_file; $!\n";
 
     say "parsing config file: $config_file";
-----------------------------------------------------------------------
 

-- 
Erik Rossen                          ^    OpenPGP key: 2935D0B9
rossen at freesurf.ch                  /e\   "Use GnuPG, see the
http://people.linux-gull.ch/rossen  ---    black helicopters."




More information about the linux-fai mailing list