<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Synology on blog.iankulin.com</title><link>https://blog.iankulin.com/tags/synology/</link><description>Recent content in Synology on blog.iankulin.com</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Mon, 28 Jul 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.iankulin.com/tags/synology/index.xml" rel="self" type="application/rss+xml"/><item><title>Getting Ghostty to Work on Synology</title><link>https://blog.iankulin.com/getting-ghostty-to-work-on-synology/</link><pubDate>Mon, 28 Jul 2025 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/getting-ghostty-to-work-on-synology/</guid><description>&lt;p&gt;Ghostty is a terminal application that I don&amp;rsquo;t really &lt;em&gt;need&lt;/em&gt; (it&amp;rsquo;s &lt;a href="https://ghostty.org/docs/about"&gt;listed features&lt;/a&gt; either already exist in the MacOS terminal, or seem so esoteric or marginal that I can&amp;rsquo;t imagine any real benefit from them in my normal use), but I &lt;em&gt;wanted&lt;/em&gt; to be one of the cool kids, so I thought I&amp;rsquo;d give it a try.&lt;/p&gt;
&lt;p&gt;After fiddling around with the themes for a bit I renamed it to &amp;rsquo;term-ghosty.app&amp;rsquo; so I&amp;rsquo;d remember to use it (ie when I pop up spotlight and type &amp;rsquo;term&amp;rsquo; it will come up) and got on with my day. Ten minutes later I&amp;rsquo;d run into a problem.&lt;/p&gt;
&lt;h3 id="the-problem"&gt;The Problem&lt;/h3&gt;
&lt;p&gt;I was ssh&amp;rsquo;d into a Synology NAS, and needed to use a command from two commands ago, in my long experience, pressing the up arrow twice works universally well, but not in Ghostty on this host:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-11.31.38.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;This is a purely visual glitch - if I press return at this stage, it will run &lt;code&gt;command one&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;My first thought was to CTRL-U to clear the line:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-11.32.00.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;I guess not. Oh well, lets &lt;code&gt;clear&lt;/code&gt; and try all this again.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-11.32.07.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;So - a clue. This is a Ghostty problem, not a weird shell issue. Also, this wasn&amp;rsquo;t just a visual thing - the command was also not working.&lt;/p&gt;
&lt;p&gt;I logged in with regular terminal to confirm that everything was still working with that.&lt;/p&gt;
&lt;h3 id="xterm-ghostty"&gt;xterm-ghostty&lt;/h3&gt;
&lt;p&gt;If you google &amp;lsquo;ghostty arrow history problem&amp;rsquo; you&amp;rsquo;ll likely find a number of github issues that are all closed after the developer has posted a link to &lt;a href="https://ghostty.org/docs/help/terminfo#ssh"&gt;this part of the docs&lt;/a&gt; explaining that you need to compile the Ghostty&amp;rsquo;s terminfo into the config on this host.&lt;/p&gt;
&lt;p&gt;At first I was a bit aghast at this complicated solution - but we need to keep in mind this is a terminal program that I&amp;rsquo;m sure is only used by tech orientated people who love fiddling with things. This is reflected in other design choices in Ghostty (going into &amp;lsquo;Settings&amp;rsquo; from the menu just opens the config file in a text editor).&lt;/p&gt;
&lt;p&gt;I downloaded &lt;a href="https://iterm2.com/index.html"&gt;iTerm2&lt;/a&gt; as a likely competitor to Ghostty and tried it on the same host - everything worked perfectly. I tried Ghostty on several of my VM&amp;rsquo;s, VPS&amp;rsquo;s and LXC&amp;rsquo;s. All no problem. So what&amp;rsquo;s going on?&lt;/p&gt;
&lt;h3 id="whats-going-on"&gt;What&amp;rsquo;s Going On?&lt;/h3&gt;
&lt;p&gt;If you open your terminal, and type &lt;code&gt;echo $TERM&lt;/code&gt; it will tell you the &lt;code&gt;TERM&lt;/code&gt; value. This is used by the shell to know how to interpret the inputs it&amp;rsquo;s receiving (for example, what to do when the user wants to &lt;code&gt;clear&lt;/code&gt; the screen). Unless you are using Ghostty, it will almost certainly be set to &lt;code&gt;xterm-256color&lt;/code&gt;&lt;/p&gt;
&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-12.03.36.png" width="808" alt=""&gt;
&lt;p&gt;In Ghostty, it will say &lt;code&gt;xterm-ghostty&lt;/code&gt;&lt;/p&gt;
&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-12.04.55.png" width="772" alt=""&gt;
&lt;p&gt;The reason I don&amp;rsquo;t have this same problem with Ghostty on my MacBook or the Debian base hosts is that those operating systems have the Ghostty &amp;rsquo;terminfo&amp;rsquo; entries in them, whereas apparently Synology does not (or not yet anyway).&lt;/p&gt;
&lt;p&gt;But that does that explain why iTerm2 works on Synology. Let&amp;rsquo;s look at it&amp;rsquo;s TERM value.&lt;/p&gt;
&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-12.12.45.png" width="882" alt=""&gt;
&lt;p&gt;Ah, so it&amp;rsquo;s just claiming to be xterm-256color the same as the mac terminal emulator - which all hosts will know since it&amp;rsquo;s an ancient thing. (xterm is the terminal from the X-Windows systems of the 1980&amp;rsquo;s).&lt;/p&gt;
&lt;p&gt;This is a developer choice, Ghostty could also claim it was an xterm-256color and this problem would not have popped up. I&amp;rsquo;m assuming they have decided this short term pain is worth it for some long term gain (of being able to do things an xter-256color terminal emulator can not).&lt;/p&gt;
&lt;h3 id="choices"&gt;Choices&lt;/h3&gt;
&lt;p&gt;Now we have two choices to fix this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Override the TERM choice the Ghostty developer has made for this host&lt;/li&gt;
&lt;li&gt;Compile the correct &lt;code&gt;terminfo&lt;/code&gt; into the config on this host&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Option one means we&amp;rsquo;d lose any special sauce Ghostty does (which I already said I don&amp;rsquo;t need, but could conceivably regret in the future if they do something cool).&lt;/p&gt;
&lt;p&gt;Option two feels like the proper (and is the one that Ghostty recommends).&lt;/p&gt;
&lt;p&gt;I suppose there is a third choice - wait until Synology includes the Ghostty terminfo in their distro. I get the vibe from the slightly scary MOTD when I ssh in that they would really prefer you did not, so I can&amp;rsquo;t seem them going out of their way to include it. Also they are not based on another distro as far as I can see, so they are not going to accidentally include it from an upstream. I feel this choice will never bear fruit.&lt;/p&gt;
&lt;h3 id="overriding-the-term"&gt;Overriding the TERM&lt;/h3&gt;
&lt;p&gt;ssh can have a config set for a host so we can override the TERM value. If you have something like this in &lt;code&gt;~/.ssh/config&lt;/code&gt; we can fix the issue.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Host NAS-DS2
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; SetEnv TERM=xterm-256color
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-12.46.46.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;And everything works again - I can up arrow to access the history without problems and the &lt;code&gt;clear&lt;/code&gt; command works as advertised. Note that I didn&amp;rsquo;t need to reload the ssh config - it gets read every time you run the ssh command.&lt;/p&gt;
&lt;p&gt;An extra reason for using this approach is that if you have a good naming convention for your hosts (I worked in the &amp;lsquo;data processing&amp;rsquo; department of a bank in the 1990&amp;rsquo;s so I learned good naming conventions for hosts) then you can wild-card this entry to for all of them. You might have guessed that all the Synology NAS&amp;rsquo;s I manage are named &lt;code&gt;NAS-DS&amp;lt;some positive integer&amp;gt;&lt;/code&gt;. Let&amp;rsquo;s change the config to say:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Host NAS-DS*
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; SetEnv TERM=xterm-256color
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-12.51.17.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;Nice. If I had hundreds of these to deal with, that&amp;rsquo;s definitely the solution I&amp;rsquo;d be going for. Also, if you&amp;rsquo;ve come here because you had this exact problem stop here. This is the best you are going to do.&lt;/p&gt;
&lt;h3 id="installing-the-terminfo"&gt;Installing the terminfo&lt;/h3&gt;
&lt;p&gt;The alternate approach is to extract the xterm-ghostty &lt;code&gt;terminfo&lt;/code&gt; off the current machine (in my case a MacBook) to the other host, and compile it into the available &lt;code&gt;terminfo&lt;/code&gt;&amp;rsquo;s there. This seems more invasive, but it&amp;rsquo;s a per user thing and can be reversed.&lt;/p&gt;
&lt;p&gt;The command given in the &lt;a href="https://ghostty.org/docs/help/terminfo#ssh"&gt;Ghostty docs&lt;/a&gt; is:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;infocmp -x xterm-ghostty | ssh YOUR-SERVER -- tic -x -
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s try it:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2025-07-26-at-13.02.16.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;This is not that surprising - Synology DSM is minimal (I think it uses busybox) so it&amp;rsquo;s missing lots of these commands. You might think that&amp;rsquo;s okay, I&amp;rsquo;ll compile it on this machine then &lt;code&gt;scp&lt;/code&gt; it across. That would be something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;infocmp -x xterm-ghostty &amp;gt; xterm-ghostty.src
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tic -x -o ./terminfo xterm-ghostty.src
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;scp -r ./terminfo/78 ds2_admin@NAS-DS2:~/.terminfo/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But that won&amp;rsquo;t work because you don&amp;rsquo;t have &lt;code&gt;scp&lt;/code&gt; on the Synology either. So perhaps you think you&amp;rsquo;ll enable rysnc in the NAS GUI and rsync the file in:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -av ./terminfo/78 ds2_admin@NAS-DS2:~/.terminfo/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Which will copy the file over, but it still won&amp;rsquo;t work. It&amp;rsquo;s just too minimal.&lt;/p&gt;
&lt;p&gt;I imagine this process works for other distros or it wouldn&amp;rsquo;t be in the Ghostty docs. But it does not work for Synology NASs in 2025.&lt;/p&gt;</description></item><item><title>rsync between Synology NAS</title><link>https://blog.iankulin.com/rsync-between-synology-nas/</link><pubDate>Mon, 30 Sep 2024 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/rsync-between-synology-nas/</guid><description>&lt;p&gt;A while ago, I devised a complicated system where I could drop files in a web interface running on an LXD container and the files would then magically appear in a directory on a remote NAS in the morning. It turned out to not be very robust, and I gave up on it after a while.&lt;/p&gt;
&lt;p&gt;Also, really there should be no need for it - underneath, it was just using &lt;code&gt;rsync&lt;/code&gt; to move the files, so why not just do that direct from one NAS to another? Well, mainly because my NASs are all Synology - which I love, and they&amp;rsquo;ve been great, but in an effort to make them usable by muggles, Synology tend to somewhat complicate things for Linux command line wizards.&lt;/p&gt;
&lt;p&gt;It turns out to be totally possible to command line &lt;code&gt;rsync&lt;/code&gt;, including doing it over Tailscale, but there&amp;rsquo;s a couple of gotchas along the way.&lt;/p&gt;
&lt;h3 id="rsync-the-synology-way"&gt;rsync the Synology way&lt;/h3&gt;
&lt;p&gt;A reasonable question would be why didn&amp;rsquo;t I use the Synology rsync user interface to do all this - it&amp;rsquo;s right there in Control Panel / File Services? I did actually look at doing that, but after five minutes I couldn&amp;rsquo;t figure it out, so yeah na. It&amp;rsquo;s the command line for me.&lt;/p&gt;
&lt;h3 id="steps"&gt;Steps&lt;/h3&gt;
&lt;p&gt;The plan for the rest of this post is just to run through, in approximate order, the steps you&amp;rsquo;ll need to take to get &lt;code&gt;rsync&lt;/code&gt; working from the command line to sync files between two synology NASs. It&amp;rsquo;s probably also helpful between a real system and a Synology NAS. I&amp;rsquo;m going to talk about the &amp;rsquo;local&amp;rsquo; NAS (where we&amp;rsquo;ll be running the rsync command) and &amp;lsquo;remote&amp;rsquo; one. This is just for convenience - you might have two local or two remote NASs - I don&amp;rsquo;t judge. I&amp;rsquo;m just calling mine &amp;rsquo;local&amp;rsquo; and &amp;lsquo;remote&amp;rsquo; for this post that so you know which device I&amp;rsquo;m talking about.&lt;/p&gt;
&lt;h4 id="ssh"&gt;ssh&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;rsync&lt;/code&gt; works over an ssh connection, so you need to be able to ssh from one NAS to another without entering a password first. To test it, ssh into the local NAS, then without logging out, ssh into the remote NAS from the local one. If that works without asking for a password you&amp;rsquo;ve completed this step and can just ctrl-D to drop back to the local NAS.&lt;/p&gt;
&lt;p&gt;If the issue is that it asked for a password, that just means you need to install your public ssh keys on the remote. I usually do this with the &lt;code&gt;ssh-copy-id&lt;/code&gt; command on regular Linux, Mac and BSD systems, but that&amp;rsquo;s not available at the Synology command line so we&amp;rsquo;ll have to do it the old fashioned way.&lt;/p&gt;
&lt;p&gt;Anything to do with ssh is stored in a hidden directory, &lt;code&gt;.ssh&lt;/code&gt; in a user&amp;rsquo;s home directory. For example you can check you&amp;rsquo;ve got public keys with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ls -la ~/.ssh/id_rsa.pub
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;These are the keys you want to add to the remote NASs authorised keys, so we&amp;rsquo;ll use ssh (with a password) to add them to the end of that file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ssh &amp;lt;user&amp;gt;@&amp;lt;remote NAS address&amp;gt; &amp;#39;cat &amp;gt;&amp;gt; ~/.ssh/authorized_keys&amp;#39; &amp;lt; ~/.ssh/id_rsa.pub
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You need to substitute your remote NASs username and address, so mayby it would look like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ssh nas1_admin@83.78.2.105 &amp;#39;cat &amp;gt;&amp;gt; ~/.ssh/authorized_keys&amp;#39; &amp;lt; ~/.ssh/id_rsa.pub
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When you execute this, it will ask for the remote password, but once it&amp;rsquo;s worked you should be able to ssh in and it allows that without using a password.&lt;/p&gt;
&lt;h4 id="tailscale-out"&gt;Tailscale out&lt;/h4&gt;
&lt;p&gt;Perhaps you didn&amp;rsquo;t get as far as needing the ssh password, because when you tried to ssh to the remote, ssh didn&amp;rsquo;t even recognise the domain. If you are using Tailscale to connect your devices (which I recommend) then there are two tricks needed.&lt;/p&gt;
&lt;p&gt;Trick one is to get around the fact that since DSM 7, Synology have prevented (for good security reasons) external packages from making outbound connections. So you&amp;rsquo;ll be able to use Tailscale to access the Synology web interface, or even ssh &lt;em&gt;into&lt;/em&gt; it, but you won&amp;rsquo;t be able to ssh &lt;em&gt;out&lt;/em&gt; of it. When I first discovered this, I was running &lt;code&gt;ip a&lt;/code&gt; at the command line in the local NAS and noticed that the tailscale IP was not even listed - it was as if Tailscale wasn&amp;rsquo;t running, but I knew it was since I had ssh&amp;rsquo;d in with the Tailscale address.&lt;/p&gt;
&lt;p&gt;Tailscale have a fix for &lt;a href="https://tailscale.com/kb/1131/synology#enable-outbound-connections"&gt;enabling outbound connections via Tailscale on Synology&lt;/a&gt;, you need to run a thing on reboot to enable the TUN.&lt;/p&gt;
&lt;p&gt;Trick two is that even after you&amp;rsquo;ve done that and rebooted and can see the tailscale interface when you run &lt;code&gt;ip a&lt;/code&gt;, you still won&amp;rsquo;t be able to use the Tailscale &amp;lsquo;magic&amp;rsquo; DNS but will have to use the Tailscale IP address for the remote when you ssh (and later rsync) to it. So I can&amp;rsquo;t use:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ssh nas1_admin@NAS-01&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;as I would normally from my laptop, I have to use &lt;code&gt;ssh nas1_admin@104.43.22.181&lt;/code&gt; If you are not sure of the Tailscale IP for your remote, have a look at your &lt;a href="https://login.tailscale.com/admin/machines"&gt;machines list&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id="turn-rsync-on"&gt;Turn rsync on&lt;/h4&gt;
&lt;p&gt;Via the web interface on both Synologys, you&amp;rsquo;ll need to enable rsync. The setting is in &lt;code&gt;Control Panel | File Services | rsync&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2024-08-25-at-1.56.57-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2024-08-25-at-1.56.57-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Leave the port as 22 and don&amp;rsquo;t bother with the other settings, but do hit &lt;code&gt;Apply&lt;/code&gt; at the bottom to save the change.&lt;/p&gt;
&lt;h4 id="give-it-a-try"&gt;Give it a try&lt;/h4&gt;
&lt;p&gt;We&amp;rsquo;re now at the stage where you should be able to ssh into the remote NAS from the local one without being asked for a password, and rsync is turned on both ends, so in theory, you should be able to do something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -rvitn /volume1/ nas1_admin@104.43.22.181:/volume1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;m not going to go into all the flags for rsync (the internet has plenty of good guides for that) except to say that the &amp;rsquo;n&amp;rsquo; on the end of the flags in the command above means that no files will actually be moved, it will do a &amp;lsquo;dry run&amp;rsquo; and tell you what it would have done if you let it.&lt;/p&gt;
&lt;p&gt;Note that if you have a jazillion files, this could take a while, you might be better to limit it to a smaller sub directory such as &lt;code&gt;/volume1/media/music/napster/Metallica&lt;/code&gt;/&lt;/p&gt;
&lt;img src="https://blog.iankulin.com/images/yo-dawg-heard-you.jpg" width="497" alt=""&gt;
&lt;p&gt;The other bit of free rsync advice I&amp;rsquo;ll give you is to look carefully at the source and destination directories in the command above. The source sub directory has a trailing &amp;lsquo;/&amp;rsquo;, the destination does not. If you mess this up you&amp;rsquo;ll be making directories inside your directories dawg.&lt;/p&gt;
&lt;p&gt;In theory once you&amp;rsquo;re at this point, everything should work. But here&amp;rsquo;s a couple of other bumps / thoughts.&lt;/p&gt;
&lt;h4 id="eadir"&gt;@eaDir&lt;/h4&gt;
&lt;p&gt;Synology has a bunch of hidden directories with metadata stuff. My advice is don&amp;rsquo;t mess with them, but also don&amp;rsquo;t sync them over either. Tell rsync to ignore them. Same for the recycle bin.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -rvitn --exclude &amp;#39;*@eaDir*&amp;#39; --exclude &amp;#39;#recycle*&amp;#39; /volume1/ nas1_admin@104.43.22.181:/volume1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="permissions"&gt;Permissions&lt;/h3&gt;
&lt;p&gt;The user that you&amp;rsquo;re ssh&amp;rsquo;ing with needs to have permissions to all the places you are rsync&amp;rsquo;ing files to. Even though I&amp;rsquo;ve only ever had one user for each of my Synology NAS&amp;rsquo;s, and everything has been done by that one user either through the web GUI or command line, the files and directories on my NAS have a mixture of owners (my user and root) and permissions. Someone smarter than me could probably figure out why - and if your NAS has to include files from multiple users etc, you are going to need to do that. Because I like sledgehammers, all I did was ssh into the remote and:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo chown -R nas1_admin:users /volume1/media
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo chmod -R 775 /volume1/media
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="throttling-bandwidth"&gt;Throttling bandwidth&lt;/h4&gt;
&lt;p&gt;If I saturate the downlink at my remote site while I&amp;rsquo;m rsync-ing a bunch of files, the users there will be unhappy when they can&amp;rsquo;t stream video reliability or if they&amp;rsquo;re getting killed in online games due to lag.&lt;/p&gt;
&lt;p&gt;rsync has a flag for that. If we want to limit the transfer bandwidth to 500KB it could look like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -rvitn --bwlimit=500 --exclude &amp;#39;*@eaDir*&amp;#39; --exclude &amp;#39;#recycle*&amp;#39; /volume1/ nas1_admin@104.43.22.181:/volume1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="get-destructive"&gt;Get destructive&lt;/h4&gt;
&lt;p&gt;If you only want to sync the files one way from your local to remote, then we can add a flag that will delete any files on the remote machine that are not present on the local one. Obviously use with care, and run with the -n flag first to see what&amp;rsquo;s going to get chopped.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -rvitn --bwlimit=500 --exclude &amp;#39;*@eaDir*&amp;#39; --exclude &amp;#39;#recycle*&amp;#39; /volume1/ nas1_admin@104.43.22.181:/volume1 --del
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="do-something-else"&gt;Do something else&lt;/h4&gt;
&lt;p&gt;The first few times you do this, it will be exciting watching the terminal window as rsync carefully checks for each file and directory and copies them over as needed, and it will also be helpful to see what errors might pop up so you can sort them out.&lt;/p&gt;
&lt;p&gt;Eventually though, it will be so routine and error free you&amp;rsquo;d rather do something else, so you&amp;rsquo;ll wander off and leave it, then curse when you return to find your laptop turned itself off due to inactivity and wrecked the rsync. Don&amp;rsquo;t panic, rsync is robust and will pick right up next time you run it without damaging any files, but you might also consider doing it all on remote control.&lt;/p&gt;
&lt;p&gt;On the local NAS, create a file called &lt;code&gt;sync-media.sh&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5e81ac;font-style:italic"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;nohup rsync -rvitn --bwlimit&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;&lt;span style="color:#b48ead"&gt;500&lt;/span&gt; --exclude &lt;span style="color:#a3be8c"&gt;&amp;#39;*@eaDir*&amp;#39;&lt;/span&gt; --exclude &lt;span style="color:#a3be8c"&gt;&amp;#39;#recycle*&amp;#39;&lt;/span&gt; /volume1/ nas1_admin@104.43.22.181:/volume1 &amp;gt; sync_media.log 2&amp;gt;&lt;span style="color:#eceff4"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color:#b48ead"&gt;1&lt;/span&gt; &lt;span style="color:#eceff4"&gt;&amp;amp;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make it executable:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;chmod +x sync_media.sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you run it &lt;code&gt;./sync-media.sh&lt;/code&gt; you can log off and let it do it&amp;rsquo;s thing.&lt;/p&gt;</description></item><item><title>Proxmox LXC backup to NFS share failing</title><link>https://blog.iankulin.com/proxmox-lxc-backup-to-nfs-share-failing/</link><pubDate>Wed, 12 Apr 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/proxmox-lxc-backup-to-nfs-share-failing/</guid><description>&lt;p&gt;I was doing updates on all my nodes and VM&amp;rsquo;s today, and backing up the VMs that aren&amp;rsquo;t already on a backup schedule. On my dev machine I have a Debian LXC container that I mostly just use for trying out Linux commands and playing around. I used to have a backup of it that I used a lot - after playing around I like to set it back to a fresh install plus my ssh keys - but I lost it somehow when moving the VM to new metal.&lt;/p&gt;
&lt;p&gt;When I tried to back it up today, I got this drama.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-gdscript3" data-lang="gdscript3"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; starting new backup job&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; vzdump &lt;span style="color:#b48ead"&gt;200&lt;/span&gt; &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;node pve&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;dev1 &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;mode snapshot &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;remove &lt;span style="color:#b48ead"&gt;0&lt;/span&gt; &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;notes&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;template &lt;span style="color:#a3be8c"&gt;&amp;#39;{{vmid}}-{{guestname}} ({{node}}) - after timezone fix&amp;#39;&lt;/span&gt; &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;storage NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2 &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;compress zstd
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Starting Backup of VM &lt;span style="color:#b48ead"&gt;200&lt;/span&gt; &lt;span style="color:#eceff4"&gt;(&lt;/span&gt;lxc&lt;span style="color:#eceff4"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Backup started at &lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;04&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;07&lt;/span&gt; &lt;span style="color:#b48ead"&gt;17&lt;/span&gt;&lt;span style="color:#eceff4"&gt;:&lt;/span&gt;&lt;span style="color:#b48ead"&gt;11&lt;/span&gt;&lt;span style="color:#eceff4"&gt;:&lt;/span&gt;&lt;span style="color:#b48ead"&gt;08&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; status &lt;span style="color:#81a1c1"&gt;=&lt;/span&gt; running
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; CT Name&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; babydeb
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; including mount point rootfs &lt;span style="color:#eceff4"&gt;(&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span style="color:#eceff4"&gt;)&lt;/span&gt; &lt;span style="color:#81a1c1;font-weight:bold"&gt;in&lt;/span&gt; backup
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; backup mode&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; ionice priority&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; &lt;span style="color:#b48ead"&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; create storage snapshot &lt;span style="color:#a3be8c"&gt;&amp;#39;vzdump&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Logical volume &lt;span style="color:#a3be8c"&gt;&amp;#34;snap_vm-200-disk-0_vzdump&amp;#34;&lt;/span&gt; created&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; creating vzdump archive &lt;span style="color:#a3be8c"&gt;&amp;#39;/mnt/pve/NAS-DS2/dump/vzdump-lxc-200-2023_04_07-17_11_08.tar.zst&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; tar&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; &lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;mnt&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;pve&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;dump&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzdump&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;lxc&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;200&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;_04_07&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;17&lt;/span&gt;_11_08&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;tmp&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Cannot open&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Permission denied
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; tar&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Error is &lt;span style="color:#81a1c1;font-weight:bold"&gt;not&lt;/span&gt; recoverable&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; exiting now
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; cleanup temporary &lt;span style="color:#a3be8c"&gt;&amp;#39;vzdump&amp;#39;&lt;/span&gt; snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Logical volume &lt;span style="color:#a3be8c"&gt;&amp;#34;snap_vm-200-disk-0_vzdump&amp;#34;&lt;/span&gt; successfully removed
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ERROR&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Backup of VM &lt;span style="color:#b48ead"&gt;200&lt;/span&gt; failed &lt;span style="color:#81a1c1"&gt;-&lt;/span&gt; command &lt;span style="color:#a3be8c"&gt;&amp;#39;set -o pipefail &amp;amp;&amp;amp; lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 -- tar cpf - --totals --one-file-system -p --sparse --numeric-owner --acls --xattrs &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;xattrs&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;include&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;user&lt;span style="color:#81a1c1"&gt;.*&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;xattrs&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;include&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;security&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;capability&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;warning&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;no&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;file&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;ignored&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;warning&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;no&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;xattr&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;write&lt;span style="color:#a3be8c"&gt;&amp;#39; --one-file-system &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;warning&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;no&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;file&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;ignored&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;directory&lt;span style="color:#81a1c1"&gt;=/&lt;/span&gt;mnt&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;pve&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;dump&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzdump&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;lxc&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;200&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;_04_07&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;17&lt;/span&gt;_11_08&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;tmp&lt;span style="color:#a3be8c"&gt;&amp;#39; ./etc/vzdump/pct.conf ./etc/vzdump/pct.fw &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;directory&lt;span style="color:#81a1c1"&gt;=/&lt;/span&gt;mnt&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzsnap0&lt;span style="color:#a3be8c"&gt;&amp;#39; --no-anchored &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;exclude&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;lost&lt;span style="color:#81a1c1"&gt;+&lt;/span&gt;found&lt;span style="color:#a3be8c"&gt;&amp;#39; --anchored &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;exclude&lt;span style="color:#81a1c1"&gt;=./&lt;/span&gt;tmp&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;&lt;span style="color:#bf616a"&gt;?&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;*&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;exclude&lt;span style="color:#81a1c1"&gt;=./&lt;/span&gt;&lt;span style="color:#81a1c1;font-weight:bold"&gt;var&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;tmp&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;&lt;span style="color:#bf616a"&gt;?&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;*&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;exclude&lt;span style="color:#81a1c1"&gt;=./&lt;/span&gt;&lt;span style="color:#81a1c1;font-weight:bold"&gt;var&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;run&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;&lt;span style="color:#bf616a"&gt;?&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;*.&lt;/span&gt;pid&lt;span style="color:#a3be8c"&gt;&amp;#39; ./ | zstd --rsyncable &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;threads&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;&lt;span style="color:#b48ead"&gt;1&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;gt;/mnt/pve/NAS-DS2/dump/vzdump-lxc-200-2023_04_07-17_11_08.tar.dat&amp;#39;&lt;/span&gt; failed&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; exit code &lt;span style="color:#b48ead"&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Failed at &lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;04&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;07&lt;/span&gt; &lt;span style="color:#b48ead"&gt;17&lt;/span&gt;&lt;span style="color:#eceff4"&gt;:&lt;/span&gt;&lt;span style="color:#b48ead"&gt;11&lt;/span&gt;&lt;span style="color:#eceff4"&gt;:&lt;/span&gt;&lt;span style="color:#b48ead"&gt;09&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Backup job finished with errors
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TASK ERROR&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; job errors
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="https://blog.iankulin.com/could-it-be-a-permissions-problem/"&gt;Permissions&lt;/a&gt;! I was puzzled - the line before (creating the backup file) is working, but not creating the temp file on the same share and directory? Very odd. Backing up a real VM on the same node and to the same share was working fine. Luckily it&amp;rsquo;s a simple, and fast, matter to create a heap of LXCs with different settings and see if the error can be reproduced, so I was soon confidently able to say the problem only existed for unprivileged LXC containers backing up to the share - I didn&amp;rsquo;t have the problem if I used the local disk.&lt;/p&gt;
&lt;p&gt;If I dropped to the console for the node, I could create an identically named file in the same directory with no problems.&lt;/p&gt;
&lt;p&gt;During all that testing, I saw some output that led to more helpful thinking.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-gdscript3" data-lang="gdscript3"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; starting new backup job&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; vzdump &lt;span style="color:#b48ead"&gt;303&lt;/span&gt; &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;storage NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2 &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;compress zstd &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;notes&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;template &lt;span style="color:#a3be8c"&gt;&amp;#39;{{guestname}}&amp;#39;&lt;/span&gt; &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;remove &lt;span style="color:#b48ead"&gt;0&lt;/span&gt; &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;node pve&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;dev1 &lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;mode snapshot
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Starting Backup of VM &lt;span style="color:#b48ead"&gt;303&lt;/span&gt; &lt;span style="color:#eceff4"&gt;(&lt;/span&gt;lxc&lt;span style="color:#eceff4"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Backup started at &lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;04&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;07&lt;/span&gt; &lt;span style="color:#b48ead"&gt;18&lt;/span&gt;&lt;span style="color:#eceff4"&gt;:&lt;/span&gt;&lt;span style="color:#b48ead"&gt;43&lt;/span&gt;&lt;span style="color:#eceff4"&gt;:&lt;/span&gt;&lt;span style="color:#b48ead"&gt;44&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; status &lt;span style="color:#81a1c1"&gt;=&lt;/span&gt; running
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; CT Name&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; apline&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;unpriv
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; including mount point rootfs &lt;span style="color:#eceff4"&gt;(&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span style="color:#eceff4"&gt;)&lt;/span&gt; &lt;span style="color:#81a1c1;font-weight:bold"&gt;in&lt;/span&gt; backup
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; mode failure &lt;span style="color:#81a1c1"&gt;-&lt;/span&gt; some volumes &lt;span style="color:#81a1c1;font-weight:bold"&gt;do&lt;/span&gt; &lt;span style="color:#81a1c1;font-weight:bold"&gt;not&lt;/span&gt; support snapshots
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; trying &lt;span style="color:#a3be8c"&gt;&amp;#39;suspend&amp;#39;&lt;/span&gt; mode instead
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; backup mode&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; suspend
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; ionice priority&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; &lt;span style="color:#b48ead"&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; CT Name&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; apline&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;unpriv
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; including mount point rootfs &lt;span style="color:#eceff4"&gt;(&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span style="color:#eceff4"&gt;)&lt;/span&gt; &lt;span style="color:#81a1c1;font-weight:bold"&gt;in&lt;/span&gt; backup
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; temporary directory is on NFS&lt;span style="color:#eceff4"&gt;,&lt;/span&gt; disabling xattr &lt;span style="color:#81a1c1;font-weight:bold"&gt;and&lt;/span&gt; acl support&lt;span style="color:#eceff4"&gt;,&lt;/span&gt; consider configuring a local tmpdir via &lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;etc&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzdump&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;conf
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; starting first sync &lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;proc&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;&lt;span style="color:#b48ead"&gt;39778&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;root&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt; to &lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;mnt&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;pve&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;dump&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzdump&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;lxc&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;303&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;_04_07&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;18&lt;/span&gt;_43_44&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;tmp
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; first sync finished &lt;span style="color:#81a1c1"&gt;-&lt;/span&gt; transferred &lt;span style="color:#b48ead"&gt;9.35&lt;/span&gt;M bytes &lt;span style="color:#81a1c1;font-weight:bold"&gt;in&lt;/span&gt; &lt;span style="color:#b48ead"&gt;2&lt;/span&gt;s
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; suspending guest
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; starting final sync &lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;proc&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;&lt;span style="color:#b48ead"&gt;39778&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;root&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt; to &lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;mnt&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;pve&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;dump&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzdump&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;lxc&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;303&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;_04_07&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;18&lt;/span&gt;_43_44&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;tmp
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; final sync finished &lt;span style="color:#81a1c1"&gt;-&lt;/span&gt; transferred &lt;span style="color:#b48ead"&gt;0&lt;/span&gt; bytes &lt;span style="color:#81a1c1;font-weight:bold"&gt;in&lt;/span&gt; &lt;span style="color:#b48ead"&gt;0&lt;/span&gt;s
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; resuming guest
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; guest is online again after &lt;span style="color:#81a1c1"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#b48ead"&gt;1&lt;/span&gt; seconds
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; creating vzdump archive &lt;span style="color:#a3be8c"&gt;&amp;#39;/mnt/pve/NAS-DS2/dump/vzdump-lxc-303-2023_04_07-18_43_44.tar.zst&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; tar&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; &lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;mnt&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;pve&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;dump&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzdump&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;lxc&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;303&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;_04_07&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;18&lt;/span&gt;_43_44&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;tmp&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Cannot open&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Permission denied
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; tar&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Error is &lt;span style="color:#81a1c1;font-weight:bold"&gt;not&lt;/span&gt; recoverable&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; exiting now
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ERROR&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Backup of VM &lt;span style="color:#b48ead"&gt;303&lt;/span&gt; failed &lt;span style="color:#81a1c1"&gt;-&lt;/span&gt; command &lt;span style="color:#a3be8c"&gt;&amp;#39;set -o pipefail &amp;amp;&amp;amp; lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 -- tar cpf - --totals --one-file-system -p --sparse --numeric-owner --acls --xattrs &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;xattrs&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;include&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;user&lt;span style="color:#81a1c1"&gt;.*&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;xattrs&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;include&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;security&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;capability&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;warning&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;no&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;file&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;ignored&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;warning&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;no&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;xattr&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;write&lt;span style="color:#a3be8c"&gt;&amp;#39; --one-file-system &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;warning&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;no&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;file&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;ignored&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;directory&lt;span style="color:#81a1c1"&gt;=/&lt;/span&gt;mnt&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;pve&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;dump&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzdump&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;lxc&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;303&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;_04_07&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;18&lt;/span&gt;_43_44&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;tmp&lt;span style="color:#a3be8c"&gt;&amp;#39; ./etc/vzdump/pct.conf ./etc/vzdump/pct.fw &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;directory&lt;span style="color:#81a1c1"&gt;=/&lt;/span&gt;mnt&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;pve&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;NAS&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;DS2&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;dump&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;vzdump&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;lxc&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;303&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;_04_07&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;18&lt;/span&gt;_43_44&lt;span style="color:#81a1c1"&gt;.&lt;/span&gt;tmp&lt;span style="color:#a3be8c"&gt;&amp;#39; --no-anchored &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;exclude&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;lost&lt;span style="color:#81a1c1"&gt;+&lt;/span&gt;found&lt;span style="color:#a3be8c"&gt;&amp;#39; --anchored &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;exclude&lt;span style="color:#81a1c1"&gt;=./&lt;/span&gt;tmp&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;&lt;span style="color:#bf616a"&gt;?&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;*&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;exclude&lt;span style="color:#81a1c1"&gt;=./&lt;/span&gt;&lt;span style="color:#81a1c1;font-weight:bold"&gt;var&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;tmp&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;&lt;span style="color:#bf616a"&gt;?&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;*&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;exclude&lt;span style="color:#81a1c1"&gt;=./&lt;/span&gt;&lt;span style="color:#81a1c1;font-weight:bold"&gt;var&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;run&lt;span style="color:#81a1c1"&gt;/&lt;/span&gt;&lt;span style="color:#bf616a"&gt;?&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;*.&lt;/span&gt;pid&lt;span style="color:#a3be8c"&gt;&amp;#39; . | zstd --rsyncable &amp;#39;&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;--&lt;/span&gt;threads&lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;&lt;span style="color:#b48ead"&gt;1&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#39; &amp;gt;/mnt/pve/NAS-DS2/dump/vzdump-lxc-303-2023_04_07-18_43_44.tar.dat&amp;#39;&lt;/span&gt; failed&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; exit code &lt;span style="color:#b48ead"&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Failed at &lt;span style="color:#b48ead"&gt;2023&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;04&lt;/span&gt;&lt;span style="color:#81a1c1"&gt;-&lt;/span&gt;&lt;span style="color:#b48ead"&gt;07&lt;/span&gt; &lt;span style="color:#b48ead"&gt;18&lt;/span&gt;&lt;span style="color:#eceff4"&gt;:&lt;/span&gt;&lt;span style="color:#b48ead"&gt;43&lt;/span&gt;&lt;span style="color:#eceff4"&gt;:&lt;/span&gt;&lt;span style="color:#b48ead"&gt;47&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INFO&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; Backup job finished with errors
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TASK ERROR&lt;span style="color:#eceff4"&gt;:&lt;/span&gt; job errors
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And sure enough, there is a helpful &lt;code&gt;/etc/vzdump.conf&lt;/code&gt; file. Uncommenting the &lt;code&gt;tmpdir&lt;/code&gt; line and pointing it to &lt;code&gt;/tmp&lt;/code&gt; fixed all my problems.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-6.50.45-pm-copy.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;So what&amp;rsquo;s going on? I did some googling and found some discussions &lt;a href="https://forum.proxmox.com/threads/cannot-backup-only-lxc-to-nfs-vm-works.90797/"&gt;1&lt;/a&gt;/&lt;a href="https://forum.proxmox.com/threads/in-7-0-i-cant-backup-a-container-to-a-nfs-that-worked-in-6-0.97808/"&gt;2&lt;/a&gt;/&lt;a href="https://forum.proxmox.com/threads/backup-of-lxc-containers-to-nfs-mount-fail.95146/"&gt;3&lt;/a&gt; in the &lt;a href="https://forum.proxmox.com/"&gt;Proxmox forums&lt;/a&gt;. They are saying it&amp;rsquo;s because the unprivileged containers (they don&amp;rsquo;t run as root, which seems like good practice) don&amp;rsquo;t have permissions for the NFS share directory. I feel there&amp;rsquo;s a few problems with this theory:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It seems to do fine creating the other files&lt;/li&gt;
&lt;li&gt;Why would the LXC container be doing this work? Surely the process is being run at the Proxmox level.&lt;/li&gt;
&lt;li&gt;Actually the LXC container should not have access to the NAS at all, even if it&amp;rsquo;s privileged - it&amp;rsquo;s not mounted in there, the LXC knows nothing about it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nevertheless, I&amp;rsquo;m sure they know better than me. If I was shipping this product, I&amp;rsquo;d probably engineer around this problem. Maybe by detecting it and switching to &lt;code&gt;/var/tmp&lt;/code&gt; or even just by making that the default in the config file.&lt;/p&gt;</description></item><item><title>Using NAS for Proxmox backups</title><link>https://blog.iankulin.com/using-nas-for-proxmox-backups/</link><pubDate>Mon, 10 Apr 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/using-nas-for-proxmox-backups/</guid><description>&lt;p&gt;&lt;a href="https://blog.iankulin.com/moving-a-vm-between-two-proxmox-hosts/"&gt;A few weeks ago&lt;/a&gt;, I was very excited to be able to take a snapshot of a virtual machine, copy it across the network from that Proxmox node, copy it back across the network to a different Proxmox node, start it there, and have it up and running, without it noticing it was actually on different hardware.&lt;/p&gt;
&lt;p&gt;Backing up a VM is pretty simple, you just click on the node, choose &lt;em&gt;Backup&lt;/em&gt; and click the &lt;em&gt;Backup Now&lt;/em&gt; button. The ease, and completeness of backing up a VM is one of the main reasons I&amp;rsquo;m using Proxmox for my systems.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-12.02.59-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-12.02.59-pm.png" width="800" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By default, VM backups are saved to the &amp;ldquo;local drive&amp;rdquo; - actually the &lt;code&gt;/var/lib/vz&lt;/code&gt; directory. This would not be useful if the physical machine dies, but also it&amp;rsquo;s not convenient to restore to a different machine. Ideally you&amp;rsquo;d have a central place to store these files that was accessible to all the Proxmox nodes.&lt;/p&gt;
&lt;p&gt;This is exactly the situation I&amp;rsquo;ve setup with my lab, the NAS is the storage for the VM backups. Each of the Proxmox nodes uses the same directory for backups, so moving a machine from one node to another is a simple as backing it up on one node, stopping the VM, and restoring it on another node just by choosing the backup file to restore in the web GUI.&lt;/p&gt;
&lt;h3 id="steps"&gt;Steps&lt;/h3&gt;
&lt;p&gt;Proxmox can use all sorts of shares as a location for backups (and other files such as the ISO&amp;rsquo;s used to boot new machines), but the simplest is probably &lt;a href="https://en.wikipedia.org/wiki/Network_File_System"&gt;NFS&lt;/a&gt;. This is also straightforward to do from the Synology NAS.&lt;/p&gt;
&lt;p&gt;In the web interface for the NAS, go into &lt;em&gt;Control Panel&lt;/em&gt;, &lt;em&gt;Shared Folder&lt;/em&gt; and create a new shared folder. I called mine Proxmox. One of the tabs there is for NFS permissions - just add the IP address of the Proxmox node that you&amp;rsquo;d life to access the folder.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-1.46.02-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s not much harder from the Proxmox end. Although the storage you add will appear at the node level in the &lt;em&gt;Server View&lt;/em&gt; of the web GUI, it is added at the &lt;em&gt;Datacenter&lt;/em&gt; level.&lt;/p&gt;
&lt;p&gt;Go into &lt;em&gt;Storage&lt;/em&gt;, select &lt;em&gt;Add&lt;/em&gt; and choose &lt;em&gt;NFS&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-2.00.04-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-2.00.04-pm.png" width="800" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then enter an ID (this will be the name of the storage in Proxmox) and the IP address. If you wait half a second, then you can click the dropdown for all the folders that are shared from that IP address.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-2.06.19-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;The last field is content - this refers the the type of Proxmox stuff you want to keep in there - for backups, you just need VZDumps, but I usually click on everything since I&amp;rsquo;ll also use it for ISOs for new VMs and templates for LXCs.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-2.11.03-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;Once you&amp;rsquo;ve added that, the storage will appear in the server view, but also as an option when you go into &lt;em&gt;Backup&lt;/em&gt; for a VM and select &lt;em&gt;Backup Now&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-04-07-at-2.15.53-pm.png" alt=""&gt;&lt;/p&gt;</description></item><item><title>RAID Rescue</title><link>https://blog.iankulin.com/raid-rescue/</link><pubDate>Tue, 04 Apr 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/raid-rescue/</guid><description>&lt;p&gt;I&amp;rsquo;m in the process of shuffling disks around as I move towards my 3-2-1 storage arrangements. I thought after my extensive rsync adventures I&amp;rsquo;d mirrored everything everywhere, but then realised, with a sinking (no pun) feeling, after I&amp;rsquo;d repurposed a drive out of the 2 drive Synology as a USB caddy drive and wiped it, that I&amp;rsquo;d forgotten my audio book directory. All my rsync fiddling around had been on the video subdirectory of the media folder, not the whole media directory that included my audiobooks.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s not the end of the world if I&amp;rsquo;d wiped them, I&amp;rsquo;ve just been working through downloading them from Audible and de-drming, so I could do that again in the few days I&amp;rsquo;ve got left till my subscription cancellation date comes around. That was a painful and slow process, so I don&amp;rsquo;t really want to.&lt;/p&gt;
&lt;p&gt;I still had one of the RAID drives that hadn&amp;rsquo;t been wiped, so in theory it should have a full copy of the data, and if I put it back in the Synology by itself it should work. That would be the same situation as if one drive in the RAID pool had died completely.&lt;/p&gt;
&lt;p&gt;A few screws, and a drive swap later and I&amp;rsquo;m looking at this:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-31-at-4.35.40-pm-copy.jpg" alt=""&gt;&lt;/p&gt;
&lt;p&gt;There must be a tiny bit of storage in the Synology, so it knows I&amp;rsquo;ve been fiddling around. I hit &lt;em&gt;Recover&lt;/em&gt;, and it did the ten minute thing that I assume is it downloading and installing the new DSM.&lt;/p&gt;
&lt;p&gt;During this process, it started beeping in a plaintive way. I couldn&amp;rsquo;t access with the old Tailscale address, so I fired up the IP address to the web interface, logged in with the old credentials and was greeted with this:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-31-at-4.08.58-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;It was not happy working in the degraded state, but the files were all still there, I was able to mount it to the other NAS and copy my files out. A success. The Tailscale package was still installed, so perhaps that business at the beginning was not really a new install of DSM, but some sort of checking.&lt;/p&gt;
&lt;p&gt;This was a good experience, it is worthwhile to test these scenarios, and I&amp;rsquo;m reassured to discover the audible beeping when the RAID pool was degraded. At the moment while I get everything sorted I&amp;rsquo;m in the web interfaces a lot, but the dream is this learning and setup time comes to an end and I just consume my self-hosted services without much manual intervention. In that scenario, some un-ignorable beeping when the NAS needs attention is a good thing.&lt;/p&gt;</description></item><item><title>rsync / Synology / @eaDir</title><link>https://blog.iankulin.com/rsync-synology-eadir/</link><pubDate>Tue, 28 Mar 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/rsync-synology-eadir/</guid><description>&lt;p&gt;The reason I&amp;rsquo;ve been figuring out rsync is to setup my backup strategy. Eventually this will partly be managed with scheduled tasks (ie cron jobs) running rsync. I wanted the SSH in and try this out, since I didn&amp;rsquo;t know some basic things like the mount points of the shares.&lt;/p&gt;
&lt;h3 id="mount-points"&gt;Mount points&lt;/h3&gt;
&lt;p&gt;My first issue was to find the paths to all my data. This turned out not to be a drama. Each of the volumes you create when the NAS is set up are just in the root directory. This includes any USB drives plugged in.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-25-at-8.08.10-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;Inside each of those &lt;em&gt;volumes&lt;/em&gt; are any &lt;em&gt;shares&lt;/em&gt; you&amp;rsquo;ve created. At the moment I want to rsync my movies which are in a &amp;lsquo;media&amp;rsquo; share on volume1 to the usb drive, so the directories I&amp;rsquo;ll be using are:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/volume1/media/video/Movies/&lt;/code&gt;&lt;br&gt;
&lt;code&gt;/volumeUSB1/usbshare/media/video/Movies&lt;/code&gt;&lt;/p&gt;
&lt;h3 id="rsync-attempt"&gt;rsync attempt&lt;/h3&gt;
&lt;p&gt;rsync has a cool feature whereby you can do a &amp;lsquo;dry run&amp;rsquo; where it goes through the motions of the command you&amp;rsquo;ve given it, but doesn&amp;rsquo;t change any files. If you combine this with the verbose output, you can clearly see what it&amp;rsquo;s going to do before you let it start changing things. That&amp;rsquo;s an especially good idea when you&amp;rsquo;re dealing with large amounts of data, so my first pass at this included the -n option.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -avin /volume1/media/video/Movies/ /volumeUSB1/usbshare/media/video/Movies --del
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The situation with these two lots of data is that I&amp;rsquo;ve copied my media off the USB drive onto the NAS, then when I installed Jellyfin to access it, I discovered lots of misnamed items (had the years incorrect mostly) and I&amp;rsquo;ve been combining some directories, and renaming others and so on. So I expected this first run or rsync to pull up a heap of changes to make, which it did - thousands of lines of them.&lt;/p&gt;
&lt;p&gt;I noticed a lot of them included this weird directory that I didn&amp;rsquo;t recognise.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt;f+++++++++ @eaDir/Tora Tora Tora (1970 PG)@SynoEAStream
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt;f+++++++++ @eaDir/Tora Tora Tora (1970 PG)@SynoResource
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;ve since learned it might be extended attributes, people started noticing it around the introduction of DSM7. &lt;a href="https://tech.webit.nu/synology-nas-those-eadir-folders/"&gt;I don&amp;rsquo;t seem to be the only user who hates&lt;/a&gt; Synology messing with my data. There&amp;rsquo;s some consensus they are created by the indexing service (which I&amp;rsquo;ve turned off as much as is possible in the GUI) and when the &lt;a href="https://www.reddit.com/r/synology/comments/exh5ho/preventing_eadir_from_being_created/"&gt;drives are externally mounted&lt;/a&gt; - which of course I have been doing quite a bit while moving things around.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll tackle removing them all and trying to prevent their reoccurence another day, but for the moment, I&amp;rsquo;ll just tell rsync to ignore them using the &lt;code&gt;--exclude&lt;/code&gt; option.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -avin --exclude &amp;#39;*@eaDir*&amp;#39; /volume1/media/video/Movies/ /volumeUSB1/usbshare/media/video/Movies --del
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>SSH with Keys to Synology</title><link>https://blog.iankulin.com/ssh-with-keys-to-synology/</link><pubDate>Mon, 27 Mar 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/ssh-with-keys-to-synology/</guid><description>&lt;p&gt;The Synology operating system DSM (I&amp;rsquo;m on DSM 7.1.1) is Linux, but its highly customised for the purpose of making running a complicated Linux NAS doable for less technical users.&lt;/p&gt;
&lt;p&gt;Due to that, some things that are routine in a regular distro, require a few more steps to jump through to get them to work. SSH-ing in to a Synology with keys is one of those things.&lt;/p&gt;
&lt;h3 id="should-you"&gt;Should you?&lt;/h3&gt;
&lt;p&gt;Before you do start fiddling around, it&amp;rsquo;s probably worth mentioning that almost all the things you might want to do on the Synology can be accomplished through their web interface, or by installing a &amp;lsquo;package&amp;rsquo; from the &lt;em&gt;Package Center&lt;/em&gt;. For example, if you need to run a cron job, that&amp;rsquo;s done through the &lt;em&gt;Control Panel&lt;/em&gt; &amp;lsquo;&lt;em&gt;Task Scheduler&lt;/em&gt;&amp;rsquo;. If you need TailScale installed to easily access it over Wireguard, there&amp;rsquo;s a TailScale package. In general it&amp;rsquo;s probably easier and safer to do things their way.&lt;/p&gt;
&lt;h3 id="enabling-ssh"&gt;Enabling SSH&lt;/h3&gt;
&lt;p&gt;Before you can SSH into the Synology, you need to enable the SSH service. This is straightforward with the web interface. In &lt;em&gt;Control Panel&lt;/em&gt;, look for &lt;em&gt;Terminal &amp;amp; SMNP&lt;/em&gt; and tick the box, and click &lt;em&gt;Apply&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-25-at-6.01.35-pm.png" alt=""&gt;&lt;/p&gt;
&lt;h3 id="home-directory"&gt;Home directory&lt;/h3&gt;
&lt;p&gt;If you SSH to the Synology now, it works, but you&amp;rsquo;ll notice that there&amp;rsquo;s a warning message saying &amp;ldquo;Could not chdir to home directory /var/services/homes/&lt;user name&gt;: No such file or directory&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-25-at-7.12.36-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;The reason for this is that unlike most distros, when you create a user in DSM, there&amp;rsquo;s no home directory created for them. There must be some bash config somewhere since I get that nice prompt, but no user home directory.&lt;/p&gt;
&lt;p&gt;Lot&amp;rsquo;s of times, you could just ignore that warning, you can still probably do what you wanted to, but it is going to be an issue for installing SSH keys - when you do the &lt;code&gt;ssh-copy-id&lt;/code&gt; it will want to create a .ssh file in the user&amp;rsquo;s home directory, and if they haven&amp;rsquo;t got one, that is not going to work. You&amp;rsquo;ll get a similar sort of error saying something like&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;sh: line 0: cd: /var/services/homes/&amp;lt;user_name&amp;gt;: No such file or directory mkdir: cannot create directory '.ssh': Permission denied&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Again, there&amp;rsquo;s a setting in the web interface to create home directories for the users. We&amp;rsquo;re in the &lt;em&gt;Control Panel&lt;/em&gt; again, but this time look for &lt;em&gt;User &amp;amp; Group&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-25-at-6.20.35-pm.jpg" alt=""&gt;&lt;/p&gt;
&lt;p&gt;Tick the box for &lt;em&gt;Enable user home service&lt;/em&gt;, and hit &lt;em&gt;Apply&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Now you&amp;rsquo;ll be able to copy the keys as usual with ssh-copy-id.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-03-25-at-7.25.59-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-25-at-7.25.59-pm.png" width="1000" alt=""&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Mounting one Synology NAS to another one</title><link>https://blog.iankulin.com/mounting-one-synology-nas-to-another-one/</link><pubDate>Tue, 21 Mar 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/mounting-one-synology-nas-to-another-one/</guid><description>&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/img_4344.jpg" alt=""&gt;&lt;/p&gt;
&lt;p&gt;I went over mounting a Synology NAS share on a Mac or Linux host &lt;a href="https://blog.iankulin.com/accessing-a-synology-nas-from-linux/"&gt;a while ago&lt;/a&gt;. Now I&amp;rsquo;ve populated a new NAS, and I want to copy my data over to it. I could mount them both to my laptop, and the data flow would look like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NAS1 - switch - wifi - laptop - wifi - switch - NAS2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since I&amp;rsquo;m copying 4TB, it will take a few hours, and if I forget what&amp;rsquo;s going on and close the laptop, or take it outside of my wifi the transfer will die, and I won&amp;rsquo;t be sure which files are patent. What might be better would be something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NAS1 - switch - NAS2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is eminently possible, we just need to mount a share from one NAS into the other, then I can just initiate the copy and bug out, leaving it them to do their thing.&lt;/p&gt;
&lt;p&gt;DSM - the Synology operating system, is Linux, so in theory I could just SSH in and mount the other NAS with the &lt;code&gt;mount&lt;/code&gt; command, or by editing &lt;code&gt;/etc/fstab&lt;/code&gt;, but DSM is highly customised and slimmed down, and somethings are just outright different, sometimes in a dangerous way.&lt;/p&gt;
&lt;p&gt;On the flipside, Synology&amp;rsquo;s whole reason for existing is to make things easier and GUI-ier, so there&amp;rsquo;s no need to drop into the command line, we can do what we want quite easily via their web interface.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll start out on NAS2 (the empty one). Using FileStation, I&amp;rsquo;ll create a share, then inside that, I&amp;rsquo;ll create a &lt;code&gt;nas1&lt;/code&gt; directory - this will be the mount point. In the root of the share, &lt;code&gt;Open Tools | Mount Remote Folder&lt;/code&gt;. I&amp;rsquo;m using SMB/CIFS for my share so I&amp;rsquo;ll chose CIFS option, but obviously if you&amp;rsquo;re using NFS, use that instead.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-03-17-at-5.03.08-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-17-at-5.03.08-pm.png" width="1008" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Since underneath it&amp;rsquo;s actually running the &lt;code&gt;mount&lt;/code&gt; for us, or doing whatever their equivalent of editing &lt;code&gt;/etc/fstab&lt;/code&gt; is, it needs all the same information.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-03-17-at-5.04.45-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-17-at-5.04.45-pm.png" width="1007" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once you press &lt;code&gt;Mount&lt;/code&gt;, the other (remote) NAS will appear in FileStation under &lt;code&gt;Remote Folder&lt;/code&gt;. The it was just a matter of &lt;code&gt;right click | copy&lt;/code&gt; on the NAS1 then &lt;code&gt;paste&lt;/code&gt; into the NAS2 share.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-03-17-at-5.05.43-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-17-at-5.05.43-pm.png" width="1009" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;According to &lt;a href="https://datarecovery.com/rd/does-hard-drive-rpm-affect-lifespan/"&gt;these guys&lt;/a&gt;, the theoretical max transfer rate of a 5400RPM drive (which is what I&amp;rsquo;m running in both NASs) is 75MB/s. NAS1 that I&amp;rsquo;m copying from is RAID1, so I assume if the OS is smart enough it could pull data from both disks at once, but I don&amp;rsquo;t really understand what happens with the writes when that data hits the RAID6. In any case, it was maxing out at around 70MB/s. Although most of the time it was anywhere between 30 and 70.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-03-17-at-5.55.58-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-03-17-at-5.55.58-pm.png" width="1008" alt=""&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Accessing a Synology NAS from Linux</title><link>https://blog.iankulin.com/accessing-a-synology-nas-from-linux/</link><pubDate>Mon, 20 Feb 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/accessing-a-synology-nas-from-linux/</guid><description>&lt;img src="https://blog.iankulin.com/images/img_4154x.jpg" width="1000" alt=""&gt;
&lt;p&gt;I picked up a Synology DS216j NAS from eBay to use for storage for the rapidly growing home lab. The eventual plan is that as well as my VM backups, it will host the media library, and eventually (when this has all proved itself reasonably bullet-proof) my current DropBox contents. That won&amp;rsquo;t all fit on the 2x2TB drives that the DS216j came with, and I have a pair of 8TBs on hand, but I wanted to set it up and checked it all worked.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-02-18-at-3.15.25-pm.jpg" alt=""&gt;&lt;/p&gt;
&lt;p&gt;Configuration of the NAS was a &amp;lsquo;follow the prompts&amp;rsquo; exercise for the most part. The Synology OS is a Linux port called DSM, but it&amp;rsquo;s intended to be an appliance so all the interactions are through the web client. I&amp;rsquo;m using RAID 1 since the plan is that the production segment of the homelab will all be high-ish available. There&amp;rsquo;s a few options to install extras (such as Tailscale), but these little &amp;lsquo;j&amp;rsquo; models don&amp;rsquo;t run an x86 processor, so no docker etc.&lt;/p&gt;
&lt;p&gt;Once I&amp;rsquo;d got through all of that, I created a share in &amp;lsquo;File Station&amp;rsquo; and copied a couple of files in. By default, Samba shares are on (with the name WORKGROUP - so I guess this is aimed at making it simple for Windows users) but NFS are not. I know nothing about NFS, so this suits me for the moment. Additionally, my &lt;a href="https://en.wikipedia.org/wiki/WD_TV"&gt;WD-TV&lt;/a&gt; shares it&amp;rsquo;s attached USB drive using Samba, so I&amp;rsquo;m used to accessing it from the MacBook. Let&amp;rsquo;s try the NAS from the MacBook:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-02-18-at-3.23.38-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-02-18-at-3.23.38-pm.png" width="512" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It asked for the login details, then I was in. Could not have been much easier.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-02-18-at-3.28.55-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-02-18-at-3.28.55-pm.png" width="800" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="accessing-from-linux"&gt;Accessing from Linux&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;m planning on running Jellyfin in an LCX container. So I&amp;rsquo;ll set that up for this test too. I stood it up with the Debian server .iso in Proxmox and specified it should be a &amp;lsquo;privileged&amp;rsquo; container, and in the Proxmox options for the LXC ticked &amp;lsquo;SMB/CIFS&amp;rsquo;. This process is not just for Synology - it will work to mount any samba share on a network to your Linux machine.&lt;/p&gt;
&lt;p&gt;We need to make an empty directory to mount to:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;mkdir /mnt/media
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then edit (I use nano) the file &lt;code&gt;/etc/fstab&lt;/code&gt; to include:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;//192.168.100.25/media /mnt/media cifs username=jelly,password=jellypass,uid=1000,gid=1000,file_mode=0660,dir_mode=07
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;etc/fstab&lt;/code&gt; runs at startup, and if the shares are available (cautionary note about booting up your lab after a power outage) it will set them up. There&amp;rsquo;s a fair bit going on in the command, perhaps we should pull it apart:&lt;/p&gt;
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;//192.168.100.25/media /mnt/media&lt;/code&gt;&lt;/td&gt;&lt;td&gt;The first directory is the share, the second is the empty directory on this machine we are mounting the share to.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;username=jelly, password=jellypass&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Our credentials needed to log into the share. Actually I used my root credentials, but obviously a good idea would be to make a user on the NAT for this specific purpose with only access to the share they need to operate.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;uid=1000, gid=1000&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Okay, we're about to enter the Linux zone... These numbers are a &lt;a href="https://medium.com/@gggauravgandhi/uid-user-identifier-and-gid-group-identifier-in-linux-121ea68bf510"&gt;Linux user id and a group ownership id&lt;/a&gt; that Linux assigns to resources - you know, for &lt;code&gt;chown&lt;/code&gt; and stuff like that. If you type in &lt;code&gt;id&lt;/code&gt; at the CLI you can see your numbers. For some reason code examples often use 1000 for both, and things seem to work so I don't worry about it.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;file_mode=0660, dir_mode=07&lt;/code&gt;&lt;/td&gt;&lt;td&gt;More Linux permission stuff. Used in combination with the previous two parameters, and &lt;a href="http://file_mode=0660,dir_mode=07"&gt;will probably cause me problems later&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Note that a couple of other posts on the internet about mounting samba shares thought I&amp;rsquo;d have to do one or both of these commands to install extra samba goodness:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;apt install smbclient
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;apt install cifs-utils
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But it turns out I didn&amp;rsquo;t. I suspect that was something to do with ticking the box for SMB/CIFS when I was creating the LXC container in Proxmox.&lt;/p&gt;
&lt;p&gt;Once you&amp;rsquo;ve saved that command in &lt;code&gt;/etc/fstab&lt;/code&gt;, reload the mounts with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;mount -a
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If there&amp;rsquo;s no errors, you are probably right to go. Have a look at your mount point to see your shared files.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-02-18-at-4.59.09-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;Since the mount command is in the /etc/fstab file, this mount will be durable - as long as the share is available, it will be mounted every time this machine starts.&lt;/p&gt;</description></item></channel></rss>