LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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



Reply
 
Search this Thread
Old 06-21-2012, 05:49 AM   #1
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Rep: Reputation: 1
Question 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.
 
Old 06-21-2012, 06:32 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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.
Old 06-21-2012, 08:20 AM   #3
VDP76
Member
 
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111

Rep: Reputation: 19
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 08:30 AM.
 
1 members found this post helpful.
Old 06-21-2012, 02:50 PM   #4
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Original Poster
Rep: Reputation: 1
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.
 
Old 06-21-2012, 04:07 PM   #5
ohlookpie
LQ Newbie
 
Registered: Apr 2012
Posts: 20

Rep: Reputation: Disabled
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?
 
Old 06-21-2012, 08:19 PM   #6
VDP76
Member
 
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111

Rep: Reputation: 19
Quote:
Originally Posted by masuch View Post
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 View Post
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 05:07 AM.
 
Old 06-21-2012, 08:43 PM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
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.
 
Old 06-22-2012, 04:58 AM   #8
VDP76
Member
 
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111

Rep: Reputation: 19
Quote:
Originally Posted by chrism01 View Post
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!
 
Old 06-22-2012, 05:16 AM   #9
ohlookpie
LQ Newbie
 
Registered: Apr 2012
Posts: 20

Rep: Reputation: Disabled
Tested on my CentOS 6.2 box:

1. mkdir /test
2. vi /etc/auto.master and add this line:
Quote:
/test /etc/auto.test
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.
 
  


Reply

Tags
auto, boot, fstab, mount


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to configure /etc/fstab to auto mount encrypted partition? michalng Debian 5 12-25-2011 06:04 AM
auto mount problem and fstab Mogli Linux - Hardware 3 09-19-2008 05:13 AM
trying to auto mount xp share in fstab babag Linux - Networking 3 07-12-2008 05:48 AM
fstab: auto mount floppy at boot blackzone Linux - Newbie 2 07-10-2006 02:17 AM
Win share will not auto mount, inclu in Fstab ZingSter Suse/Novell 4 04-06-2005 08:22 AM


All times are GMT -5. The time now is 12:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration