Hard drive does not mount in runlevel 3, but works fine in 5

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Hard drive does not mount in runlevel 3, but works fine in 5

Post by jaoudestudios »

Hi,

I have always ran my development server in runlevel 5. I have now switched to runlevel 3 as I never use the GUI anyway. But for some reason my USB hards and 2nd Hard drives do not appear in /media/* as they did before. I have checked that all services that ran in level 5 are running in level 3.

What service actually mounts these drives?

Any ideas?

EDIT: I have found out that in runlevel 5 the drives only mount after I login locally on the machine, which is not my intention. Why would this be? I have checked running and stopped services on runlevel 5 and runlevel 3 and everything appears to be the same. Does anyone know what is going on? Thanks :)
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: Hard drive does not mount in runlevel 3, but works fine in 5

Post by Jenk »

Look into using UDEV rules to auto mount the drives (or to at least trigger a shell script to do it.) and/or add entries for your fstab.

On a related note, instead of using run level 3, I'd continue to use run level 5 and remove X (xdm/kdm/gdm/other) from your start up services.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Hard drive does not mount in runlevel 3, but works fine in 5

Post by jaoudestudios »

Jenk wrote:On a related note, instead of using run level 3, I'd continue to use run level 5 and remove X (xdm/kdm/gdm/other) from your start up services.
I did not think of that, however, my problem would still occur, as it only mounts the drives when I log in as root locally on the machine (which is not what I am planning on doing).

I tried with fstab but it would not work. I googled it a lot but with still no luck. Should fstab be the best solution?

I have not tried UDEV. I am not sure what it is, so I will do some research on this tonight.

I tried with a shell script to mount the drives when I logged in. This kind of worked, but it would ask me for my password again, yet I had just logged in. Because in the shell script, I had to use sudo. And if I logged in again with another terminal it would try and mount the drives again - and throw an error (already mounted). Can I get the scripts to run only once, on first login?

Thanks
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Hard drive does not mount in runlevel 3, but works fine in 5

Post by VladSun »

Peoperly configured fstab should be enough, I think.
http://www.thegeekstuff.com/2008/10/exe ... sh_logout/
check out which of those files mounts your drives and how it is done.

PS: Did you look at this one: http://www.linuxquestions.org/questions ... nt-250852/
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply