[PATCH] Software raid support for setup_harddisks

Sam Vilain sam at vilain.net
Mon Sep 4 00:59:46 CEST 2006


Cyril Bouthors wrote:
> I've made a patch to enhance setup_harddisks in order for it to
> support the creation of Software RAID partitions.
> 
> The file setup_harddisks_raid_support.patch is the patch against the
> latest SVN version. It is attached to this email.
> 
> 
> Here is the config file I've used:
> 
> disk_config hda
> primary  /boot         200         rw                   ;boot xfs
> primary  swap          500         rw
> primary  /             3000        rw                   ;xfs
> primary  -             3000-       rw                   ;raid
> 
> 
> Here is the output of my patched setup_harddisks:
> 
> setup_harddisks version 0.38fai
> Probing disks:  /dev/hda
> Disks found: hda
> 
> Using config file: /tmp/fileCCTlE4
> Creating partition table: LC_ALL=C sfdisk -q  /dev/hda < /tmp/partition.hda
> Creating file systems:
>   mkfs.xfs -f /dev/hda1
>   mkswap  /dev/hda2
>   mkfs.xfs -f /dev/hda3
> fsck 1.37 (21-Mar-2005)
> fsck 1.37 (21-Mar-2005)
> 
> 
> And the partition table after it:
> 
> myfai:~# fdisk -l
> 
> Disk /dev/hda: 10.0 GB, 10005037568 bytes
> 16 heads, 63 sectors/track, 19386 cylinders
> Units = cylinders of 1008 * 512 = 516096 bytes
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/hda1   *           1         407      205127+  83  Linux
> /dev/hda2             408        1423      512064   82  Linux swap / Solaris
> /dev/hda3            1424        7519     3072384   83  Linux
> /dev/hda4            7520       19386     5980968   fd  Linux raid autodetect
> 
> 
> I hope this would help. Please include it in the SVN version.
> 
> Thanks.
> 
> 
> ------------------------------------------------------------------------
> 
> *** /tmp/ediff8155Kyz	2006-08-28 18:13:06.563790650 +0300
> --- /home/cyb/cvs/myfai/lib/setup_harddisks	2006-08-28 18:08:57.377619578 +0300
> ***************
> *** 140,145 ****
> --- 140,146 ----
>   #     reiser       : reiserfs
>   #       -h <hash>  : set reiserfs hash
>   #       -v <ver>   : set reiserfs version
> + #     raid         : raid
>   #
>   use strict;
>   # getopts variables:
> ***************
> *** 501,507 ****
>   		      && die "ERROR: unable to preserve partitions of size 0.\n$line\n ";
>   		  } else {
>   		    # If not preserve we must know the filesystemtype
> ! 	            ($options !~ /\b(ext2|ext3|auto|swap|dosfat16|winfat32|reiser|xfs)\b/i ) && ($options .= " auto");
>   		  }
>   		if($size =~ /^(\d*)(\-?)(\d*)$/){
>   		    $Min = $1;
> --- 502,508 ----
>   		      && die "ERROR: unable to preserve partitions of size 0.\n$line\n ";
>   		  } else {
>   		    # If not preserve we must know the filesystemtype
> ! 	            ($options !~ /\b(ext2|ext3|auto|swap|dosfat16|winfat32|reiser|xfs|raid)\b/i ) && ($options .= " auto");
>   		  }
>   		if($size =~ /^(\d*)(\-?)(\d*)$/){
>   		    $Min = $1;
> ***************
> *** 532,537 ****
> --- 533,539 ----
>   		($options =~ /\bswap\b/i) && ($MPID{$mountpoint} = 82); # Linux swap
>   		($options =~ /\bdosfat16\b/i) && ($MPID{$mountpoint} = 6); # DOS FAT 16bit (>=32MB, will be changed later)
>   		($options =~ /\bwinfat32\b/i) && ($MPID{$mountpoint} = "b"); # Win 95 FAT 32
> + 		($options =~ /\braid\b/i) && ($MPID{$mountpoint} = "fd"); # Linux raid auto
>   		$MPOptions{$mountpoint} = $options;
>   		if($test == 1){
>   		    print "$mountpoint,$MPMinSize{$mountpoint}-$MPMaxSize{$mountpoint},";

Where are the RAID devices set up?

Note: there is a version I wrote in the people/mugwump/lvmraid branch.
Check Subversion for more.

Sam.



More information about the linux-fai mailing list