Remote shares auto-mount

Remote shares auto-mount

Postby mdi » Wed Oct 30, 2013 9:11 am

Hi guys,
I use a remote share as a backup destination. What would be the best way to mount it automatically after a NAS reboot?

Now, everytime that I have a power blackout or I reboot the nas, I have to remember to remount it manually, otherwise I get no backup.

Thanks,
MDI
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm

Re: Remote shares auto-mount

Postby Jocko » Wed Oct 30, 2013 10:48 am

Now, everytime that I have a power blackout or I reboot the nas, I have to remember to remount it manually, otherwise I get no backup.

At least the last changes work well because previously,the files was saved to the data partition if the remote share was no longer available...:whistle

Otherwise, we could add an option to auto-mount these remote shares
Note play with fstab is not a good way because it's overwritten at each booting.

if you have linux acknowledge you can create a shell script which checks if the remote share are still mounting and if not it remounts it.
Then before your backup cron job add a new job to perform your shell.

Note:
to detect if a remote samba share is mounted:
Code: Select all
mount |grep -c '//remoteIP/remotesharename on /share/1000'
return 1 if is there. (of course replace remoteIP and remotesharename by the relevant value)
and for mounting a remote samba share
- clean a maybe orphan mount :
Code: Select all
umount /mnt/remote_share_mount_dir/remoteIP-smb-remotesharename
- and mount the share:
Code: Select all
mkdir -p -m 777 /mnt/remote_share_mount_dir/remoteIP-smb-emotesharename
mount -t cifs //remoteIP/remotesharename /mnt/remote_share_mount_dir/remoteIP-smb-emotesharename -o rw,iocharset=utf8,username=yourlogin,password=yourpasswd
mount -o bind /mnt/remote_share_mount_dir/remoteIP-smb-remotesharename /share/1000/remoteIP-smb-remotesharename


---edit---
attached a shell script type. you must replace each remoteIP, remotesharename, your login and your password by their relevant value.
You do not have the required permissions to view the files attached to this post.
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Remote shares auto-mount

Postby firwareslut » Thu Oct 31, 2013 1:30 pm

fstab seldom works correctly for auto mounting of network shares since it tries to mount them before the network is instigated.

You can try editing your cron command manually and putting

@reboot sleep 15; mount /mnt/remote_share_dir
firwareslut
Donator VIP
Donator VIP
 
Posts: 202
Joined: Thu Oct 06, 2011 11:53 am


Return to Lacie Network Space vs2 and max version

Who is online

Users browsing this forum: No registered users and 3 guests