PDA

View Full Version : how to mount harddisks on systemstart



magicoizo
05-18-2004, 04:17 PM
Hi,

how do i mount a harddisk on systemstart?

i tried tu use the /etc/fstab file for this and added a line just after the /-mounting

/dev/hdb1/ /test ext2 defaults,users 0 0

the directiry test does exist and the harddisk is ext2 formated

but nothing happens on reboot ...

when use the command

mount /test
after login then everything works but that can't be correct, can it?

i hope you can help me ...

P.S. i'm a linux newbie *smile*

Cuddles
05-18-2004, 07:02 PM
magicoizo,

Hmmmmm, the line looks good, only thing, and I can't be sure if this changes anything, or if it needs to be there, but, you might add exec ???

like this:


/dev/hdb1/ /test ext2 defaults,users,exec 0 0

I can't see why your drive isn't just auto-mounting when you login??? Have you had a look near the top of the output of dmesg ???? (possibly a more descriptive error of why it can't mount the drive???)

Look to see if during your root file system mounting and swap partition, if it says something about your hdb device.... Only thought I can think of...

Hope this helps,
Ms. Cuddles

fingers99
05-19-2004, 02:55 PM
Try this:

/dev/hdb1 /test ext2, users, auto 0 0

Then reboot.

Note the auto flag and the lack of a slash after the drive.

Formatting as Ext3 might save you some pain later!

Cuddles
05-19-2004, 04:51 PM
O M G

I didn't even "see" that slash, sheesh, I can be so dense sometimes. (I even typed the slash on my reply!)

Thanks Fingers99 for "seeing" that little detail, and I agree on the ext3 file system, as well... Saved my rear a few times, having it, thats for sure!

Background: Ext3 is the same as Ext2, except it has a "journaled" structure. If something, unforseen, happens, like a crash, or power-outage, fsck can "rebuild" better, what could have gone corrupt on you. Ext3 file system is kind of like using Windows' Microsoft Word, and it crashes on you, in the middle of a document edit. Word can use a form of "journaled" entry to rebuild the document, closer to its known contents, than without it.

Hope this helps,
Ms. Cuddles

magicoizo
05-19-2004, 05:27 PM
hi guys,
thx for your help.

first of all, i tried to format the harddisks with ext3 but the program, which should help me to make the partitions could not format in ext3. Every try ended in an error ...
how can i format them without this KDE-tool?

the code was just /dev/hdb1, without the / it was just my mistake, sorry :-)

Cuddles
05-19-2004, 07:09 PM
Kool,

For formatting, drop to a shell console, root, preferably, and do one of the mkfs commands...

Not exactly sure on the spelling, maybe...

mkext3fs - or mkfsext3 ???

Got it...

mkfs.ext3 - you can look at the man pages on what options you want to provide, but from just entering the command alone on the console, you only need to provide the [device], all the rest are non-required flags/switches/options....

Hope this helps, and glad you got your auto-mounting working :D
Ms. Cuddles

mzilikazi
05-19-2004, 07:44 PM
hi guys,
thx for your help.

first of all, i tried to format the harddisks with ext3 but the program, which should help me to make the partitions could not format in ext3. Every try ended in an error ...
how can i format them without this KDE-tool?

the code was just /dev/hdb1, without the / it was just my mistake, sorry :-)

mke2fs /dev/hda2 creates an ext2 format
mke2fs -j /dev/hda2 uses the journal that creates ext3
tune2fs -j /dev/hda2 will convert an existing etx2 partition to ext3

Funny, I had no idea there was a GUI for something as simple as formatting.
:)

user unknown
05-19-2004, 07:54 PM
/dev/hdb1 /test ext2, users, auto 0 0

The syntax is:


/dev/hdb1 /test ext2 users,auto 0 0

(no comma after ext2).

cuddles suggested to add 'exec' to the options.
man mount told me, that 'defaults' implies 'exec'.
btw: exec permits execution of binaries and covers a totally different issue.

Questions to fstab are often answered by man mount - yes, I know, it's about 100 pages long :)

CrashedAgain
05-20-2004, 03:19 AM
Comment on ext2 vs ext3. I had several system total crashes (and thus became CrashedAgain) before switching to ext3 and none after. Save yourself some grief, make the switch. Crashes occurred during boot up, fsck would do a system check & say it had a bad superblock which I could never manage to 'repair'.

Bleim
05-20-2004, 12:30 PM
Hi!
I think that magicoizo installed knoppix in HD with beginner option. I did the same and I have the same problem! I edit fstab, reboot, and have the original fstab!! I don't know what to do. I think begginer install mode creates a fstab every time I reboot. What do we can do?

user unknown
05-20-2004, 01:04 PM
You could try this trick (I didn't test it - so no guaranatee is given).
As root, make fstab unwritable:

chmod a-w /etc/fstab

The next boot, you might see some errormessages, showing which script tried to write to the file - but I'm not sure whether they will give detailed erromessages.

Then you might tell us the script and the code-block, where the errors occur, and we could tell you how to change it, without breaking important things.

magicoizo
05-20-2004, 01:43 PM
knoppix does only change the last lines in the fstab on every reboot new ...
the lines with the comments
#createt by knoppix

but i added my code to the upper lines.
when i reboot are these lines still there.
but nothing happens

that is my problem. everything looks ok. and when i use the command
mount /test then i can see the right files with ls -l /test without any problems.

but directly after reboot the directory is empty, because of the not mounted harddisk :-(

i have the sace problem with the interface file for the networking ...
after reboot does
ifconfig only show the interface eth0 ... but when i do a force-reload on the
/etc/init.d/networking/ erverything is ok and even the correct ip address is set...

im realy confused ...

Bleim
05-20-2004, 04:03 PM
I made changes at fstab and now knoppix didn't changue fstab but linux don't mount my other partitions. It's the same than magicoizo.

Help!

user unknown
05-20-2004, 07:45 PM
well magicoizo, to the networking:

networking is an issue of runlevel 4 - multiuser with networking.
You have to create a symlink to /init.d/networking

note: it has to be networing not networking/.
In the second case it would be a directory.



ln -s /etc/init.d/networking /etc/rc4.d/S88networking


for runlevel N you put a script into /etc/rcN.d
For a script to be executed when entering the runlevel, you name it SXYfoo, with S=S, XY=order number, in which the scripts are executed from 00-99 and foo=the name of your script.
For a script to be executed when leaving the runlevel, you would replace the S with K.
S=start
K=kill

If you have a mount-script, you may act symetrically, but put it into rc.S, since mounting is usefull in single-user-mode.

If you lack a mount-script, create it in init.d:


echo "mount -a" > /etc/init.d/mount_all
chmod a+x /etc/init.d/mount_all

then act symetrically.

magicoizo
05-21-2004, 01:03 PM
ok, it was the runlevel ;-)

the mounting and also the networking problem is made ...

now i can start configuring my linux :-)

thank you very much, all of you :D

Bleim
05-22-2004, 02:41 PM
I made the script for HD and now it works prefectly. Thank u user unknown!!

user unknown
05-22-2004, 04:35 PM
you're welcome