Page 1 of 1

SQlite issue with CIFS share

Posted: November 8th, 2011, 9:51 am
by mkeybhoy
Hi all,

longtime sabnzbd user on windows, and have recently moved across to Ubuntu as running sabnzb 24x7 in a windows7 virtual machine was too much overhead. Everything went well installing, however I like to have my admin directory in the same folder structure as my downloads, so redirected it to my cifs share

\nzb
\nzb\complete
\nzb\incomplete
\nzb\admin
\nzb\logs

this worked fine except history1.db was always 0 bytes, and I was warned that database was locked. Sabnzbd worked fine, but I never had any history showing. I did some trawling and found a known issue with sqllite and CIFS shares. Unless the parameter nobrl is used when mounting the share, sqllite gets its knickers in a twist. So my

/etc/fstab finally looks like

/etc/fstab

Code: Select all

//192.168.1.xyz/nzb /home/myuser/winshare cifs defaults,rw,iocharset=utf8,codepage=cp850,uid=1000,gid=1000,noauto,user,username=myshareuser,password=mysharepassword,file_mode=0777,dir_mode=0777 0 0
I then mount my share in /etc/rc.local, then run sabnzbd for the first time (having stopped it autorunning at boot - see command below - due to it starting before my shares had mounted)

Code: Select all

$ sudo update-rc.d -f sabnzbdplus
/etc/rc.local

Code: Select all

mount.cifs //192.168.1.xyz/nzb /home/myuser/winshare -o noperm,forceuid,uid=myuser,user=myshareuser,pass=mysharepassword,nobrl

Code: Select all

/etc/init.d/sabnzbd start
I also did

Code: Select all

sudo chmod u+s /sbin/mount.cifs
as part of a process to get the share to mount at boot time as my user rather than root. Never did manage it (winshare is still owned by root after mounting) but sabnzbd working fine now. Hope this helps someone out.

Re: SQlite issue with CIFS share

Posted: November 8th, 2011, 11:18 am
by shypike
Don't put the sqlite database on a share.
The SQLite library requires native file locking and shares may not support it sufficiently.
I advise to put the admin folder only on local storage.
Preferably also the "temporary download folder", since it will generate a lot of competing network traffic.

Re: SQlite issue with CIFS share

Posted: November 8th, 2011, 4:22 pm
by jcfp
In addition to that, on the Linux sysadmin side, network shares can be mounted directly from /etc/fstab. That even includes the possibility of securely storing the necessary credentials in a separate file. Google knows how.

Re: SQlite issue with CIFS share

Posted: November 8th, 2011, 7:10 pm
by mkeybhoy
Cheers for the info guys. Hear what you are saying about the admin folder. It's working OK at the moment, but I guess not optimally. I did read some recommendations about using a credentials file, but I was just happy to get it working today. That'll be one for another day.

My reason for having the incomple folder also on a share is that, from experience, it tends to grow quite large (currently about 11Gb) which I'd like to keep away from my minimalist ubuntu install (256Mb, 4Gb hard disk)