Use digiKam with a NAS and MariaDB

Hello,

I’ve finally moved my digiKam photo library to a NAS and migrated digiKam’s SQLite databases to MariaDB. I documented the entire process here:

https://scribblesandsnaps.com/2018/10/19/use-digikam-with-a-nas-and-mariadb/

Hope you’ll find this useful.

Kind regards,

Dmitri

1 Like

Did you compare the performance difference between using SMB vs NFS on your qnap? In my environment, with a Linux client, read performance is noticeably better over NFS.

A couple of comments:

`sudo` `mount` `-t cifs ` `//ipaddress/path/to/dir` `/path/to/local/dir` `-o user=` `"user"` `,password=` `"password"` `,uid=$(` `id` `-u),gid=$(` `id` `-g)`

I would recommend against passing your password in plain text via the command line. Instead, use a credentials file and lock down the permissions.

Using a script to mount the files before launching digikam seems like it is an over-complicated solution. Why not just mount it your fstab or using a systemd mount file? No only would it remove the complexity of having to modify anything that launches digikam and change it to use the script but it would eliminate the need for this:

user ALL = NOPASSWD: /usr/bin/mount

I did the same thing some time ago but I found that loading thumbnail is slower with this setup.

Did you experience the same thing ?

I did. SMB is perceptibly faster than NFS.

You are absolutely right. However, I’m doing this on a local network via Ethernet, so the risk is minimal.

Because, I’m using a laptop as my primary machine. I carry it around, so I don’t always have access to QNAP.

Best,
Dmitri

Yes, but this is only noticeable with large albums (1000+ photos). Usually, I organize photos by projects, and each project album normally contains 3000-500 items.

Best,
Dmitri

I noticed this with album containing ~200 items. I increase bandwidth between my server and my computer but still have noticeable loading time for thumbnail. What are your settings for your MariaDB server / Digikam ?

Do you have any specific settings in mind? I don’t think this has anything to do with MariaDB or digiKam, rather the network settings. I set up mine as described here: https://www.qnap.com/en-us/how-to/tutorial/article/how-to-use-smb-3-0-in-qts-4-2/ (including large MTU but no encryption).

Interesting, are you using a wireless network?

The only times I see SMB to be faster is when doing a high degree of concurrent writes or when the network is unreliable.

Even if you decide the risk is acceptable for your situation, it seems like it would be worth mentioning to your readers that doing it that way is insecure.

You could use a systemd automount or autofs. Then it would be mounted whenever it is needed.

Ethernet via powerline adaptors.

You are right.

I have no idea how to do that, and I’d be grateful if you could give me an example.

Thanks,
Dmitri

If you are using a Linux distro that uses systemd(At this point is almost all of them use systemd), you can use this in your fstab:

//servername/sharename /path/to/mount cifs x-systemd.automount,x-systemd.idle-timeout=1min,rw,uid=yourusername,gid=yourgroupname,credentials=/etc/samba/private/sharename.cred,iocharset=utf8,vers=2.0 0 0

Some notes:

  • The uid and gid fields accept names as well as ids
  • The credentials option is how you keep the username and password out of a world readable file like /etc/fstab. However, if you prefer you can replace it with user & password the same way you did in your mount command.
  • Instead of putting it in the /etc/fstab you can optionally create systemd mount file but since most distros put all the other mounts in /etc/fstab still, I usually put it there.
  • If you are using a distro that doesn’t use systemd you can use autofs instead.

No I don’t. I’m far from expert in this area. My server only have a 100M Ethernet card, so based on your comment that should be my problem.

I’m looking for a replacement with a Gigabit card.

@dalto Thank you very much!