-
Auto mounting Hard drive
I add a peace of script to /etc/rcS.d/S00knoppix-autoconfig to search for a specific file on the rott of a partition. What is does is it mounts all possible partitions and then searches root for a file. When the file is found it will mount that partition as /mnt/hda1. It works, but there is 2 problems
1-after it goes through the process of searching the partitions it re-runs the auto config process again where it will re-search for devices and usb devices and configure them again.
2-I get an error every time it tries to mount a non existent partition. I have it forwarding the messages to /dev/null, and it does not get the messages when I test run just my code alone. But when it is run with the boot process it gets this message about 30 times:
Code:
modprobe: modprobe: Can't locate module block-major-34
here is the code I added:
Code:
# Locate Config File CONFPART.F
findconf(){
LOC=0
# search all partitions for a file in the root directory
for i in /mnt/tmp ; do
# See if it's already mounted
[ -f "$i/$1" ] && { echo "$i/$1"; return 0; }
if [ -d "$i" ] && mount -r "$i" 2>/dev/null; then
[ -f "$i/$1" ] && LOC=0
umount -l "$i" 2>/dev/null
[ -n "$LOC" ] && { echo "$LOC"; return 0; }
fi
done
}
searchdrv(){
DRIVES="/dev/[h-s]d[a-z][0-9]"
CONFDRV=""
LOC=0
for drv in $DRIVES ; do
if (mount $drv /mnt/tmp 2>/dev/null) ; then
LOC="$(findconf CONFPART.F)"
if test "$LOC"; then
CONFDRV=$drv
return 0
fi
umount /mnt/tmp
fi
done
return 0
}
.
.
.
.
.
mkdir /mnt/tmp
mkdir /mnt/hda1
searchdrv
echo Found CONFPART.F file in $CONFDRV
mount -rw $CONFDRV /mnt/hda1
let me know if anyone has an idea
-
I have been revising my code so that it is cleaner and runs smother buy I still have the same problems
here is the code:
Code:
# Locate ProQuest Config File CONFPART.F
findconf(){
LOC=0
# search all partitions for a file in the root directory
for i in /mnt/tmp ; do
# See if it's already mounted
[ -f "$i/$1" ] && { echo "$i/$1"; return 0; }
done
return 0
}
searchdrv(){
DRIVES="/dev/[h,s]d[a-z][0-9]"
CONFDRV=""
LOC=""
for drv in $DRIVES ; do
if mount -rw $drv /mnt/tmp >/dev/null 2>&- ; then
LOC="$(findconf CONFPART.F)"
[ -n "$LOC" ] && { umount /mnt/tmp; echo $drv; return 0; }
umount /mnt/tmp
fi
done
return 0
}
# locate ProQuest config partition and mount as hda1
mkdir /mnt/tmp 2>&-
mkdir /mnt/hda1 2>&-
# Search for config files
echo "0" > /proc/sys/kernel/printk
EXISTS="$(searchdrv)"
if test "$EXISTS"; then
echo "${CRE}${BLUE}Found CONFPART.F in ${MAGENTA}$EXISTS"
mount -rw "$EXISTS" /mnt/hda1 2>&-
else
echo "${CRE}${RED}Local config files not loaded"
fi
Similar Threads
-
By coffee_monster in forum Hardware & Booting
Replies: 2
Last Post: 07-18-2005, 01:58 PM
-
By Phishman in forum Hardware & Booting
Replies: 4
Last Post: 02-04-2005, 04:09 AM
-
By softgun in forum Hdd Install / Debian / Apt
Replies: 0
Last Post: 08-29-2004, 06:12 AM
-
By Blue in forum Customising & Remastering
Replies: 2
Last Post: 06-26-2003, 12:02 PM
-
By Mycroft1855 in forum Customising & Remastering
Replies: 1
Last Post: 02-27-2003, 05:23 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
![LOT QTY 2 of INTEL XEON 10 CORE E5-2690 V2 25MB 3.00GHZ CPU SR1A5 picture](/store/img/g/NLUAAOSwSoBkpZ7y/s-l225/LOT-QTY-2-of-INTEL-XEON-10-CORE-E5-2690-V2-25MB-3-.jpg)
LOT QTY 2 of INTEL XEON 10 CORE E5-2690 V2 25MB 3.00GHZ CPU SR1A5
$139.99
![Dell Precision 5810 Workstation Xeon E5-1650 6C 3.5GHz 16GB 500GB Win10 K2200 picture](/store/img/g/60cAAOSwEIll-JnV/s-l225/Dell-Precision-5810-Workstation-Xeon-E5-1650-6C-3-.jpg)
Dell Precision 5810 Workstation Xeon E5-1650 6C 3.5GHz 16GB 500GB Win10 K2200
$115.94
![E5-2699V4 Intel Xeon Processor 55M Cache, 2.20 GHz SR2JS CM8066002022506 picture](/store/img/g/HmIAAOSwls5frj~X/s-l225/E5-2699V4-Intel-Xeon-Processor-55M-Cache-2-20-GHz-.jpg)
E5-2699V4 Intel Xeon Processor 55M Cache, 2.20 GHz SR2JS CM8066002022506
$155.00
![Dell Precision T3600 Tower Xeon E5-1650 3.2GHz 32GB RAM No HDD/OS Quadro 600 picture](/store/img/g/nMoAAOSwv1tmgv6w/s-l225/Dell-Precision-T3600-Tower-Xeon-E5-1650-3-2GHz-32G.jpg)
Dell Precision T3600 Tower Xeon E5-1650 3.2GHz 32GB RAM No HDD/OS Quadro 600
$89.99
![Intel Xeon E5-2680 V4 CPU 2.4~3.3GHz 14-Core 35M LGA 2011-3 R3 Server SR2N7 120W picture](/store/img/g/hLcAAOSwA81iMQ7h/s-l225/Intel-Xeon-E5-2680-V4-CPU-2-4-3-3GHz-14-Core-35M-L.jpg)
Intel Xeon E5-2680 V4 CPU 2.4~3.3GHz 14-Core 35M LGA 2011-3 R3 Server SR2N7 120W
$15.99
![Intel Xeon Platinum 8180 Processor SR377 28-CORE 2.5 GHZ CD8067303314400 picture](/store/img/g/bOsAAOSwBKRmizy7/s-l225/Intel-Xeon-Platinum-8180-Processor-SR377-28-CORE-2.jpg)
Intel Xeon Platinum 8180 Processor SR377 28-CORE 2.5 GHZ CD8067303314400
$489.00
![Intel Xeon E5-2699 v3 2.3GHz 18-Core 45MB 145W LGA2011-3 CPU/Processor SR1XD picture](/store/img/g/HDwAAOSwTHFl06dB/s-l225/Intel-Xeon-E5-2699-v3-2-3GHz-18-Core-45MB-145W-LGA.jpg)
Intel Xeon E5-2699 v3 2.3GHz 18-Core 45MB 145W LGA2011-3 CPU/Processor SR1XD
$40.99
![Intel Xeon E5-2667 V2 LGA 2011 3.3GHz 8 Core 130W 25MB 8GT/s CPU Processor picture](/store/img/g/rfsAAOSwEFBma4Yr/s-l225/Intel-Xeon-E5-2667-V2-LGA-2011-3-3GHz-8-Core-130W-.jpg)
Intel Xeon E5-2667 V2 LGA 2011 3.3GHz 8 Core 130W 25MB 8GT/s CPU Processor
$14.99
![Matched pair Intel Xeon E5-2667v4 SR2P5 3.20GHz, 8 core, 25MB Processors LGA2011 picture](/store/img/g/zYMAAOSwhh1mdEYc/s-l225/Matched-pair-Intel-Xeon-E5-2667v4-SR2P5-3-20GHz-8-.jpg)
Matched pair Intel Xeon E5-2667v4 SR2P5 3.20GHz, 8 core, 25MB Processors LGA2011
$62.95
![Intel Xeon E5-2667 V4 SR2P5 (3.2GHZ/8-CORE/25MB/135W) PROCESSOR CPU picture](/store/img/g/gRcAAOSwTnpmYzzp/s-l225/Intel-Xeon-E5-2667-V4-SR2P5-3-2GHZ-8-CORE-25MB-135.jpg)
Intel Xeon E5-2667 V4 SR2P5 (3.2GHZ/8-CORE/25MB/135W) PROCESSOR CPU
$29.89