Skip to main content

TCFJR

Syncthing Fix

I use Syncthing to synchronize files between various systems in my extended homelab. There are currently five systems using Syncthing - a primary NAS server and a backup NAS server based in Texas, a laptop running Ubuntu Server 24.04 currently based with me in Ireland (and known as the Blackrock server), my personal Asus laptop running Windows 11, and a Digital Ocean VPS running Ubuntu Server 24.04. (I have a couple of other devices in the Tailnet - my Pixel 6 phone, and the travel Chromecast.)*

Because of bandwidth and disk space concerns, not all systems sync all of the directories. The primary NAS has a single ‘media’ directory that has subdirectories for various categories - TV shows, Movies, Audio Books, Music, etc. The TV content is actually kept in three separate directories - tv for main content, tvextra for less visited, more niche content, and tvspecial for a couple of series that seem to cause Plex a lot of grief. The Blackrock system syncs most of these directories, but not all.

From time to time, a TV series is added to the main ’tv’ directory at first, but over time it gets reclassified as a ’tvextra’ series. Originally, I’d use Sonarr to move the series from ’tv’ to ’tvextra’, and since both of these directories are under the ‘media’ directory the move is made using hard links, making the move instantaneous.

However, this causes Syncthing on the Blackrock server to: a) delete the series directory from ’tv’; and b) recopy the series directory from the NAS to a new directory under ’tvextra’. In the end everything winds up where it should be, but at the cost of time and bandwidth.

The obvious soluttion to this is to: a) pause sync on the Blackrock server; b) manually move the affected series directories from ’tv’ to ’tvextra’ on both the NAS and the Blackrock server; and c) restart the sync. Both sides of the sync will spin while they figure things out, but after a minute or two they both report a full sync, with no need to copy anything from one server to the other.

* Note: I just added my Samsung Tab A9+ to the tailnet - handy when you’re out and about but the phone isn’t quite big enough to meet your needs. It now syncs the Obisidian vault and the KeePass database folder.

Blackrock Server Updates

Before we came to Ireland for extended stays, I setup an old Dell laptop to be the media server while we travel. This system runs Ubuntu 24.04 Server with a GUI, and makes it possible for us to watch our ripped movies and related media. I use Tailscale to securely access my remote systems, and in the Tailnet this server has the uninspired hostname of dell4800.

I made a couple of updates today to make my day-to-day maintenance work more efficient.

First, I set up SSH on dell4800 with key-based authentication, and disabled password authentication. On my Windows 11 laptop, I generated a fresh set of SSH keys, and used ssh-copy-id to copy the .pub file to dell4800. I can now open a terminal session on dell4800 from my Windows laptop without a password. (The Tailnet provides ample security.)

Next, I installed and configured Samba, the Linux/Unix app that provides SMB/CIFS file sharing services. I added the dell4800 media directory as a share, and can now mount the directory on my Windows laptop.

dell4800 runs Syncthing in a Docker container managed by Portainer, and automatically syncs various folders from my main Synology DS220+ NAS system currently based in Texas over the Tailnet.

Nothing earth-shattering, but these tools make it easier and more efficient for me to do routine maintenance on the Syncthing target directories.

Vim Note

I use the vim editor to write these posts, and prefer not to use vim’s automatic line-wrapping. There are times when longer lines are necessary, so I like to manually wrap lines when needed.

In blog posts like this, paragraphs are separated by a blank line. To wrap the lines in a single paragraph, use this key sequence:

:gq}

: opens command mode, gq is the wrap command which must be followed by a movement command. } moves to the next empty line. Put them altogether and the current paragraph is wrapped to the defined line width, which defaults to 80.