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.

[SOLVED ]Delayed & Conditioned Mount Script for NFS mount ?

Featured Replies

I am looking for a startup script to mount an NFS share delayed and under the condition that a certain vm is online, like the following:

 

1. wait 60 secs

2. check vm #.. -> if its online continue 

3. wait 180 secs

4. mount share

 

Reason for that: I followed one of Space invader ones tutorials to virtualize TrueNAS. This is going to be my main/central NAS and I am also hosting any futures storages (SMB/ NFS/ AFS shares, scsi's etc.) and disk from it. Unraid itself barely has storage. Just 2x 500gb ssds for plugins, the most important vm's etc. 

 

Now I want to use the virtualization power of Unraid and start am Windows 10 VM which is located on a NFS share of the virtualized NAS. So far so good the windows vm works and is tremendously fast (Just changing the windows from my browser to Remote Desktop is enough to boot into windows, I was really surprised to see these speeds). 

 

The only problem is that after a reboot of Unraid, it tries to immediately mount the share which I guess fails and Unraid doesn't retry (I disabled the Mount button and it was not mounted after reboot, auto mount was on). The vm obviously doesn't work anymore and just boots into the EFI shell. That's why I am asking for a script like mentioned above. I use Unassigned devices.

 

Would appreciate any answer :) And please be nice about the virtualization, I know it polarizes :P 

Edited by blacklight
Solved

  • 2 months later...
  • Author

Found the solution myself after research and trying some variants of User Scripts (plugin) I settled with this variant:

1. Created two custom scripts, one executed after start of the machine, one executed before stopping the machine

image.thumb.png.6d224da9b2014efe75fd76c38dbcaff9.png

2. Customize scripts with mkdir and mount e.g.:

Start Script

#!/bin/bash
sleep 150
mkdir /mnt/remotes/fastVMs_ext
mkdir /mnt/remotes/nextcloud
mount -t nfs 192.168.0.116:/mnt/fast_data/fastNAS_Data/fastVMs /mnt/remotes/fastVMs_ext
mount -t nfs 192.168.0.116:/mnt/main_data/PC_Data/nextcloud_main /mnt/remotes/nextcloud

 

Stop Script

#!/bin/bash
umount -t nfs 192.168.0.116:/mnt/fast_data/fastNAS_Data/fastVMs /mnt/remotes/fastVMs_ext --lazy
umount -t nfs 192.168.0.116:/mnt/main_data/PC_Data/nextcloud_main /mnt/remotes/nextcloud --lazy

rmdir /mnt/remotes/fastVMs_ext
rmdir /mnt/remotes/nextcloud

 

The paths of the scripts are located on the flash (mounted it on my Mac after opening the share on the Unraid guy):

->  /Volumes/flash/config/plugins/user.scripts/scripts/delayed mount of Icarus TrueNAS share

-> /Volumes/flash/config/plugins/user.scripts/scripts/delayed mount of Icarus TrueNAS share - SHUTDOWN

The modified file is always the script file. No restart of the machine needed, the script works right away.

 

The scripts, for now, just wait to assume the VM had enough time to start. 

I will have a look into conditioned startup (check if VM is up before connecting to it's SHARES) and a potential custom shutdown script (first shutdown depended VMs, then UNMOUNT main NAS share, in my case Truenas, then Shutdown VM, then shutdown machine, to ensure no data loss or abrupt share unmount) later.

I will update my results here to provide my information ; )

  • blacklight changed the title to [SOLVED ]Delayed & Conditioned Mount Script for NFS mount ?

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.