Mounting /dev/hdaX at boot time...


Forum: HD Install
Topic: Mounting /dev/hdaX at boot time...
started by: Wraithan

Posted by Wraithan on July 30 2006,17:12
I will start this with saying I am not running a frugal install due to the limited ram and what I want to do with this computer.

I am attempting to mount /dev/hda2 to /mnt/hda2 and /dev/hda3 to /mnt/hda3 using my /etc/fstab.

Quote
/etc/fstab

/dev/hda1  /         ext2 defaults,errors=remount-ro     0 1
/dev/hda2  /mnt/hda2 ext2 defaults                       0 1
/dev/hda3  /mnt/hda3 ext2 defaults                       0 0
/dev/hda4  none      swap defaults                       0 0
/dev/cdrom /cdrom    auto defaults,ro,user,noexec,noauto 0 0
proc       /proc     proc defaults                       0 0


Quote
/boot/grub/menu.lst (just the line I am using to boot)

title DSL
kernal /boot/linux24 root=/dev/hda1 quiet vga=normal nofstab noacpi noapm nodma noscsi


This should mount the 2 drives at boot time... but it doesn't.

Any thoughts/suggestions?

Posted by Wraithan on July 30 2006,19:07
I am giving up on DSL, I have been hammering away at this problem for 2 days now and I have had very little luck finding any help on it. I am going to give Slackware a go.

Thanks for what help I got...
~Wraith

Posted by mikshaw on July 30 2006,22:47
That was closer to two hours than two days.

Try adding mount commands to /opt/bootlocal.sh.   I don't have any experience with using nofstab, and since I use frugal and do all my customization from bootlocal and personal startup scripts, I couldn't say why it didn't work for you.  It *seems* like it should work, as you said.

Posted by Wraithan on July 30 2006,22:49
Just because I didn't post on here doesn't mean I wasn't wrestling with it :D.

/opt/bootlocal.sh is on /opt which is one of the folders I want to move... so you can see my delima.

Posted by roberts on July 30 2006,23:52
A hard drive install is not the primary focus of DSL.
But to answer your question...
Since this is a hard drive install, and if nofstab is persisting your fstab file then I would suggest  to create a script to mount these in /etc/init.d and place a link in the /etc/rcS.d directory.

Posted by Wraithan on July 31 2006,00:55
I will give that a go soon...

I can't see a frugal install being good on a computer that 166mhz and 64megs of ram... that is going to be running apache, mysql, php, xmms and icecast without upgrading the ram...

Unless there is a trick to making it take up no extra ram for being a frugal install.

EDIT: Also maybe a wiki page on Frugal installs? I don't even know exactly what they are other than they are like running DSL off the CD.

Posted by brianw on July 31 2006,01:54
in your boot line (grub or lilo) add the nofstab code and your fstab will remain persistent so any changes you make manually will last.  The fstab gets rebuilt everytime unless you put in the nofstab.  You could also put it in bootlocal.sh as mount commands but using the nofstab will stop all changes to your fstab file from being lost.

EDIT:  almost forgot that you need to tell the system when to mount the partitions.

One of my lines in fstab is:

/dev/hda7 /home ext2 defaults,users,exec 0 2

If there was a  0 where the 2 is at the end it would not get mounted automatically at boot up.  The 2 tells it in which order to mount the partition.  1 is used for the root partition which looks like this on my install:

/dev/hda6  /  ext2  defaults,errors=remount-ro  0  1

Yours would look something like:

/dev/hda2 /mnt/hda2 ext2 defaults,users,exec 0 2
/dev/hda3 /mnt/hda3 ext2 defaults,users,exec 0 2

or

/dev/hda2 /mnt/hda2 ext2 defaults,users,exec 0 2
/dev/hda3 /mnt/hda3 ext2 defaults,users,exec 0 3

Posted by Wraithan on July 31 2006,02:12
Oh I see, So I need to set that last number to 2 and I shouldn't have any more issues with that? You, my sir, are a genius! (I mean that honestly, not sarcastically.)
Posted by Wraithan on July 31 2006,16:47
Well, after some more indepth research, turns out brianw is wrong about the last number being the mount order... that number is the order that fsck is ran on the partitions.

< http://humbug.org.au/talks/fstab/fstab_man.txt >

I was looking through the scripts in /etc/rcS.d and I didn't see anywhere that mount -a is mentioned (the command to mount all the of the drives to the points specified in /etc/fstab) so it is looking like I will have to add a script to that directory to make it work...

Posted by brianw on July 31 2006,17:39
Sorry about that.  I know everything works for me and I have no problems at startup.  You could try putting a single line in /opt/bootlocal.sh:

mount -a

mounts all devices in fstab, this should solve your problem.  

In my palying around with my HD install I must have made other changes to make it work and didn't realize (must have the mount -a in somewhere else).  Thanks for the correction, constructive critisism helps us all learn.

EDIT:  found my mount -a.  Stuck it in knoppix-autoconfig to work with the nofstab code (did it when I added a code to not regenerate ld.so.cache and modules.dep unless I explicitely request it on bootup and forgot all about it).

Posted by Wraithan on July 31 2006,18:25
If you had read my post you would see that I was already doing that... :D I added a script to /etc/init.d called it mountit.sh then contents:

#!/bin/bash
#Script to mount my partitions in fstab
echo "Mounting everything in /etc/fstab that should get mounted"
mount -a &

Then I made a link using the command:

ln -s /etc/init.d/mountit.sh /etc/rcS.d/S35mountit.sh

The S35 part deterimins when it will be run during startup, S meaning start up, 3 meaning runlevel 3, and I am not possitive about the 5 part but I assume that is part of what order in runlevel 3.

Since /home isn't read till after runlevel 5 is reached, and on other systems it seems that mounting init scripts are done in runlevel 3, I thouht that would be a good place to do it.

Posted by brianw on Aug. 01 2006,03:04
Quote (Wraithan @ July 31 2006,14:25)
If you had read my post you would see that I was already doing that... :D I added a script to /etc/init.d called it mountit.sh then contents:

My suggestion was to add a simple line to what was already there.   ???

The S in S35 says to run the script with a start argument i.e.

/etc/init.d/myscript start

A K in front K35 would call the script to kill the process

/etc/init.d/myscript stop

I was under the impression that the number was for order of operation.  If you look in rc6.d (shutdown/reboot init) you will see that something that starts with S99 will be stopped with K01 or something like that (that last ones to get stopped are usually the first ones that got started and the last things that got started are the first ones stopped).

Have you actually gotten this to work by putting it in the Single user mode init folder (rcS.d)?  I thought you should have it in the folder for the init number that you run at startup (the default init in the inittab file rc5.d)?  If it does not work try creating the link in the rc5.d directory.
???

Posted by Wraithan on Aug. 01 2006,04:29
It works great in the folder I specified above... though I am not in multiuser mode. I posted the exact stuff I did to make it work so that who ever searches this topic can find instructions on how to do it.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.