[unRAID 6 beta14+] Unassigned Devices [former Auto Mount USB]


Recommended Posts

Happy to report that with latest update (.11a)  your plugin executes my script to export a share under NFS. Thanks.

 

My USB disk formatted NTFS will mount but not execute the script.

 

Please PM me your /var/log/unassigned.devices.log file.

Link to comment

Just for reference, that seems to be a good case:

Fri Jun 12 12:49:35 CDT 2015: Drive found with the following attributes: serial='WD_Elements_10B8_575841314131353253354850-0:0', serial_short='575841314131353253354850', device='/dev/sdg1', part='1', label='Elements', fstype='ntfs', target='', size='2000364240896', used='0', avail='2000364240896', mountpoint='/mnt/disks/wd2t', owner='user', automount='1', shared='1'
Fri Jun 12 12:49:35 CDT 2015: Adding disk  ...
Fri Jun 12 12:49:35 CDT 2015: Mounting drive with command: mount -t ntfs -o auto,async,nodev,nosuid,umask=000 '/dev/sdg1' '/mnt/disks/wd2t'
Fri Jun 12 12:49:44 CDT 2015: Successfully mounted '/dev/sdg1' on '/mnt/disks/wd2t'
Fri Jun 12 12:49:44 CDT 2015: Defining share 'wd2t' on file '/etc/samba/unassigned-shares/wd2t.conf' .
Fri Jun 12 12:49:44 CDT 2015: Adding share wd2t to /boot/config/smb-extra.conf
Fri Jun 12 12:49:44 CDT 2015: Reloading Samba configuration.
Fri Jun 12 12:49:44 CDT 2015: Directory '/mnt/disks/wd2t' shared successfully.
Fri Jun 12 12:49:44 CDT 2015: Running command '/boot/config/plugins/unassigned.devices/wd2t.sh' with action 'ADD'.
Fri Jun 12 12:49:44 CDT 2015: Disk Elements shared successfully

Link to comment

Happy to report that with latest update (.11a)  your plugin executes my script to export a share under NFS. Thanks.

 

My USB disk formatted NTFS will mount but not execute the script.

 

Please PM me your /var/log/unassigned.devices.log file.

 

The log shows that everything worked as it should.  Let me work with it some more.  I think I just found a script error.

 

I hadn't tried this drive script until the latest version.  I had another USB disk that I worked with on RC5 and it worked fine.

 

EDIT: OK. Subtle script problem kept the script from running.

Link to comment

gfjardim, could you take a look at this post of mine and let us know if there is anything that can be done to improve this?

 

Thanks

 

This is top priority.

I see there was an update for this. I would like to test it but I am in the middle of a 4TB preclear. Does anyone know what would happen if I updated this plugin while the preclear is running?

 

Sorry for the late response. The preclear instance will continue to run.

Link to comment

I have a USB Disk that I back up some of my unraid files to for off-site storage.  What I do is plug in the USB Drive and walk away until the backup is complete.  I then want to just remove the USB Drive when the backup is complete.  I don't want to have to go to the webgui to unmount the drive.

 

This is my script:

#!/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' )
#
# Beep that the device is plugged in.
#
beep  -l 200 -f 600 -n -l 200 -f 800
sleep 2

if [ $OWNER = "udev" ]
then
	LOGFILE=/var/log/WeeklyBackups
	PROG_NAME=WeeklyBackup

	beep  -l 100 -f 2000 -n -l 150 -f 3000
	beep  -l 100 -f 2000 -n -l 150 -f 3000	

// Doing my stuff
	logger Synching... -t$PROG_NAME
	sync

	beep  -l 100 -f 2000 -n -l 150 -f 3000
	beep  -l 100 -f 2000 -n -l 150 -f 3000
	beep  -r 5 -l 100 -f 2000

	sleep 2
	/usr/local/sbin/unassigned_umount $DEVICE
fi
  ;;

  'REMOVE' )
#
# Beep that the device is unmounted.
#
beep  -l 200 -f 800 -n -l 200 -f 600
  ;;
esac

 

The idea is that the device is unmounted after the work is complete.  I had to insert the "sync" before the unmount to be sure all writes to the disk are completed before unmounting the disk or I would get some errors.

 

Should the "sync" be part of the built in unmount procedure to prevent problems by unmounting too soon after writing?

Link to comment

gfjardim, could you take a look at this post of mine and let us know if there is anything that can be done to improve this?

 

Thanks

 

With the most recent version, mount/unmount scripts run in the background, but this can cause some race conditions. I'm inclined to revert this. You can always run your commands  in the background, tho, e.g. http://stackoverflow.com/questions/4511704/shell-script-run-a-block-of-code-in-the-background-without-defining-a-new-funct

 

I think I might be seeing a race condition here

Didn't forget you. I have to think how to debug this first.

Link to comment

gfjardim, could you take a look at this post of mine and let us know if there is anything that can be done to improve this?

 

Thanks

 

With the most recent version, mount/unmount scripts run in the background, but this can cause some race conditions. I'm inclined to revert this. You can always run your commands  in the background, tho, e.g. http://stackoverflow.com/questions/4511704/shell-script-run-a-block-of-code-in-the-background-without-defining-a-new-funct

 

I think I might be seeing a race condition here

Didn't forget you. I have to think how to debug this first.

Link to comment

PS: Since unRAID v6.0-rc1, it's safe to use a disk managed by this plugin to store VM's and Docker images.

 

Example script for those who mount disks used by Docker and/or VMs:

 

#!/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

 

This doesn't seem to work for me.  My docker drive/partition (/mnt/docker) mounts as expected, but the 'Docker' tab tells me: "No Docker Containers Installed".

 

If I then go to Settings->Docker and disable/re-enable Docker, my five containers start up.

 

What am I missing?

 

Is this likely due to the race condition?  Is there a work-around?  I've reverted to mounting my docker drive in the go script for now.

Link to comment

PS: Since unRAID v6.0-rc1, it's safe to use a disk managed by this plugin to store VM's and Docker images.

 

Example script for those who mount disks used by Docker and/or VMs:

 

#!/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

 

This doesn't seem to work for me.  My docker drive/partition (/mnt/docker) mounts as expected, but the 'Docker' tab tells me: "No Docker Containers Installed".

 

If I then go to Settings->Docker and disable/re-enable Docker, my five containers start up.

 

What am I missing?

 

Is this likely due to the race condition?  Is there a work-around?  I've reverted to mounting my docker drive in the go script for now.

I will revert this later today.

Link to comment

I have a Windows 8.1 VM that I am passing a USB mouse, keyboard, and printer through to the VM.  I am seeing udev hot-plug events in the VM log.  I am wondering if these hot-plug events aren't coming from unassigned devices.  If they are, maybe they should be filtered out and not "hot-plugged" if they are being passed to a VM.

 

2015-06-13 20:29:15.483+0000: starting up libvirt version: 1.2.15, qemu version: 2.3.0
Domain id=2 is tainted: high-privileges
Domain id=2 is tainted: host-cpu
char device redirected to /dev/pts/0 (label charserial0)
qemu: terminating on signal 15 from pid 5991
2015-06-13 20:30:01.977+0000: shutting down
2015-06-13 20:30:35.537+0000: starting up libvirt version: 1.2.15, qemu version: 2.3.0
Domain id=4 is tainted: high-privileges
Domain id=4 is tainted: host-cpu
char device redirected to /dev/pts/0 (label charserial0)
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change

Link to comment

When I click the "Rescan Disks" button on the webgui, I get the following log entries:

 

Jun 14 08:04:11 MediaServer udevd[11511]: '/usr/local/sbin/unassigned_reload' [11538] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11504]: '/usr/local/sbin/unassigned_reload' [11543] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11505]: '/usr/local/sbin/unassigned_reload' [11570] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11557]: '/usr/local/sbin/unassigned_reload' [11564] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11509]: '/usr/local/sbin/unassigned_reload' [11569] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11514]: '/usr/local/sbin/unassigned_reload' [11571] terminated by signal 7 (Bus error)

Link to comment

I have a Windows 8.1 VM that I am passing a USB mouse, keyboard, and printer through to the VM.  I am seeing udev hot-plug events in the VM log.  I am wondering if these hot-plug events aren't coming from unassigned devices.  If they are, maybe they should be filtered out and not "hot-plugged" if they are being passed to a VM.

 

2015-06-13 20:29:15.483+0000: starting up libvirt version: 1.2.15, qemu version: 2.3.0
Domain id=2 is tainted: high-privileges
Domain id=2 is tainted: host-cpu
char device redirected to /dev/pts/0 (label charserial0)
qemu: terminating on signal 15 from pid 5991
2015-06-13 20:30:01.977+0000: shutting down
2015-06-13 20:30:35.537+0000: starting up libvirt version: 1.2.15, qemu version: 2.3.0
Domain id=4 is tainted: high-privileges
Domain id=4 is tainted: host-cpu
char device redirected to /dev/pts/0 (label charserial0)
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change

 

This is unrelated to this plugin.

 

When I click the "Rescan Disks" button on the webgui, I get the following log entries:

 

Jun 14 08:04:11 MediaServer udevd[11511]: '/usr/local/sbin/unassigned_reload' [11538] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11504]: '/usr/local/sbin/unassigned_reload' [11543] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11505]: '/usr/local/sbin/unassigned_reload' [11570] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11557]: '/usr/local/sbin/unassigned_reload' [11564] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11509]: '/usr/local/sbin/unassigned_reload' [11569] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11514]: '/usr/local/sbin/unassigned_reload' [11571] terminated by signal 7 (Bus error)

 

I failed to debug this, but it appear to be working despite the error message.

Link to comment

I have a Windows 8.1 VM that I am passing a USB mouse, keyboard, and printer through to the VM.  I am seeing udev hot-plug events in the VM log.  I am wondering if these hot-plug events aren't coming from unassigned devices.  If they are, maybe they should be filtered out and not "hot-plugged" if they are being passed to a VM.

 

2015-06-13 20:29:15.483+0000: starting up libvirt version: 1.2.15, qemu version: 2.3.0
Domain id=2 is tainted: high-privileges
Domain id=2 is tainted: host-cpu
char device redirected to /dev/pts/0 (label charserial0)
qemu: terminating on signal 15 from pid 5991
2015-06-13 20:30:01.977+0000: shutting down
2015-06-13 20:30:35.537+0000: starting up libvirt version: 1.2.15, qemu version: 2.3.0
Domain id=4 is tainted: high-privileges
Domain id=4 is tainted: host-cpu
char device redirected to /dev/pts/0 (label charserial0)
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change

 

This is unrelated to this plugin.

 

When I click the "Rescan Disks" button on the webgui, I get the following log entries:

 

Jun 14 08:04:11 MediaServer udevd[11511]: '/usr/local/sbin/unassigned_reload' [11538] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11504]: '/usr/local/sbin/unassigned_reload' [11543] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11505]: '/usr/local/sbin/unassigned_reload' [11570] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11557]: '/usr/local/sbin/unassigned_reload' [11564] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11509]: '/usr/local/sbin/unassigned_reload' [11569] terminated by signal 7 (Bus error)
Jun 14 08:04:11 MediaServer udevd[11514]: '/usr/local/sbin/unassigned_reload' [11571] terminated by signal 7 (Bus error)

 

I failed to debug this, but it appear to be working despite the error message.

 

Correct.  Everything is working.

Link to comment

This plugin doesn't work for me, I hit mount on an SSD, the page reloads but its not mounted. Is there a log or something I can check to see what happened?

 

/var/log/unassigned.devices.log

 

Cheers.

 

root@DAMONSTER:~# cat /var/log/unassigned.devices.log

Mon Jun 15 9:38:09 AEST 2015:
Mon Jun 15 9:38:09 AEST 2015: Disk with serial 'Corsair_Force_3_SSD_120765020000                                                                                                                                                             08912968' auto mount is disabled, aborting.
Tue Jun 16 12:28:03 AEST 2015:
Tue Jun 16 12:28:03 AEST 2015: Disk with serial 'Corsair_Force_3_SSD_12076502000                                                                                                                                                             008912968' auto mount is disabled, aborting.
Tue Jun 16 12:28:10 AEST 2015:
Tue Jun 16 12:28:10 AEST 2015: Drive found with the following attributes: serial                                                                                                                                                             ='Corsair_Force_3_SSD_12076502000008912968', serial_short='12076502000008912968'                                                                                                                                                             , device='/dev/sdb1', part='1', label='Corsair Force 3 SSD 12076502000008912968'                                                                                                                                                             , fstype='btrfs', target='', size='60022448128', used='0', avail='60022448128',                                                                                                                                                              mountpoint='/mnt/disks/Corsair_Force_3_SSD_12076502000008912968', owner='user',                                                                                                                                                              automount='', shared='1'
Tue Jun 16 12:28:10 AEST 2015: Adding disk  ...
Tue Jun 16 12:28:10 AEST 2015: Mounting drive with command: mount -t btrfs -o au                                                                                                                                                             to,async,nodev,nosuid '/dev/sdb1' '/mnt/disks/Corsair_Force_3_SSD_12076502000008                                                                                                                                                             912968'
Tue Jun 16 12:28:10 AEST 2015: Mount of /dev/sdb1 failed. Error message: mount:                                                                                                                                                              wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so


Tue Jun 16 12:28:10 AEST 2015: Disk Corsair Force 3 SSD 12076502000008912968 sha                                                                                                                                                             red successfully.
Tue Jun 16 13:00:15 AEST 2015:
Tue Jun 16 13:00:15 AEST 2015: Drive found with the following attributes: serial                                                                                                                                                             ='Corsair_Force_3_SSD_12076502000008912968', serial_short='12076502000008912968'                                                                                                                                                             , device='/dev/sdb1', part='1', label='Corsair Force 3 SSD 12076502000008912968'                                                                                                                                                             , fstype='btrfs', target='', size='60022448128', used='0', avail='60022448128',                                                                                                                                                              mountpoint='/mnt/disks/Corsair_Force_3_SSD_12076502000008912968', owner='user',                                                                                                                                                              automount='', shared='1'
Tue Jun 16 13:00:15 AEST 2015: Adding disk  ...
Tue Jun 16 13:00:15 AEST 2015: Mounting drive with command: mount -t btrfs -o au                                                                                                                                                             to,async,nodev,nosuid '/dev/sdb1' '/mnt/disks/Corsair_Force_3_SSD_12076502000008                                                                                                                                                             912968'
Tue Jun 16 13:00:16 AEST 2015: Mount of /dev/sdb1 failed. Error message: mount:                                                                                                                                                              wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so


Tue Jun 16 13:00:16 AEST 2015: Disk Corsair Force 3 SSD 12076502000008912968 sha

Link to comment
  • Squid locked this topic
Guest
This topic is now closed to further replies.