Raid, reiserfs, and FAI

Paul Lussier pll at lanminds.com
Fri Jul 12 22:53:33 CEST 2002


In a message dated: Fri, 12 Jul 2002 14:00:12 EDT
James Russell said:

>Paul,
>
>Not sure if this would help, but maybe running the mkraid/mkreiserfs 
>commands under chroot. If it works, post the fix to the list. 

I did try this, but it proved to not be the problem.  
The script I ended up with is below.  It works, but is kind of a 
brute-force, in-elegant approach.  I'd like to make this type of 
thing a little more integrated with the base FAI.  

Currently, it appears at this point that the settup_harddisks
doesn't deal with /dev/mdX configurations.

Is this something that's being planned, or, something that's even 
desirable?  I'd be willing to hack setup_harddisks to recognize these 
devices, and create the raid set prior to formatting the meta-device
if that's the way to go.  Currently I have a very ugly hack of a 
scripts/CLASS/S## file which adds the line to the /etc/fstab, copies 
in the raidtab file, creates the raidset, and lays down the file 
system.  

However, it seems to me that this could all be done within 
setup_harddisks, no?

What do people think?  Where should this go?

Oh, another thing I had to do was add an  'apt-get -f install' as the 
last line of /fai/scripts/LAST because for some reason too many 
packages were being left only half-configured.  One them being 
the 'raidtools2' package.  As a result, the raid sets weren't being 
started at boot time and the file system wasn't being mounted.

Here's the script I ended up with /fai/scripts/CLASSNAME/
S01:

	#! /bin/sh

	echo "Adding \"/dev/md0 /huge reiserfs defaults  0 0\" to /etc/fstab"
	echo ""

	# This should probably be part of setup_harddisks
	cat >> $target/etc/fstab <<-EOF
	# generated by FAI/scripts/80GB_NODE/S01
	# Add meta-device in
	/dev/md0        /huge   reiserfs defaults       0       0

	EOF

	echo "Creating /huge"
	echo ""
	mkdir $target/huge || echo "Problem creating $target/huge"

	# Copy /etc/raidtab over
	echo ""
	fcopy /etc/raidtab
	echo ""


	# Create the raid device
	echo -n "Creating raid device using:"
	echo "$target/sbin/mkraid --really-force --configfile $target/etc/raidtab /dev/md0"
	echo ""

	$target/sbin/mkraid --really-force --configfile $target/etc/raidtab /dev/md0\ 
	|| echo "Problem creating raid set on /dev/md0 using $target/etc/raidtab"

	# Layout the file system
	echo "Attempting to create ReiserFS file system on /dev/md0"
	echo ""
	LC_ALL=C $target/sbin/mkreiserfs -f /dev/md0 ||
		echo "Problem creating ReiserFS on /dev/md0"

	# Start raid sets at boot time
	echo "Trying to get raid to start at boot time"
	echo ""

	chroot /tmp/target update-rc.d raid2 start 50 0 6 .
	chroot /tmp/target ln -s /etc/init.d/raid2 /etc/rcS.d/S25raid2

	echo "End of $0"

-- 

Seeya,
Paul




More information about the linux-fai mailing list