How to build script for Unassigned Devices plugin for unraid v6 ?


Recommended Posts

So i am trying to mount an ssd to use with my VM on UNRAID v6.  I understand i have to do something with the script, but it is very unclear on how to do so.  the videos are vague and can't find any documentation.  I have been searching for a long time and there isn't really anything out there. Just using the default script doesn't work.  I got it to format to BTRFS, but really don't care which FS i use as long as i am able to use it.  I only did that because currently my VM is on my cache drive with the FS of BTRFS and was just going to copy it over to external SSD once got mounted.  I click mount on either the part 1 or the disk and it won't mount and either with UNRAID started or stopped. pleez help.

 

thanks

Link to comment

#!/bin/bash

PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin

## Available variables:

# AVAIL      : available space

# USED      : used space

# SIZE      : partition size

# SERIAL    : disk serial number

# ACTION    : if mounting, ADD; if unmounting, REMOVE

# MOUNTPOINT : where the partition is mounted

# FSTYPE    : partition filesystem

# LABEL      : partition label

# DEVICE    : partition device, e.g /dev/sda1

# OWNER      : "udev" if executed by UDEV, otherwise "user"

 

case $ACTION in

  'ADD' )

    // do your stuff here

    /usr/local/emhttp/plugins/dynamix.vm.manager/event/started

    /usr/local/emhttp/plugins/dynamix.docker.manager/event/started

  ;;

  'REMOVE' )

    // do your stuff here

    /usr/local/emhttp/plugins/dynamix.vm.manager/event/stopping_svcs

    /usr/local/emhttp/plugins/dynamix.docker.manager/event/stopping_svcs

  ;;

esac

 

 

So i guess this is the script i am supposed to use, but still the drive won't mount.  Maybe it's not the script after all ????.  I used to have snap plugin and I know it is now old, but that had documentation and actually worked for me. Any suggestions before i take the plunge back to snap?

Link to comment

Haven't really tried to use this with dockers or VMs myself, but I think you need to leave the script out of it until you have formatted, mounted, and copied the contents to the drive. Then I think the only thing you need the script to do are the things it already has in it, starting and stopping services when you mount and dismount, then set it to automount.

 

Maybe someone else with personal experience can fill in some more details or correct me if needed.

Link to comment

Wow! Not sure what exactly fixed it, but this is what i did and in turn it got fixed.  First i googled how to format hdd from the CL.  Ended up finding this page.  http://ubuntuforums.org/showthread.php?t=267869  - I read through it and ran the command to see if the ssd was actually mounted or not and in fact it was and just didn't say it was in the unassigned devices portion of unraid.  i then proceeded to unmount the drive and then delete the partition from the CL.  At this point the drive was still showing as it was before so i decided to remove the unassigned device plugin and restart array.  After array reboot i could now see the ssd as unformatted so i formatted it as XFS this time instead of BTRFS and it actually mounted!!!!! i then decided to add the script. so far so good. 

 

Hope this helps someone else.  Although like i said not sure what fixed it, but just glad its now working and a great plugin to boot!

 

thanks!

Link to comment
  • 2 years later...

Having trouble locating documentation on this, hoping someone can assist.  I'm moving from SNAP plugin to this.  I had a script created that was using some functions in snap.sh and was hoping there was an equivalent.  Anyone?  I'm currently using the following:

 

snap.sh -getSerialNumberFromSharename SHARENAME

snap.sh -isDeviceInUnraidArray SERIALNUMBER

snap.sh -m SHARENAME

snap.sh -M SHARENAME

snap.sh -spindown SERIALNUMBER

 

 

 

 

 

Link to comment
17 hours ago, jfrancais said:

Having trouble locating documentation on this, hoping someone can assist.  I'm moving from SNAP plugin to this.  I had a script created that was using some functions in snap.sh and was hoping there was an equivalent.  Anyone?  I'm currently using the following:

 

snap.sh -getSerialNumberFromSharename SHARENAME

snap.sh -isDeviceInUnraidArray SERIALNUMBER

snap.sh -m SHARENAME

snap.sh -M SHARENAME

snap.sh -spindown SERIALNUMBER

Please don't crosspost. You have already received a response on the UD support thread. Anyone wishing to respond should go there.

Link to comment

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.