Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-21-2012, 04:49 AM
|
#1
|
Member
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135
Rep:
|
how to configure /etc/fstab with auto but do not mount it after boot up
Hi,
I would like to have in /etc/fstab configuration that:
1. after bootup I do not want to mount it.
2. but when I do mount -a in terminal - do mount all stuff with auto switch
is it possible or does exist some workaround how to do it?
please help,
thank you for any idea/hint,
kind regards,
M.
Example:
I have:
LABEL=rlraid0ocz /media/raid0ocz ext4 rw,suid,dev,exec,auto,nouser,async,acl,user_xattr,nobootwait,errors=remount-ro,noatime,discard 0 0
LABEL=rlraid0ext41 /media/raid0ext41 ext4 rw,suid,dev,exec,auto,nouser,async,acl,user_xattr,nobootwait,errors=remount-ro 0 0
LABEL=rlraid0btrfs1 /media/raid0btrfs1 btrfs rw,suid,dev,exec,auto,nouser,async,nobootwait 0 0
LABEL=rlraid0jfs1 /media/raid0jfs1 jfs rw,suid,dev,exec,auto,nouser,async,nobootwait,errors=remount-ro 0 0
LABEL=rlraid0reiserfs1 /media/raid0reiserfs1 reiserfs rw,suid,dev,exec,auto,nouser,async,acl,user_xattr,nobootwait 0 0
LABEL=rlraid0xfs1 /media/raid0xfs1 xfs rw,suid,dev,exec,auto,nouser,async,nobootwait 0 0
-- they are mounting after reboot what I do not want. --
-- but properly mount by '$ mount -a' ... I need it.
|
|
|
06-21-2012, 05:32 AM
|
#2
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
From the man page for fstab:
Quote:
Basic file system independent options are:
.
.
noauto do not mount when "mount -a" is given (e.g., at boot time)
|
the implication is that the init scripts issue the command "mount -a" (you can check this)
If you don't mind a kludge, you could set an entry to "noauto", and then add a line to an init script that changes the fstab entry after "mount -a" has been issued.
|
|
1 members found this post helpful.
|
06-21-2012, 07:20 AM
|
#3
|
Member
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111
Rep:
|
hi,
as pixellany pointed out, the command mount -a is issued at boot and noauto does not work with that, so I guess you have to find a way around it.
I would give noauto and users options to the drive you want to not be mounted at boot and the you can just do (as non-root user)
Code:
mount /media/raid0xxxx
(with proper name instead of xxxx)
If you want to do this on more than one drive you can create a script like
Code:
#!/bin/bash
mount /media/raid0xxxx1
mount /media/raid0xxxx2
Would that fit your needs?
p.s.: please, when you write code, config files, etc.. in your posts use the [CODE] tags so it is more readable.
Last edited by VDP76; 06-21-2012 at 07:30 AM.
|
|
1 members found this post helpful.
|
06-21-2012, 01:50 PM
|
#4
|
Member
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135
Original Poster
Rep:
|
thanks you all for help.
Even if I am using script to start it manually I am curious which init script contains "mount -a" - where is it located ?
I would like to learn how the boot process works more precisely.
regards,
M.
|
|
|
06-21-2012, 03:07 PM
|
#5
|
LQ Newbie
Registered: Apr 2012
Posts: 20
Rep: 
|
Couldn't you also do this with the automounter? Then, if you cd to the mount point for the filesystem, it will mount it automatically. What's the difference between using the noauto option in /etc/fstab vs. using the automounter? Just different methods of getting the volume mounted?
|
|
|
06-21-2012, 07:19 PM
|
#6
|
Member
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111
Rep:
|
Quote:
Originally Posted by masuch
thanks you all for help.
Even if I am using script to start it manually I am curious which init script contains "mount -a" - where is it located ?
I would like to learn how the boot process works more precisely.
regards,
M.
|
I am glad my post was helpfull.. 
I have found this, check it out for some more info about the boot process (today I have learned something too..  ). The command mount -a is issued by S35mountall.sh -> ../init.d/mountall.sh.
Quote:
Originally Posted by ohlookpie
Couldn't you also do this with the automounter? Then, if you cd to the mount point for the filesystem, it will mount it automatically. What's the difference between using the noauto option in /etc/fstab vs. using the automounter? Just different methods of getting the volume mounted?
|
Yes, eventually they are just different ways to get the job done...
Cheers
M.
Last edited by VDP76; 06-22-2012 at 04:07 AM.
|
|
|
06-21-2012, 07:43 PM
|
#7
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,442
|
Actually, if you red this page and the links therein, you'll find that autofs can mount drives on demand (eg when cd'ing into the dir), so long as its properly configured.
|
|
|
06-22-2012, 03:58 AM
|
#8
|
Member
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111
Rep:
|
Quote:
Originally Posted by chrism01
Actually, if you red this page and the links therein, you'll find that autofs can mount drives on demand (eg when cd'ing into the dir), so long as its properly configured.
|
+1 to my continuous Linux learning, thanks for the precisation! 
|
|
|
06-22-2012, 04:16 AM
|
#9
|
LQ Newbie
Registered: Apr 2012
Posts: 20
Rep: 
|
Tested on my CentOS 6.2 box:
1. mkdir /test
2. vi /etc/auto.master and add this line:
3. vi /etc/auto.test and add this line:
Quote:
foo -fstype=ext4 :/dev/sda2
|
4. cd to /test/foo and it automatically mounts device /dev/sda2 (and ls /test/foo would have the same results).
5. cd out and it automatically unmounts the device after 10 minutes or so
I just need to figure out how to make it so that I can cd to /test and have it mount. I tried a * instead of foo, didn't work. I tried a / instead of foo, didn't work. I imagine there's a way though. Side note: You could edit auto.misc and add "foo -fstype=ext4 :/dev/sda2" and then you'd just cd to /misc/foo and get the same results. If you did this, you would not have to edit auto.master, since auto.misc is already in auto.master.
|
|
|
All times are GMT -5. The time now is 06:50 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|