![]() |
HowTo.Raid1DiversionScripts6 HistoryHide minor edits - Show changes to markup February 09, 2009, at 06:57 PM
by --
Changed line 62 from:
echo "Raid 1 up" to:
echo "Raid 1 up - Root mirror is synchronised" Changed line 68 from:
echo "Raid 1 up" to:
echo "Raid 1 up - Root mirror isn't synchronised - give up and boot" February 09, 2009, at 06:55 PM
by -- reference to lcd not applicable to others hardware
Deleted lines 12-14:
/usr/sbin/lcd_cls /usr/sbin/lcd_top Checking /usr/sbin/lcd_bot Raid Status February 09, 2009, at 06:54 PM
by --
Changed lines 3-4 from:
Needs to go into /initrd/unslung to:
Needs to go into /initrd/unslung (linuxrc.raid script replaced with updated one 9/2/2009 Bullfrog) Changed lines 11-15 from:
to:
/usr/sbin/lcd_cls /usr/sbin/lcd_top Checking /usr/sbin/lcd_bot Raid Status Changed line 30 from:
cnt=25 to:
cnt=125 Changed line 34 from:
to:
Changed line 36 from:
to:
Changed lines 38-40 from:
to:
Changed lines 42-51 from:
/unslung/mdadm --misc --test --detail /dev/md1 >/dev/null
err=$?
echo "$err"
[ $? ] && echo "synced"
[ ! $? ] && echo "not synced"
to:
/unslung/mdadm --detail /dev/md1 2>&1 |grep "appear to be active"; err2=$ ? /unslung/mdadm --detail /dev/md1 2>&1 |grep "Rebuild Status"; err=$?
/unslung/mdadm --detail /dev/md1 2>&1 |grep "faulty removed"; err3=$?
[ "$err3" = "0" ] && err="0"
if [ "$err2" = "0" ]
then
echo " "
echo "No disks"
cnt=1
else
if [ "$err" = "1" ]
then
echo " "
echo "Raid 1 up"
cnt=1
fi
if [ "$err3" = "0" ]
then
echo " "
echo "Raid 1 up"
cnt=1
fi
Added line 92:
Changed lines 95-98 from:
# indicate to calling linuxrc that /mnt is mounted
return 0 to:
# indicate to calling linuxrc that /mnt is mounted
Deleted line 103:
July 17, 2006, at 09:28 AM
by --
Changed line 46 from:
to:
July 17, 2006, at 09:26 AM
by --
Changed lines 10-12 from:
echo -e "running linuxrc.raid \r\n" to:
echo "/initrd/initrd/unslung/linuxrc.raid"
Changed line 24 from:
cat /proc/mdstat to:
# cat /proc/mdstat Changed line 26 from:
cnt=140 to:
cnt=25 Changed lines 30-31 from:
cat /proc/mdstat
/unslung/mdadm --misc --test /dev/md1
to:
/unslung/mdadm --misc --test --detail /dev/md1 >/dev/null Added lines 46-47:
Added line 50:
echo "loop finished" Changed lines 60-62 from:
Set_Led ready & to:
killall Set_Led >/dev/null 2>/dev/null
echo "attempt mount" Changed lines 68-69 from:
return 1 to:
return 0 Changed lines 73-75 from:
return 0 to:
return 1 July 17, 2006, at 09:02 AM
by --
Changed line 8 from:
to:
July 17, 2006, at 09:01 AM
by --
Changed lines 11-25 from:
HOSTNAME=`hostname` /usr/sbin/CheckResetButton? 2>/dev/null /usr/sbin/CheckPowerButton? 2>/dev/null /usr/sbin/do_umount 2>/dev/null /bin/chmod 775 /share 2>/dev/null /bin/chown admin.everyone /share/hdd/ 2>/dev/null /bin/chown admin.everyone /share 2>/dev/null /etc/rc.d/rc.quota 2>/dev/null /usr/sbin/init_media 2>/dev/null
to:
echo -e "running linuxrc.raid \r\n" mounted= /bin/mknod /dev/md4 b 9 4 2>/dev/null /sbin/insmod /unslung/md.o /sbin/insmod /unslung/raid1.o if [ -f /unslung/mdadm.conf ] ; then /unslung/mdadm --assemble --scan --config=/unslung/mdadm.conf
/bin/echo "Sleeping while root mirror resyncs..."
cat /proc/mdstat
Set_Led rs_blinking &
cnt=140
while [ $cnt -gt 0 ] ; do
echo -ne "\r$cnt "
sleep 1
cat /proc/mdstat
/unslung/mdadm --misc --test /dev/md1
err=$?
echo "$err"
[ $? ] && echo "synced"
[ ! $? ] && echo "not synced"
cnt=`expr $cnt - 1`
done
else
echo "user is still configuring raid setup"
sleep 3
/unslung/mdadm -A /dev/md4 -R /dev/sda4
/unslung/mdadm -A /dev/md3 -R /dev/sda3
/unslung/mdadm -A /dev/md2 -R /dev/sda2
/unslung/mdadm -A /dev/md1 -R /dev/sda1
fi Set_Led ready & if /bin/mount -rt ext3 /dev/md1 /mnt ; then echo "mounted /md1 as /mnt ==============" >/dev/console
mounted=/mnt
# indicate to calling linuxrc that /mnt is mounted
return 1
fi
Added line 57:
July 17, 2006, at 09:00 AM
by --
Deleted lines 4-5:
The rest are standard Diversion scripts Changed line 8 from:
to:
Added lines 11-39:
HOSTNAME=`hostname` /usr/sbin/CheckResetButton? 2>/dev/null /usr/sbin/CheckPowerButton? 2>/dev/null /usr/sbin/do_umount 2>/dev/null /bin/chmod 775 /share 2>/dev/null /bin/chown admin.everyone /share/hdd/ 2>/dev/null /bin/chown admin.everyone /share 2>/dev/null /etc/rc.d/rc.quota 2>/dev/null /usr/sbin/init_media 2>/dev/null
return 0 =] (:tableend:) The rest are standard Diversion scripts (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) [=
July 17, 2006, at 08:59 AM
by --
Added lines 1-6:
Technically the first one isn't a Diversion script Needs to go into /initrd/unslung The rest are standard Diversion scripts July 17, 2006, at 08:46 AM
by --
Changed line 224 from:
to:
Changed lines 227-289 from:
chdir / /bin/cp /etc/passwd /opt/etc/passwd /bin/echo "Stopping Optware Packages (/unslung/rc.halt):"; ( . /etc/rc.d/rc.optware-stop ) /bin/echo "continuing" /bin/killall sshd 2>/dev/null /opt/etc/init.d/S80thttpd stop /bin/killall -2 upnpd 2>/dev/null
/bin/killall crond 2>/dev/null
/sbin/ifdown ixp0
/bin/killall nmbd 2>/dev/null /bin/killall smbd 2>/dev/null /bin/killall ample 2>/dev/null /bin/killall mms 2>/dev/null /bin/killall mt-daapd 2>/dev/null
/usr/bin/quotaoff -a
/bin/killall -SIGUSR2? thttpd 2>/dev/null /bin/sleep 2
/bin/umount /var.state 2>/dev/null /bin/umount /var 2>/dev/null /bin/umount /share/flash/conf 2>/dev/null /bin/umount /share/hdd/data/public 2>/dev/null /bin/umount /public 2>/dev/null /bin/umount /share/flash/data 2>/dev/null /bin/umount /share/hdd/conf 2>/dev/null /bin/umount /share/hdd/data 2>/dev/null /sbin/swapoff /dev/sda3 2>/dev/null /sbin/swapoff /dev/sdb3 2>/dev/null /sbin/swapoff /dev/md3 2>/dev/null
/opt/sbin/mdadm -Ss --config=/opt/etc/mdadm.conf /bin/sleep 3
/bin/mount -o remount,ro /dev/root / /bin/umount /proc/bus/usb /bin/umount /proc echo "waiting 15 seconds" /bin/sleep 15 /sbin/halt-test &>/dev/null /bin/sleep 2 /sbin/halt-test &>/dev/null echo "waiting 15 seconds for disk write cache to flush" /bin/sleep 15 to:
HOSTNAME=`hostname` /usr/sbin/CheckResetButton? 2>/dev/null /usr/sbin/CheckPowerButton? 2>/dev/null /usr/sbin/do_umount 2>/dev/null /bin/chmod 775 /share 2>/dev/null /bin/chown admin.everyone /share/hdd/ 2>/dev/null /bin/chown admin.everyone /share 2>/dev/null /etc/rc.d/rc.quota 2>/dev/null /usr/sbin/init_media 2>/dev/null
July 17, 2006, at 08:45 AM
by --
Added lines 220-293:
(:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.halt #!/bin/sh chdir / /bin/cp /etc/passwd /opt/etc/passwd /bin/echo "Stopping Optware Packages (/unslung/rc.halt):"; ( . /etc/rc.d/rc.optware-stop ) /bin/echo "continuing" /bin/killall sshd 2>/dev/null /opt/etc/init.d/S80thttpd stop /bin/killall -2 upnpd 2>/dev/null # Stop cron job daemon /bin/killall crond 2>/dev/null # Switch off ethernet interface /sbin/ifdown ixp0 # Stop Samba /bin/killall nmbd 2>/dev/null /bin/killall smbd 2>/dev/null /bin/killall ample 2>/dev/null /bin/killall mms 2>/dev/null /bin/killall mt-daapd 2>/dev/null # turn off quotas /usr/bin/quotaoff -a # Stop webserver /bin/killall -SIGUSR2 thttpd 2>/dev/null /bin/sleep 2 # Unmount all drives /bin/umount /var.state 2>/dev/null /bin/umount /var 2>/dev/null /bin/umount /share/flash/conf 2>/dev/null /bin/umount /share/hdd/data/public 2>/dev/null /bin/umount /public 2>/dev/null /bin/umount /share/flash/data 2>/dev/null /bin/umount /share/hdd/conf 2>/dev/null /bin/umount /share/hdd/data 2>/dev/null /sbin/swapoff /dev/sda3 2>/dev/null /sbin/swapoff /dev/sdb3 2>/dev/null /sbin/swapoff /dev/md3 2>/dev/null # Stop RAID arrays # We will not be able to stop the root drive # But thats OK because we resync it at startup /opt/sbin/mdadm -Ss --config=/opt/etc/mdadm.conf /bin/sleep 3 # doing reverse of '/etc/rc' script /bin/mount -o remount,ro /dev/root / /bin/umount /proc/bus/usb /bin/umount /proc echo "waiting 15 seconds" /bin/sleep 15 /sbin/halt-test &>/dev/null /bin/sleep 2 /sbin/halt-test &>/dev/null echo "waiting 15 seconds for disk write cache to flush" /bin/sleep 15 return 0 (:tableend:) July 17, 2006, at 08:44 AM
by --
Changed lines 156-157 from:
/bin/echo "Stopping Unslung packages"; ( . /etc/rc.d/rc.unslung-stop ) to:
/bin/echo "Stopping Optware Packages (/unslung/rc.halt):"; ( . /etc/rc.d/rc.optware-stop ) /bin/echo "continuing" Changed lines 172-175 from:
to:
/bin/killall ample 2>/dev/null /bin/killall mms 2>/dev/null /bin/killall mt-daapd 2>/dev/null Changed lines 207-209 from:
to:
echo "waiting 15 seconds" /bin/sleep 15 Changed lines 213-217 from:
to:
echo "waiting 15 seconds for disk write cache to flush" /bin/sleep 15 return 0 July 17, 2006, at 08:43 AM
by --
Added line 87:
July 17, 2006, at 08:41 AM
by --
Deleted line 86:
Changed lines 92-93 from:
/bin/echo "Stopping Unslung packages"; ( . /etc/rc.d/rc.unslung-stop ) to:
/bin/echo "Stopping Optware Packages (rc.reboot):"; ( . /etc/rc.d/rc.optware-stop ) Changed lines 103-109 from:
to:
/bin/killall ample 2>/dev/null /bin/killall mms 2>/dev/null /bin/killall mt-daapd 2>/dev/null Changed lines 135-138 from:
to:
/bin/umount_flash 2>/dev/null echo "Waiting 10 seconds for disk write cache to flush" /bin/sleep 10 Added line 142:
July 17, 2006, at 08:39 AM
by --
Changed lines 34-35 from:
to:
df df|grep /dev/md1 >/dev/null 2>/dev/null if [ ! $? ] ; then /bin/echo "Starting Set CGI_ds.conf:"; /etc/rc.d/rc.bootbin; check_status fi df Changed line 43 from:
/bin/echo "Creating ramfs for /var:" to:
/bin/echo "Creating ramfs for /var: (diversion - /unslung/rc.1):" Changed lines 57-60 from:
cp /opt/etc/passwd /etc/passwd cp /opt/etc/passwd /share/hdd/conf/passwd [ - L /root ] || ln -sf /opt/user/root /root to:
Changed line 62 from:
to:
/bin/echo "Restore usrgrpshares:"; /etc/rc.d/rc.reset_usrgrpshare; check_status Changed line 68 from:
to:
/bin/echo "Starting INET Server:"; . /etc/rc.d/rc.xinetd; check_status Changed lines 73-74 from:
/bin/echo "Starting UNSLUNG Packages:"; ( . /etc/rc.d/rc.unslung-start ) to:
/bin/echo "Starting Optware Packages:"; ( . /etc/rc.d/rc.optware-start ) Changed lines 77-78 from:
to:
/bin/echo "Checking disk status :"; /usr/sbin/CheckDiskFull 2 >/dev/null df /bin/echo -e "\n\n$HOSTNAME: Boot Completed !!!\n\n" July 07, 2006, at 10:08 PM
by --
Added lines 1-194:
(:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.sysinit #!/bin/sh # The raid devices are /dev/md1 /dev/md2 /dev/md3 /dev/md4 # They have already been created in 'linuxrc' # Create and use swap partition /sbin/mkswap /dev/md3 /bin/sleep 2 /sbin/swapon /dev/md3 # Mount data and conf partitions /bin/mount -t ext3 /dev/md2 /share/hdd/conf -o rw,noatime /bin/mount -t ext3 /dev/md1 /share/hdd/data -o rw,noatime # Mount the 4th partition /bin/mount -t ext3 /dev/md4 /share/hdd/data/public -o rw,noatime /bin/mount /share/hdd/data/public /public -o bind # Continue with the rest of the /etc/rc.d/rc.sysinit script return 1 (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.1 #!/bin/sh #/sbin/ifconfig ixp0 hw ether 00:C0:02:01:01:04 #/bin/echo "Starting Set CGI_ds.conf:"; /etc/rc.d/rc.bootbin; check_status # Next section only required to allow Maxtor drives to spin down: # Script section to create ramdisk for /var # Some find that they have to repeat the process with /dev /bin/echo "Creating ramfs for /var:" /bin/mount -t ramfs ramfs /mnt/tmpmnt -o maxsize=256 /bin/cp -rp /var/* /mnt/tmpmnt/ /bin/mkdir -p /var.state /bin/mount -o bind /var /var.state /bin/mount -o bind /mnt/tmpmnt /var /bin/umount /mnt/tmpmnt # We have commented out the 'bootbin' line above so we must provide replacements # The rc.sysinit diversion has already mounted the RAID arrays # This next line brings the ethernet interface up /sbin/ifup # These three lines are optional cp /opt/etc/passwd /etc/passwd cp /opt/etc/passwd /share/hdd/conf/passwd [ - L /root ] || ln -sf /opt/user/root /root /bin/echo "Restore time and timezone:"; /etc/rc.d/rc.rstimezone; check_status #/bin/echo "Restore usrgrpshares:"; /etc/rc.d/rc.reset_usrgrpshare; check_status #/bin/echo "Generating telnet password:"; /usr/sbin/TelnetPassword; check_status #/bin/echo "Restore time and timezone:"; /etc/rc.d/rc.rstimezone; check_status /bin/echo "Starting WEB Server:"; . /etc/rc.d/rc.thttpd;check_status /bin/echo "Starting samba:"; . /etc/rc.d/rc.samba #/bin/echo "Starting download:"; /usr/sbin/download #/bin/echo "Starting INET Server:"; . /etc/rc.d/rc.xinetd; check_status #/bin/echo "Starting QuickSet Daemon :"; . /etc/rc.d/rc.quickset /bin/echo "Starting Crond :"; . /etc/rc.d/rc.crond /bin/echo "Starting Rest Task :"; . /etc/rc.d/rc.local /bin/echo "Starting UNSLUNG Packages:"; ( . /etc/rc.d/rc.unslung-start ) /usr/bin/Set_Led ready /usr/bin/Set_Led beep1 #/bin/echo "Checking disk status :"; /usr/sbin/CheckDiskFull 2 >/dev/null # Do not continue with the /etc/rc.d/rc.1 script return 0 (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.reboot #!/bin/sh cd / /bin/cp /etc/passwd /opt/etc/passwd /bin/echo "Stopping Unslung packages"; ( . /etc/rc.d/rc.unslung-stop ) /bin/killall -2 upnpd 2>/dev/null /bin/sleep 4 # Switch off ethernet interface /sbin/ifdown ixp0 # Stop Samba /bin/killall nmbd 2>/dev/null /bin/killall smbd 2>/dev/null # Stop webserver /bin/killall -SIGUSR2 thttpd 2>/dev/null /bin/sleep 2 # Unmount all drives /bin/umount /share/flash/conf 2>/dev/null /bin/umount /share/flash/data 2>/dev/null /bin/umount /share/hdd/conf 2>/dev/null /bin/umount /share/hdd/data/public 2>/dev/null /bin/umount /public 2>/dev/null /bin/umount /share/hdd/data 2>/dev/null /sbin/swapoff /dev/sda3 2>/dev/null /sbin/swapoff /dev/sdb3 2>/dev/null /sbin/swapoff /dev/md3 2>/dev/null # Stop RAID arrays # we will not be able to stop the boot drive /opt/sbin/mdadm -Ss --config=/opt/etc/mdadm.conf /bin/sleep 2 # doing reverse of '/etc/rc' script /bin/mount -o remount,ro /dev/root / /bin/umount /proc/bus/usb /bin/umount /proc # REboot! /sbin/reboot (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.halt #!/bin/sh chdir / /bin/cp /etc/passwd /opt/etc/passwd /bin/echo "Stopping Unslung packages"; ( . /etc/rc.d/rc.unslung-stop ) /bin/killall sshd 2>/dev/null /opt/etc/init.d/S80thttpd stop /bin/killall -2 upnpd 2>/dev/null # Stop cron job daemon /bin/killall crond 2>/dev/null # Switch off ethernet interface /sbin/ifdown ixp0 # Stop Samba /bin/killall nmbd 2>/dev/null /bin/killall smbd 2>/dev/null # turn off quotas /usr/bin/quotaoff -a # Stop webserver /bin/killall -SIGUSR2 thttpd 2>/dev/null /bin/sleep 2 # Unmount all drives /bin/umount /var.state 2>/dev/null /bin/umount /var 2>/dev/null /bin/umount /share/flash/conf 2>/dev/null /bin/umount /share/hdd/data/public 2>/dev/null /bin/umount /public 2>/dev/null /bin/umount /share/flash/data 2>/dev/null /bin/umount /share/hdd/conf 2>/dev/null /bin/umount /share/hdd/data 2>/dev/null /sbin/swapoff /dev/sda3 2>/dev/null /sbin/swapoff /dev/sdb3 2>/dev/null /sbin/swapoff /dev/md3 2>/dev/null # Stop RAID arrays # We will not be able to stop the root drive # But thats OK because we resync it at startup /opt/sbin/mdadm -Ss --config=/opt/etc/mdadm.conf /bin/sleep 3 # doing reverse of '/etc/rc' script /bin/mount -o remount,ro /dev/root / /bin/umount /proc/bus/usb /bin/umount /proc /sbin/halt-test &>/dev/null /bin/sleep 2 /sbin/halt-test &>/dev/null (:tableend:) |