LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   autofs does't mount /dev/sdaX (https://www.linuxquestions.org/questions/linux-software-2/autofs-doest-mount-dev-sdax-925084/)

newbie0101 01-22-2012 08:45 AM

autofs does't mount /dev/sdaX
 
hello, i have a partition that i use as a storage which is on /dev/sda8.
i'd like to use autofs to mount it only when i need to access it.

i did the configuration according guides i found in google.

here it is:
Code:

root# grep ^/m /etc/auto.master
/media/sto        /etc/auto.storage
root# cat /etc/auto.storage
/media/sto        /dev/sda8        --timeout=60
root# service autofs status
automount (pid  5006) is running...
root# cd /media/sto
root# ls
root# mount
/dev/sda7 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

when i access that directory, the /dev/sda8 doesn't mount.
what did i do wrong ?

Doc CPU 01-22-2012 01:01 PM

Hi there,

Quote:

Originally Posted by newbie0101 (Post 4581273)
hello, i have a partition that i use as a storage which is on /dev/sda8.
i'd like to use autofs to mount it only when i need to access it.

i did the configuration according guides i found in google.

yea right, but you must have gotten something wrong. I found a pretty good description some time ago. Alright, it's somewhat inclined to Arch Linux, but the basics of autofs are the same across various distros.

Code:

root# grep ^/m /etc/auto.master
/media/sto        /etc/auto.storage
root# cat /etc/auto.storage
/media/sto        /dev/sda8        --timeout=60

You got that totally mixed up. In /etc/auto.master you should have three fields per line. The first specifies the base directory of the automounts initiated by that line, the second is the individual config file, and the third contains additional options. For you, that could be:

Code:

/media/auto  /etc/auto.storage  --timeout=60 --ghost
This main configuration refers to /etc/auto.storage which contains the individual definitions for each volume you want to auto-mount to /media/auto:

Code:

sto  -fstype=auto  :/dev/sda8
Again, you have three fields per auto-mount. First the directory name relative to the base directoy specified in /etc/auto.master, then the mount options, and finally the file system you want to mount at that location. Don't ask me why the file system path must be prefixed with a colon, I haven't understood that either. The above sample would auto-mount sda8 to /media/auto/sto when accessed. You may want to add or modify the mount options, though.

[X] Doc CPU

newbie0101 01-22-2012 04:53 PM

thank you very much for your help and explanation, it works :)


All times are GMT -5. The time now is 02:42 PM.