Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Auto mount samba/smb/cifs shares in Arch VM (systemd)

Featured Replies

Has anyone else tried adding "auto,x-systemd.automount" to their fstab?  It seems to have worked for me.  Here is my whole fstab

 

$ sudo nano /etc/fstab

# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>
# /dev/xvda1
UUID=93ec2c22-36c1-487c-a888-adde602a16fe       /               ext4            rw,relatime,data=ordered        0 1
/dev/xvdb1              /mnt/data ext4 defaults 0 1

//Tower/Movies    /mnt/movies cifs auto,x-systemd.automount,guest,noperm,noserverino,uid=nobody,gid=users 0 0
//Tower/plex      /mnt/plex cifs auto,x-systemd.automount,guest,noperm,noserverino,uid=nobody,gid=users 0 0
//Tower/Videos    /mnt/videos cifs auto,x-systemd.automount,guest,noperm,noserverino,uid=nobody,gid=users 0 0
//Tower/Torrents  /mnt/torrents cifs auto,x-systemd.automount,guest,noperm,noserverino,uid=nobody,gid=users 0 0
//Tower/TV\040Shows /mnt/tv_shows cifs auto,x-systemd.automount,guest,noperm,noserverino,uid=nobody,gid=users 0 0
//Tower/Music     /mnt/music cifs auto,x-systemd.automount,guest,noperm,noserverino,uid=nobody,gid=users 0 0
//Tower/PC_Backup /mnt/pc_backup cifs auto,x-systemd.automount,guest,noperm,noserverino,uid=nobody,gid=users 0 0

 

Boots cleanly, and my shares are auto mounted when I (or plex) accesses them.  Been running now for over an hour and so far so good.

 

Anyone wanna give it a try?  I'm sure I'm not hitting every possible use-case with just plex and my very simple Arch VM so more confirmation is always welcome.

I just tried updating my fstab to the same format and it's looking good. I hadn't changed it since beta3 so still had to run 'mount -a' on startup to re-mount my shares, but with this change they mount properly from the get-go.

 

Perfect timing as I was just thinking I needed to revisit this and fix this issue today or tomorrow.

 

Thanks.

  • Author

?  why did you have to run mount -a?

 

But otherwise, now if you fully reboot the whole system, everything works just right?

 

Keep in mind df-h will not show anything mounted until AFTER you have tried to access it.  I probably should have said that in OP.

 

PS I've been through three more full reboots and two VM reboots, to include mucking about with vcpu (I know THAT wouldn't change anything, but just saying) and everything mounts perfectly on its own without any intervention.  Plex starts and has immediate access to the mounts.  I'm hammering my system right now playing a direct stream while rescanning my entire library.

 

I'm seeing 23.9% / 620% cpu usage on dom0/domU and 160M / 309M memory usage.

?  why did you have to run mount -a?

 

 

When the archVM was first setup under beta3 there was an issue where it would try and mount the shares before the network came up, which would fail. running mount -a tried to reset the shared drives. I've always had this issue on the VM since it was built, but I don't reboot often so it's been a low priority to fix. Plus, I have SAB/SB/Plex working properly in the VM, and as you well know (from the posts I've seen) it can be a pain the ass, so I've hesitated reconfiguring anything.

 

One day I will rebuild the VM from scratch, but I just haven't had the time/patience to redo everything. Your fstab update resolves my issue for now, so I am happy.

 

I did only try rebooting the VM though, not UnRAID, though I don't think that should matter (at least for the issue I was seeing).

 

When the archVM was first setup under beta3 there was an issue where it would try and mount the shares before the network came up, which would fail. running mount -a tried to reset the shared drives. I've always had this issue on the VM since it was built, but I don't reboot often so it's been a low priority to fix. Plus, I have SAB/SB/Plex working properly in the VM, and as you well know (from the posts I've seen) it can be a pain the ass, so I've hesitated reconfiguring anything.

 

Would this help?

  • Author

@bkastner I don't know what rebuilding the VM will get you.  I mean you've solved your cifs mount at boot problem right? [shrug] AFAIK the most recent ARchVM Image and Beta 5a (what I'm running) still have problems with mounting from fstab on boot.  I too had to use mount -a after VM start to get stuff mounted. That is, until I added those options. 

 

I don't reboot often either, but I have a near pathological aversion to needing nit-noid stuff like that to get a server up and running.  When I recover from a power loss I want everything working.  So I've risked my SO's rather burning an entire weekend trying to figure this out :o

 

@PeterB ... I'm assuming what you said in the link works and to that I say, Well Done.  I was trying to do something like that but I am not well versed enough in systemd and scripts yet to get it to work. So I stumbled upon the fstab options I added and so far so good.  I'll be honest, I kind of like "my way" better only because it is less work and seems to be more elegant.  Also less to document for a future rebuild.  [wink] that is why I've written a novel length thread on my journey ... its an online system doc file ;-)

 

Mind you it is only dealing with mounts via fstab and won't help anyone hoping to hold a service until the network is up.  For that your work seems like a perfect fit.

FYI - I have the same issue with auto mounting at boot time via fstab. I reboot rarely, and issue the mount -a command after the network is up. I don't know a way around it yet, been really busy with my dissertation and stuff but it's on my to do list.

  • Author

Check out my fstab, I really think I have it licked.  If not, then I'll be curious to know what's different in yours that might be failing.

 

I rebooted the VM and the machine several times last night and every time my shares were automatically mounted when I either issued ls /mnt/[share mount] or most importantly, when I fired up Plex and started playing a video.  It just worked.

 

To be clear, before I added auto,x-systemd.automount I had to issue mount -a as well.

 

PS:

* I might not even need to explicitly issue "auto" but for now it is there.

 

* I'm also have no doubt this will NOT solve any race conditions with services trying to start before the network is even up.  But that should be solved by finding a way to delay those service (PeterB seemed to be onto something).  In the mean time this should make the shares successfully automount once the network IS up and running.  The thing to keep in mind is that df -h will not show them as mounted until they are accessed.

Check out my fstab, I really think I have it licked.  If not, then I'll be curious to know what's different in yours that might be failing.

 

I rebooted the VM and the machine several times last night and every time my shares were automatically mounted when I either issued ls /mnt/[share mount] or most importantly, when I fired up Plex and started playing a video.  It just worked.

 

To be clear, before I added auto,x-systemd.automount I had to issue mount -a as well.

 

PS:

* I might not even need to explicitly issue "auto" but for now it is there.

 

* I'm also have no doubt this will NOT solve any race conditions with services trying to start before the network is even up.  But that should be solved by finding a way to delay those service (PeterB seemed to be onto something).  In the mean time this should make the shares successfully automount once the network IS up and running.  The thing to keep in mind is that df -h will not show them as mounted until they are accessed.

 

I have to say, that fstab entry does the trick for me. Nice work.

 

Will test it over the next few days and then look to include it in v5 of the VM image. Thanks Alex.

FYI - I have the same issue with auto mounting at boot time via fstab. I reboot rarely, and issue the mount -a command after the network is up.

 

With an average of two power cuts a day, I do need my systems to come back up with minimal manual interaction - you can be sure that my method works well straight from boot!

  • Author

Yeah the stuff you got going on PeterB looks like it should be the solution to anyone's problem of services trying to start before the network is even available.  I haven't run into that yet myself, but I've book marked your post for just such an occasion.

  • Author

Check out my fstab, I really think I have it licked.  If not, then I'll be curious to know what's different in yours that might be failing.

 

I rebooted the VM and the machine several times last night and every time my shares were automatically mounted when I either issued ls /mnt/[share mount] or most importantly, when I fired up Plex and started playing a video.  It just worked.

 

To be clear, before I added auto,x-systemd.automount I had to issue mount -a as well.

 

PS:

* I might not even need to explicitly issue "auto" but for now it is there.

 

* I'm also have no doubt this will NOT solve any race conditions with services trying to start before the network is even up.  But that should be solved by finding a way to delay those service (PeterB seemed to be onto something).  In the mean time this should make the shares successfully automount once the network IS up and running.  The thing to keep in mind is that df -h will not show them as mounted until they are accessed.

 

I have to say, that fstab entry does the trick for me. Nice work.

 

Will test it over the next few days and then look to include it in v5 of the VM image. Thanks Alex.

 

Nope, thank you.  You did the heavy lifting.  Its this nit-noid shit that we all need to help figure out to make it a production worthy "thing"

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.