<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mount on blog.iankulin.com</title><link>https://blog.iankulin.com/tags/mount/</link><description>Recent content in Mount on blog.iankulin.com</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Wed, 01 Mar 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.iankulin.com/tags/mount/index.xml" rel="self" type="application/rss+xml"/><item><title>Problems mounting network share at boot</title><link>https://blog.iankulin.com/problems-mounting-network-share-at-boot/</link><pubDate>Wed, 01 Mar 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/problems-mounting-network-share-at-boot/</guid><description>&lt;p&gt;I had Jellyfin working nicely in an LXC container in Proxmox, but could not get Tailscale working in the container. Since this is going to be an important part of accessing my media away from home, I decided it was probably worth the extra bulk to run JellyFin in a VM.&lt;/p&gt;
&lt;p&gt;Following &lt;a href="https://blog.iankulin.com/accessing-a-synology-nas-from-linux/"&gt;my own instructions&lt;/a&gt;, I had the mount command in the /etc/fstab file so it would persist across reboots. It looked a bit 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;//192.168.100.25/media /mnt/media cifs username=jelly,password=jellypass,uid=1000,gid=115,file_mode=0660,dir_mode=07
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The problem I had was that this was not mounting the NAS at boot time, but if I reran it with &lt;code&gt;mount -a&lt;/code&gt; it worked perfectly. A likely cause for this problem is that the network interface is not properly up at the time the mount is being tried.&lt;/p&gt;
&lt;p&gt;I found a few different suggestions for this, but the one that worked for me and I liked the most is from the first answer in &lt;a href="https://askubuntu.com/questions/43363/how-to-auto-mount-using-sshfs/1242516#1242516"&gt;this StackExchange question&lt;/a&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-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,noauto,x-systemd.automount,_netdev,uid=1000,gid=115,file_mode=0660,dir_mode=07
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;From that answer, the explanation for these is:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;noauto&lt;/code&gt; will stop the no-brainer actions like forcibly mounting whatsoever at booting regardless if the network is up or not.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;x-systemd.automount&lt;/code&gt; is the smart daemon that knows when to mount.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;_netdev&lt;/code&gt; tag will also identify that it uses network devices, thus it will wait until the network is up.​​​​​​&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had tried &lt;code&gt;_netdev&lt;/code&gt; by itself, but that wasn&amp;rsquo;t enough magic. The three together was.&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>