wocketpatch
Posts: 13
Joined: Sun Apr 19, 2015 11:01 pm

Help with maintaining mounted smb file location

Sat Sep 12, 2015 3:43 am

Hi, I did a couple searches but there are a lot of threads about SIMILAR issues that I couldn't quite put together to solve mine, so figured I'd post a thread more specific.

I've got Deluge 1.3 running headless under Wheezy, administering using the ThinClient and SSH for command line stuff.

I created a folder called /mnt/incoming and set the owner to the user I called deluge, and then put the following line in my fstab:

Code: Select all

//192.168.1.254/incoming  /mnt/incoming  cifs  defaults,uid=deluge,gid=deluge  0 0
This mounts the Samba share "incoming" on my NAS, as a writable folder in Debian.
In other words, I have most of my torrents in Deluge downloading to /mnt/incoming which saves them to the incoming folder on my NAS and this all seems to work very well..

except for one kinda big problem.

If the NAS loses connection for any reason then the mount point entered in fstab is lost and Deluge sees the /mnt/incoming folder I created as a normal empty (local) folder and starts all my torrents over at 0%, now downloading them into this folder locally.

So far this is the only thing holding me back from letting this thing run unattended 24/7, because I have to somewhat actively monitor whether the NAS is still mounted.

Is there a way to tell Deluge not to write to the folder if it is not mounted? Or perhaps to use some kind of key file stored on the NAS in the directory to check some kind of "if exist" statement before writing, to show that the connection is established? Or am I going about this whole thing the wrong way in the first place? Mounting it like this seems to work great until there is a network problem and then it really messes the bed. I'd like Deluge to just stop transferring files to that folder until I notice the issue -- but open to other suggestions as well. Thank you!

wocketpatch
Posts: 13
Joined: Sun Apr 19, 2015 11:01 pm

Re: Help with maintaining mounted smb file location

Sat Sep 12, 2015 3:43 am

I should add that the worst part of this is that each time it happens, after I SSH in to mount the share again and restart the deluge daemon, it has to recheck all my completed torrents over smb. The network speed is totally adequate for saving and seeding torrents, but re-checking half of a TB of data takes basically all night before I'm back up and running again. So, I'm very motivated to find a solution before the next time.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Help with maintaining mounted smb file location

Sat Sep 12, 2015 6:33 am

with the current system cifs mount not really work at boot.
you would need like
wait
sudo mount -a
wait
start deluge ...
( and i not know how and where to do that )
so for a torrent server by RPI i think a ext4 formatted USB HDD on the RPI might be best.

User avatar
jojopi
Posts: 3270
Joined: Tue Oct 11, 2011 8:38 pm

Re: Help with maintaining mounted smb file location

Sat Sep 12, 2015 7:00 am

wocketpatch wrote:If the NAS loses connection for any reason then the mount point entered in fstab is lost and Deluge sees the /mnt/incoming folder I created as a normal empty (local) folder and starts all my torrents over at 0%, now downloading them into this folder locally.
The empty directory that serves as a mount point should be owned by root, and should only be writeable by root. Deluge should not be running as root, so it cannot write there.

If you need to check whether a filesystem is mounted, the mountpoint command from util-linux will do that:

Code: Select all

if mountpoint /mnt/incoming; then
  deluged
else
  # problem
fi
Is the CIFS unavailable at boot time, or does it mount but then fail later? In the latter case, most programs will stay in the broken filesystem and/or crash, rather than falling through to the underlying disk.

wocketpatch
Posts: 13
Joined: Sun Apr 19, 2015 11:01 pm

Re: Help with maintaining mounted smb file location

Mon Sep 14, 2015 9:33 am

Thanks for the responses, looks like changing the folder owner back to root did the trick. I had thought the folder needed the write permissions to match, I didn't realize the owner settings in fstab would override the filesystem permissions, although I guess it does make sense that they do. So now if the mount is set then deluge is the owner and can write to the folder. If not then it gets an error in the program which is exactly what I was after. The script idea looks like it would have worked too, thanks again!

Return to “Troubleshooting”