Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
on the fly mounting when accessed via samba
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
shaumux
l33t
l33t


Joined: 13 May 2005
Posts: 996
Location: Bangalore, India

PostPosted: Sun Aug 18, 2013 8:31 am    Post subject: on the fly mounting when accessed via samba Reply with quote

Hi
I don't know if its even possible but i want to mount a partition on the fly automatically when accessed by samba.
I was thinking that i might need to share the block device itself via samba somehow to make this happen.
Anybody got any idea on implementing this?
Back to top
View user's profile Send private message
hdcg
n00b
n00b


Joined: 07 Apr 2013
Posts: 56

PostPosted: Sun Aug 18, 2013 2:36 pm    Post subject: Reply with quote

Hi,

take a look at the preexec and postexec option of smb.conf (http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#idp61460000).

Best Regards,
Holger
Back to top
View user's profile Send private message
shaumux
l33t
l33t


Joined: 13 May 2005
Posts: 996
Location: Bangalore, India

PostPosted: Sun Aug 18, 2013 3:48 pm    Post subject: Reply with quote

Maybe i can use postexec to unmount but i don't understand how to use preexec in this scenario.
Let me explain the scenario in more detail.
Suppose there are 4 partitions /dev/sdb{1,2,3,4}
What i want is when i try to access /dev/sdb1 it should only mount /dev/sdb1 and not the others and that too only when i try to access it instead of when i connect to samba server.
Is that possible to achieve?

Thanks for the reply.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13504

PostPosted: Sun Aug 18, 2013 4:54 pm    Post subject: Reply with quote

You might be able to use the automounter to do this. It is normally used for network filesystems.
Back to top
View user's profile Send private message
shaumux
l33t
l33t


Joined: 13 May 2005
Posts: 996
Location: Bangalore, India

PostPosted: Sun Aug 18, 2013 5:06 pm    Post subject: Reply with quote

Hu wrote:
You might be able to use the automounter to do this. It is normally used for network filesystems.
I don't want to automount the samba filesystems, i want to mount the local filesystems on the machine with samba when they are accessed via samba from another system
Back to top
View user's profile Send private message
hdcg
n00b
n00b


Joined: 07 Apr 2013
Posts: 56

PostPosted: Sun Aug 18, 2013 5:26 pm    Post subject: Reply with quote

Hi,

for the preexec/postexec szenario you need to define a share for the mount point as well as the proper fstab entry. The preexec option makes sure that the mount command is invoked and the preexec makes sure that the umount command is invoked.

A usual example for this is a cdrom share like:

Code:
[cdrom]
   comment = CD-ROM
   writable = no
   locking = no
   path = /cdrom
   public = yes
   preexec = /bin/mount /cdrom
   postexec = /bin/umount /cdrom


This simple setup works well in a single user szenario. With multiple users accessing the same share for the same time I am not so sure.

Best Regards,
Holger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum