Ask Your Question

automount directory from another partition on startup

asked 2013-11-12 16:49:08 -0500

dragonjosh gravatar image

hi guys :D i'm using fedora 19 and I love it <3 i've been googling this issue for a while and since i can't figure it out, (and after messing up my startup and restoring it back with /etc/fstab) i decide it to make this question and it is as simple as i titled it. I want to mount just one directory from a partition in wich i have all my data (sda5) called Music... I don't want to manually mount it everytime just to access this folder, and also for security needs don't want the whole partition to be mounted everytime... only just that specific folder. How do i do it? You are free to correct ortography, as english it's not my native language Thanks in advanced to everyone who wants to help :) Josue.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-11-12 18:40:05 -0500

sideburns gravatar image

You can't. The mount command mounts a device, and makes it part of the filesystem starting at the specified directory. As an example:

mount /dev/sdb2 /data

Will mount the partition /dev/sdb2 with the device's top level files/directories in the directory /data. There is no way to tell the command to mount a specific directory in that partition to a directory. However, you can set the default permissions for that partition's top directory to make it unavailable to others, set the permissions to the one directory you want to give access to appropriately, then create links to that one directory in everybody's home folder. (You need to be root for this, because you don't own the directory you're creating the link in.) If the directory is Music, you'd do something like this, as root:

ln -s /data/Music Music

in each home directory. This will let them access the directory as though it were part of their home folder, but not anything above it in /data. It's probably more work than you were looking for, but it should do what you want.

edit flag offensive delete link more

answered 2013-11-12 19:17:57 -0500

dragonjosh gravatar image

hi sideburns! wow thanks for the quick reply! :) ok, then i'll do that! but i have some doubts... ln it's command for links (googled it), so i have to mount /dev/sda5 in order to get the link working everytime right? also how do i change permissions to get some specific folder avaliable and others don't. Thanks in advance for the help :)

edit flag offensive delete link more


First you edit /etc/fstab if you haven't already, to have that partition mounted at boot and owned by root. (That way you don't have to worry about it.) Second, you have to change the permissions of the Music directory to be (at least) readable by everybody. I'm not sure if the top level directory also needs read access, but you can try it without and see what happens. After all, the worst that can happen is that your users can't get there until you change the permissions.

sideburns gravatar imagesideburns ( 2013-11-12 19:39:38 -0500 )edit

Question Tools


Asked: 2013-11-12 16:49:08 -0500

Seen: 219 times

Last updated: Nov 12 '13