I have a Raspberry Pi with samba installed. I've looked into autofs and saw the potential of automounting an external harddrive upon accessing it over the network by my windows machine.
Appearantly the provided
auto.smb configuration is intended for a samba client application, but my intention is the other way around. I want the Server to automount my harddrive whenever I access it over the network and automatically unmount it after 5mins or so. Plus the fstype should be set to NTFS.
From my current understanding of
autofs what I need to do is create a configuration file, let's name it
driveA -uuid="UUID of my drive",fstype=ntfs,verbose=1 :/dev/sda1
Then I need to add that configuration into the
auto.master like so
PATH MAP -options
To specify, my PATH is
/share so I would add
/share /etc/auto.ntfs -t=60 into
/etc/auto.master to successfully automount my external harddrive into that directory every time I access it over the network.
Did I understand the way this works correctly and what should I do about the configuration file? Are there any things I need to consider doing this? Is it possible?
I'd like to have the possibility on this answered. (no I don't want other solutions than samba and yes it has to be NTFS)
I've added the configuration file. My problem now is that the contents of the drive are not shown as I'm trying to locally access the drive for it to be automounted just to test the feature itself.
/share /etc/auto.ntfs -t=60
/share -uuid=E820DC6120DC3870,fstype=ntfs :/dev/sda1
This doesn't work. When I go into the /share directory I can't see the contents of the drive. Here's an output of
$ service autofs status:
Jan 15 13:57:04 raspberrypi automount: key ":" not found in map source(s). Jan 15 13:57:04 raspberrypi automount: failed to mount /share/: Jan 15 13:57:04 raspberrypi automount: re-reading map for /share
FIX for above
For people that are interested in this question in the future, the above got fixed by checking the
dmesg related messages, which pointed me at the actual cause of the problem instead of just saying that it doesn't work. This command can be helpful to find it out:
$ dmesg -w | grep ntfs (you can grep for other message types if that's different for you)
The issue was that the option
-uuid was not supported.
My final configuration now looks like this:
/- /etc/auto.ntfs -t=60
/sharing -fstype=ntfs :/dev/sda1
After all this bugfixing, it comes to the final topic at hand: Samba
Currently my problem is that whenever the drive gets mounted it changes the permissions inappropriately. I've created the shared directory using
nautilus-share, since I can simply check the appropriate options there.
Here is a snippet of
$ stat sharing/ when autofs is disabled:
Access: (0777/drwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Here is a snippet of same command when autofs is enabled:
Access: (0500/dr-x------) Uid: ( 0/ root) Gid: ( 0/ root)
The access is edited upon mount, according to this dmesg message:
ntfs: (device sda1): load_system_files(): Volume is dirty. Mounting read-only. Run chkdsk and mount in Windows.
ntfs: (device sda1): load_system_files(): $LogFile is not clean. Will not be able to remount read-write. Mount in Windows.
I don't know what to do now. Where did I go wrong? I'm thinking that I might need to configure the permissions in the configuration file of autofs, but I'm unsure due to the message above.
I would be open on suggestions of changing the partition format to something more appropriate if ntfs is NOT suggested to be used as a shared mount!