[LINUX] Workaround to the databases working on a share (NFS/SAMBA)
#1
Hello,

I know this has been brought up a number of times, but I would like to share my progress on getting XBMC to use a Library as well as the Thumbnails stored on a NFS Server (Windows Home Server in my Case).

First I installed NFS as per this guide http://www.networkedmediatank.com/showth...p?tid=1434

With the passwd and group files I also entered in the xbmc user (UID/GID 1000) and created xbmc (user) and xbmcgroup (group) on my home server and mapped those to the respected user/group in the files.

I already had a backup of my DB/thumbs, which I moved over, either you can mount the share (as described below) and copy them, or copy them using WinSCP/another process.

On the XBMC machine:
Code:
sudo apt-get install portmap nfs-common

Create a mount point:
Code:
sudo mkdir /mnt/xbmcshare

Then you can do:
Code:
sudo mount IPADDRESS:/sharename /mnt/xbmcshare

Copy your files to that share if they aren't already.

Rename your DB/Thumbs folders in /home/xbmc/.xbmc/userdata (just in case).

Now its time to Symlink the DB/Thumbs folders:
Code:
ln -s /mnt/xbmcshare/userdata/Database /home/xbmc/.xbmc/userdata/Database
ln -s /mnt/xbmcshare/userdata/Thumbnails /home/xbmc/.xbmc/userdata/Thumbnails

Now you should have everything working, but you want the share to mount on boot, so edit fstab:

Code:
sudo nano /etc/fstab
Add this to the bottom (no not remove anything else or you will have a hell of a time getting back in)...
Code:
IPADDRESS:/sharename /mnt/xbmcshare nfs rw,hard,intr 0 0

Exit and Save changes.

Reboot and everything should be working (if you're using a slow flash drive DB changes should be much faster).

If currently using this setup on two different machines to share the watch status between machines, one is set to update the library on Start-Up, while the other is not (just in-case they both start at the same time and cause Mayhem). So far so good, no issues with corruption, but I do recommend backing up the Database in-case something goes wrong.

I know this isn't supported functionality, by the XBMC team or even with a sqlite DB, but it is working well for me, YMMV.

FYI, this can also be done with a SAMBA share, but (a big but), I was unable to get it working properly on a Windows SAMBA share (even after disabling Oplocks as was suggested by Googling), I could read the DB fine, but when I went to update the DB it would hang and I would get a MyVideos34.journal file and XBMC would hang. I did get it working on a share from a FreeNAS VM I was running, but it was more overhead.

For SMB you need to install the following:
Code:
sudo apt-get install smbfs smbclient

And to mount the share at Start-up add this to fstab:
Code:
//homeserver/xbmc /mnt/xbmcshare smbfs uid=1000,gid=1000,sync,username="",password="" 0 0
(I'm using a Blank Username/Password) and my xbmc user has a uid/gid of 1000, which must be set so XBMC can Write to the DB.

That should cover it, good luck and make a backup, no one is responsible for your data...except you!

-Markus
Reply
#2
Thanks for the tip.

In addition I am considering moving some other directories and files (Keymap...) off to my server also for easier access/editing.
Reply
#3
Thank you for the tutorial.

I tried setting it up using a smb share on my nas.
Copied the files onto the mounted share as xbmc user. Renamed the db/thumbs dirs locally, added the symlinks and edited the fstab. When booting the xbmc it hangs in the 2nd bootscreen.

Code:
lrwxrwxrwx  1 xbmc xbmc    31 2010-01-21 01:03 Database -> /mnt/libshare/userdata/Database
lrwxrwxrwx  1 xbmc xbmc    33 2010-01-21 01:03 Thumbnails -> /mnt/libshare/userdata/Thumbnails

The nas is running on BusyBox v1.1.0 Linux.

Where should i find the "MyVideos34.journal" journal file?
When it hangs in the 2nd bootscreen i can connect via ssh and have rw access to the DB/Thumbs dirs using the symlinks.
Reply
#4
markus101 Wrote:And to mount the share at Start-up add this to fstab:
Code:
[size=x-small]//homeserver/xbmc /mnt/xbmcshare [b]smbfs [/b]uid=1000,gid=1000,sync,username="",password="" 0 0[/size]

Shouldn't this be "cifs"? And I think the uid/gid stuff is deprecated. Can't quite remember.
Reply
#5
smbfs worked for me using FreeNAS as the SMB server. the UID/GID was required for me when I did it on 9.04.

In my testing the journal file meant something wasn't working right, but I never had freezing issues. Does the XBMC owner have read/write permissions as well as being the owner? That was the major reason for the UID/GID stuff.

I'm no longer using SMB as NFS works better for HomeServer and the ownership/permission stuff is properly saved... except for a few minor issues that came up when rebooting it's been great.

_netdev in the options section fixed that for me though. Sorry I can't shed any light on the issue.

-Markus
XBMC-Livingroom:
Zotac IONITX-A|4GB RAM|20GB 2.5" HDD|Windows 7 Ulitmate|Video/Audio: HDMI to 1080P Samsung LNT4669
XBMC-Bedroom:
HP A1420N|1GB RAM|200GB HDD|Windows 7 Ultimate|Radeon 24000HD|Video: DVI to HDMI on Samsung 720P TV|Audio: Over Analog to TV
Reply
#6
Just applied this and it works great as long as the paths to the media are the same on both servers!

Now i have all my media on a NAS, NFS shares for library and media then away i go both on my ASROCK in the living room and PC in my bedroom Big Grin
Reply
#7
G10CHY Wrote:Now i have all my media on a NAS, NFS shares for library and media then away i go both on my ASROCK in the living room and PC in my bedroom Big Grin

Isn't is great! Smile I wish it was natively supported - I had a DB corruption the other day, going to have to make regular backups, ended up having to go back almost 2 months and re-mark shows as watched. I think it was updating the DB at the same time I finished something on the other XBMC box in my bedroom and it caused it to break, not 100% sure though. In any event I'm back up.

Have you noticed any issues with it mounting on boot up? I had to add _netdev to the options in fstab on my Atom box or it won't mount and even then it usually still doesn't mount most times on a reboot, but the other PC (which actually goes to sleep) when I'm not watching it has been flawless thus far *knocks on wood*.

-Markus
XBMC-Livingroom:
Zotac IONITX-A|4GB RAM|20GB 2.5" HDD|Windows 7 Ulitmate|Video/Audio: HDMI to 1080P Samsung LNT4669
XBMC-Bedroom:
HP A1420N|1GB RAM|200GB HDD|Windows 7 Ultimate|Radeon 24000HD|Video: DVI to HDMI on Samsung 720P TV|Audio: Over Analog to TV
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX] Workaround to the databases working on a share (NFS/SAMBA)0