View previous topic :: View next topic |
Author |
Message |
shaumux Veteran

Joined: 13 May 2005 Posts: 1000 Location: Bangalore, India
|
Posted: Sun Aug 18, 2013 8:31 am Post subject: on the fly mounting when accessed via samba |
|
|
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 |
|
 |
hdcg n00b

Joined: 07 Apr 2013 Posts: 71
|
|
Back to top |
|
 |
shaumux Veteran

Joined: 13 May 2005 Posts: 1000 Location: Bangalore, India
|
Posted: Sun Aug 18, 2013 3:48 pm Post subject: |
|
|
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 |
|
 |
Hu Moderator

Joined: 06 Mar 2007 Posts: 16494
|
Posted: Sun Aug 18, 2013 4:54 pm Post subject: |
|
|
You might be able to use the automounter to do this. It is normally used for network filesystems. |
|
Back to top |
|
 |
shaumux Veteran

Joined: 13 May 2005 Posts: 1000 Location: Bangalore, India
|
Posted: Sun Aug 18, 2013 5:06 pm Post subject: |
|
|
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 |
|
 |
hdcg n00b

Joined: 07 Apr 2013 Posts: 71
|
Posted: Sun Aug 18, 2013 5:26 pm Post subject: |
|
|
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 |
|
 |
|