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.

command line to mount/unmount a drive (Log file Error Issue)

Featured Replies

I THINK what I'm asking for here is a command line to put in a script file to first mount a drive that is visible in unassigned devices, and then after the rest of the script runs, unmount the drive before it ends.

 

The situation:

I have an external simple NAS (Synology) that is a complete backup of my unRAID data.  There is a user script that is intended to run maybe twice a month to execute a set of rclone commands to complete the backup.  The NAS is usually asleep, the script file will wake the NAS fine but unless I manually mount the drive the rclone actions just error out.  Once I mount the drive the script runs fine.

Then I've noticed twice now, after the script completes over the next few days my log file is filling up with thousands of the same error line (sample below).   What I think is happening, is the NAS is going back to sleep and the drive is still mounted so it starts generating errors.

 

The only flaw I can't explain in this logic, is that even after manually umounting the drive the errors continue to generate until I reboot the server to stop them, and then all is quiet again.  

 

Unless you see something else in this error message, I'm looking for two command lines for the user script.  One to mount the drive after it wakes, and one to unmount the drive after the rclone commands run.

 

EDIT:

In the below excerpt there is what might be the unmount command line that came from me clicking the unmount button.  Would this work inside the user script file:  

  • Unmount cmd: /sbin/umount -t cifs -l '/mnt/remotes/UNRAID_BU_BACKUP' 2>&1

If so then is the Mount command the excact same? 

  • Mount cmd: /sbin/mount -t cifs -l '/mnt/remotes/UNRAID_BU_BACKUP' 2>&1

 

 EDIT 2:  I tried the above and it didn't work.

 

Thanks in advance for any help.

 

Mar 29 16:20:58 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:21:09 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:21:20 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:21:30 TODD-Svr webGUI: Successful login user root from 192.168.XXX.XXX
Mar 29 16:21:31 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:21:42 TODD-Svr unassigned.devices: Warning: shell_exec(/usr/bin/df '/mnt/remotes/UNRAID_BU_BACKUP' --output=size,used,avail | /bin/grep -v '1K-blocks' 2>/dev/null) took longer than 10.0s!
Mar 29 16:21:42 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:21:53 TODD-Svr unassigned.devices: Unmounting Remote SMB/NFS Share '//UNRAID_BU/BACKUP'...
Mar 29 16:21:53 TODD-Svr unassigned.devices: Synching file system on '/mnt/remotes/UNRAID_BU_BACKUP'.
Mar 29 16:21:53 TODD-Svr unassigned.devices: Unmount cmd: /sbin/umount -t cifs -l '/mnt/remotes/UNRAID_BU_BACKUP' 2>&1
Mar 29 16:21:53 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:21:53 TODD-Svr unassigned.devices: Successfully unmounted '//UNRAID_BU.LOCAL/BACKUP'
Mar 29 16:22:04 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:22:16 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:22:27 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:22:38 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:22:49 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:23:00 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:23:11 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:23:22 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:23:31 TODD-Svr unassigned.devices: Remote server 'UNRAID_BU.LOCAL' port '445' is not open; server appears to be offline.
Mar 29 16:23:34 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:23:45 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name
Mar 29 16:23:56 TODD-Svr key.dns_resolver: UNRAID_BU.LOCAL: No address associated with name

 

Edited by TODDLT

Solved by hawihoney

  • Author

Any help with this?

1 hour ago, TODDLT said:

Any help with this?

If you click on the help icon while on the Unassigned Devices tab you will get all possible commands. Let UD mount/unmount. It knows exactly how to mount/unmount on Unraid:

 

AEAAB553-E0DA-4507-A59B-52BFA3DF4F63.thumb.png.2337c656cf93d43416ec37ce42e79d49.png

 

E.g.: I use these commands from within User Scripts to mount/unmount an external SMB resource:

 

#!/bin/bash
#backgroundOnly=true
#clearLog=true

/usr/local/sbin/rc.unassigned mount //192.168.178.101/disk1

###

/usr/local/sbin/rc.unassigned umount //192.168.178.101/disk1

 

Edited by hawihoney

  • Author
17 hours ago, hawihoney said:

If you click on the help icon while on the Unassigned Devices tab you will get all possible commands. Let UD mount/unmount. It knows exactly how to mount/unmount on Unraid:

 

E.g.: I use these commands from within User Scripts to mount/unmount an external SMB resource:

 

 

 

Thanks  this is a big help, didn't know that list was there.

 

I see you did it by IP address, but my SMB share is mounted by name.

Which of these is correct?  They are in order of what I think is most likely correct, but just checking.

 

/usr/local/sbin/rc.unassigned mount //UNRAID_BU/BACKUP

or

/usr/local/sbin/rc.unassigned mount /mnt/remotes/UNRAID_BU_BACKUP

or

/usr/local/sbin/rc.unassigned mount //192.168.XX.XX/backup   (I don't have anything mounted by IP on UNRAID, just the NAS Name.  The IP is how I would find it on a windows machine)

 

image.png.50e2ad441e3453dc127daaf60ed69895.png

 

image.png.b3d439a96174c7b008e2963b25c41a01.png

 

 

  • Solution
5 hours ago, TODDLT said:

Which of these is correct?

According to the help text for SMB/NFS, you mount the source name it has within UD. So in that case its  //UNRAID_BU/BACKUP.

 

Edited by hawihoney

  • Author
On 4/1/2025 at 12:54 AM, hawihoney said:

According to the help text for SMB/NFS, you mount the source name it has within UD. So in that case its  //UNRAID_BU/BACKUP.

 

thanks for the help with this.    working fine now.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

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.