Parliamo ora di Raid hardware ... fai una ricerca sull'argomento e dove capiti ? ... ovviamente su
slacky.eu ...
ho aggiornato allora lo script per la ramusb.igz per avviare una Slackware installata su una partizione Raid hardware, anche se, come si evince dall'articolo di cui sopra, spesso si tratta di un fakeraid gestito via software da un driver (proprietario in Windows, attraverso l'utility dmraid in Linux) ... il nuovo script allora aggiunge questo dmraid alla ramdisk, scaricandolo proprio da Slacky ... il tgz contiene una versione statica, ottimo !
Slackware 12.2 installato ha tutto ciò che serve per gestire questi fakeraid, anche il kernel huge-smp ha incorporati i moduli dm-mod e dm-mirror, moduli che gestiscono l'array di dischi creando non solo i devices in /dev/mapper ma anche /dev/dm-0 (l'intero disco), /dev/dm-1,/dev/dm-2,ecc. (le varie partizioni) ... problema: il DVD di Slackware non gestisce invece queste cose, il kernel crea il /dev/mapper, ma poi manca l'applicativo dmraid ! ... io ho usato altri tool (ovviamente), però è sicuramente possibile portarsi dietro il binario dmraid.static su una pennina USB ed eseguirlo da lì ... "dmraid -ay" crea immediatamente i devices in /dev/mapper/, un "mdev -s" successivo fa "apparire" anche i vari /dev/md-x (che si vedonono anche in /proc/partitions) ...
attivato il device raid (mettiamo che i dischi siano nuovi di fabbrica) un semplice "fdisk /dev/md-0" (o cfdisk) vi permetterà di creare le partizioni ...
le cose non sono proprio semplicissime, per esempio l'installazione si completa perfettamente sul disco raid, ma poi Lilo si rifiuta di riconoscere qualsiasi cosa che si chiami /dev/md-x ... soluzione: installare due Lilo, uno sul disco sda, uno sul disco sdb (i due dischi fisici che compongono l'array nel mio caso) ... quindi "dmraid -an" per "spegnere" l'array e quindi un mcedit sui due lilo.conf (e poi lilo) ... uno dei due lilo.conf (con il kernel 2.6.29.2 aggiunto):
Codice: Seleziona tutto
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
lba32 # Allow booting past 1024th cylinder with a recent BIOS
append=" vt.default_utf8=0"
boot = /dev/sda
bitmap = /boot/slack.bmp
bmp-colors = 255,0,255,0,255,0
bmp-table = 60,6,1,16
bmp-timer = 65,27,0,255
prompt
timeout = 60
compact
large-memory
# Linux bootable partition config begins
image=/boot/vmlinuz-huge-smp-2.6.29.2-smp
initrd=/boot/ramusb.igz
append="DMRAID root=/dev/dm-3 ro"
#root = /dev/sda3
label = Linux26292
read-only
image=/boot/vmlinuz-huge-smp-2.6.27.7-smp
initrd=/boot/ramusb.igz
append="DMRAID root=/dev/dm-3 ro"
#root = /dev/sda3
label = Linux26277
read-only
# Linux bootable partition config ends
Importante: /etc/fstab deve contenere una riga che descrive il filesystem "/" altrimenti lo script "rc.S" va in loop continuo di fsck ... mah !
questo lo script per la ramusb.igz:
Codice: Seleziona tutto
#!/bin/sh
# *** Makeramusb-slack *** copyleft (!C) FZ
# *** rev 0.5 - 05/03/2009 - fakeraid support added
echo "Removing previous structure and files ..."
#--------------------------------------------------------
rm -Rf work
rm -Rf initrd-tree
echo "Getting mkinitrd busybox ..."
#--------------------------------------------------------
if [ ! -f ./initrd-tree.tar.gz ] ; then
cp -f /usr/share/mkinitrd/initrd-tree.tar.gz .
fi
if [ -f ./initrd-tree.tar.gz ] ; then
mkdir -p initrd-tree
tar -C initrd-tree -xzplf initrd-tree.tar.gz
else
echo "
./initrd-tree.tar.gz not found
/usr/share/mkinitrd/initrd-tree.tar.gz not found
get and install mkinitrd package ... exit
"
exit
fi
echo "Getting dmraid ..."
#--------------------------------------------------------
if [ ! -f ./dmraid-1.0.0.rc13-i486-1bl.tgz ] ; then
wget -c http://repository.slacky.eu/slackware-11.0/system/dmraid/1.0.0.rc13/dmraid-1.0.0.rc13-i486-1bl.tgz .
fi
if [ -f ./dmraid-1.0.0.rc13-i486-1bl.tgz ] ; then
mkdir -p dmraid-tree
tar -C dmraid-tree -xzplf dmraid-1.0.0.rc13-i486-1bl.tgz
else
echo "
./dmraid-1.0.0.rc13-i486-1bl.tgz not found
get and install dmraid package ... exit
"
exit
fi
echo "Creating the folder structure ..."
#--------------------------------------------------------
mkdir -p work/initramfs/{dev,bin,sbin,etc,proc,sys,newroot,usr,usr/bin,usr/sbin}
#Create device nodes
mknod work/initramfs/dev/null c 1 3
mknod work/initramfs/dev/tty c 5 0
mknod work/initramfs/dev/console c 5 1
cp -f ./initrd-tree/bin/busybox ./work/initramfs/bin/
cp -f ./dmraid-tree/sbin/dmraid.static ./work/initramfs/bin/dmraid
cd work
touch initramfs/etc/mdev.conf
chmod +x initramfs/bin/busybox
ln -s busybox initramfs/bin/sh
echo "Creating a init script"
#--------------------------------------------------------
echo '#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
#Mount things needed by this script
busybox mount -t proc proc /proc
busybox mount -t sysfs sysfs /sys
#Create all the symlinks to /bin/busybox
/bin/busybox --install -s
touch /etc/mtab
#Disable kernel messages from popping onto the screen
echo 0 > /proc/sys/kernel/printk
#Clear the screen
clear
echo
echo
echo "------------------------------------"
echo " **** FaZo Boot v 0.5 **** "
echo " with dmraid function "
echo "------------------------------------"
echo
echo /bin/mdev > /proc/sys/kernel/hotplug
#Scan for devices
mdev -s
#Defaults
init="/sbin/init"
root="/dev/sda1"
HD_FOUND=
#Get USB-disk SIGNATURE
USB_LABEL=
COMMAND_LINE=`cat /proc/cmdline`
#adjust command line, remove white spaces, etc.
COMMAND_LINE=`echo $COMMAND_LINE | sed s/\s+//`
COMMAND_LINE=`echo $COMMAND_LINE | sed "s/ =/=/g"`
COMMAND_LINE=`echo $COMMAND_LINE | sed "s/= /=/g"`
R_RW_OPT="-r"
FS_TYPE=""
ROOTDEV=""
#Parse 12 option parameters
#------------------------------------------------
for i in 1 2 3 4 5 6 7 8 9 10 11 12
do
OPTION=`echo "$COMMAND_LINE" | cut -d" " -f$i`
PARAM=`echo "$OPTION" | cut -d"=" -f1`
VALUE=`echo "$OPTION" | cut -d"=" -f2`
#Test ro|rw mount option
case "$OPTION" in
"ro" | "read-only") R_RW_OPT="-r";;
"rw" | "read-write") R_RW_OPT="-w";;
"dmraid" | "DMRAID")
echo "Enable dmraid fakeraid-devices ..."
dmraid -ay
mdev -s
;;
esac
#Test fs type
if [ "a$PARAM" = "arootfstype" ] ; then
FS_TYPE="-t $VALUE"
fi
#Test root device
if [ "a$PARAM" = "aroot" ] ; then
ROOTDEV="$VALUE"
fi
if [ "a$PARAM" = "aUSB_DISK_SIGNATURE" ] ; then
USB_LABEL=$VALUE
fi
done
export R_RW_OPT=$R_RW_OPT
export FS_TYPE=$FS_TYPE
export ROOTDEV=$ROOTDEV
export IFS=`echo -ne " \t\n"`
#Search for disk signature in HDs
#------------------------------------------------
if [ "a$USB_LABEL" != "a" ] ; then
#Try to mount USB-disk
echo -n "Searching disk signature: $USB_LABEL "
#Rescan for new devices
mdev -s
#Try to mount all HD devices
#---------------------------------------------
ls -1 /dev/hd* 2> /dev/null |
while
read TRY_DISK
do
mount $R_RW_OPT $FS_TYPE $TRY_DISK /newroot 1> /dev/null 2> /dev/null
if [ -e /newroot/$USB_LABEL ] ; then
echo "$USB_LABEL --> HARD DISK $TRY_DISK found"
HD_FOUND="yes"
break
fi
umount $TRY_DISK 2> /dev/null
done
fi
#Search for disk signature in SDs
#------------------------------------------------
if [ "a$USB_LABEL" != "a" ] && [ "a$HD_FOUND" = "a" ] ; then
#Try to mount USB-disk
n=0
#Repeat test 10 times
while [ $n -le 9 ]
do
#Rescan for new devices
mdev -s
#Try to mount all sd devices
#---------------------------------------------
ls -1 /dev/sd* 2> /dev/null |
while
read TRY_DISK
do
mount $R_RW_OPT $FS_TYPE $TRY_DISK /newroot 1> /dev/null 2> /dev/null
if [ -e /newroot/$USB_LABEL ] ; then
echo
echo "$USB_LABEL found in --> $TRY_DISK"
echo
break
fi
umount $TRY_DISK 2> /dev/null
done
#---------------------------------------------
if [ -e /newroot/$USB_LABEL ] ; then
break
fi
sleep 1
let n=$n+1
echo -n "."
done
echo " done."
fi
IS_ROOT_MOUNTED=`mount | grep /newroot`
#Check if device with LABEL is mounted
#-------------------------------------
if [ "a$USB_LABEL" != "a" ] ; then
if [ "a$IS_ROOT_MOUNTED" != "a" ] ; then
#try also to mount USB_SIGNATURE_FILE as loop device
#---------------------------------------------------
if [ -f /newroot/$USB_LABEL ] ; then
mount /newroot/$USB_LABEL /newroot -o loop 1> /dev/null 2> /dev/null
fi
else
echo "Error: disk signature <<$USB_LABEL>> not found !!!"
fi
fi
#If nothing mounted try root= parameter
#------------------------------------------------
if [ "a$IS_ROOT_MOUNTED" = "a" ] && [ "a$ROOTDEV" != "a" ] ; then
echo "Try to mount append device root=$ROOTDEV ..."
mount $R_RW_OPT $FS_TYPE $ROOTDEV /newroot 1> /dev/null 2> /dev/null
fi
IS_ROOT_MOUNTED=`mount | grep /newroot`
#If nothing mounted ... ask
#------------------------------------------------
if [ "a$IS_ROOT_MOUNTED" = "a" ] ; then
echo "Error: root device not mounted ..."
echo -n "give me another device to try (ex: /dev/sda1) : "
read ALT_DEVICE
echo "mount $R_RW_OPT $FS_TYPE $ALT_DEVICE /newroot"
mount $R_RW_OPT $FS_TYPE $ALT_DEVICE /newroot 1> /dev/null 2> /dev/null
fi
#Check if $init exists and is executable
#------------------------------------------------
#check if perform chroot to /pathname, before
if [ -d /newroot/$USB_LABEL ] && [ -x "/newroot/$USB_LABEL/${init}" ] ; then
#Unmount all other mounts so that the ram used by
#the initramfs can be cleared after switch_root
umount /sys /proc
#Switch to the new root and execute init
mount -o bind /newroot/$USB_LABEL /newroot
exec switch_root /newroot "${init}"
fi
if [[ -x "/newroot/${init}" ]] ; then
#Unmount all other mounts so that the ram used by
#the initramfs can be cleared after switch_root
umount /sys /proc
#Switch to the new root and execute init
exec switch_root /newroot "${init}"
fi
#This will only be run if the exec above failed
echo "Failed to switch_root, dropping to a shell"
exec sh' > initramfs/init
chmod +x initramfs/init
echo "Creating the .cpio and .igz ..."
#--------------------------------------------------------
cd initramfs
find . | cpio -H newc -o > ../ramusb.cpio
cd ..
cat ramusb.cpio | gzip > ramusb.igz
echo "Done."
più o meno ho detto tutto, il resto a vostra fantasia ... prossima mossa: ramusb.igz con supporto raid software ...