SNAP Plugin updated for unRAID Version 5.0


Recommended Posts

Do not use this version of SNAP on unRAID v6!  There is a SNAP version for v6.

 

The SNAP plugin is alive and well and is updated for unRAID 5.0.  I built upon the good work done by Queeg and have updated it for 5.0.  There were many changes; too many to list here.  The biggest change is an updated UI and a lot of behind the scenes fixes to make SNAP more robust and reliable.  I have tested SNAP the best I can with two servers I have here.  One is a test server that I can use do my testing and the other is a live server that I don't like to mess around with too much.

 

SNAP is a plugin that allows you to mount and share drives not in the unRAID array.  Once SNAP is made aware of a drive, you can set up hot plug events to perform operations like file copies to/from the drive.  When the drive is plugged in a hot plug event will initiate a hot plug script.  I use it to mount and back up to portable drives.

 

The SNAP UI makes it a lot easier to work with your drives.  The snap.sh script worked fine, but was very cumbersome when using the cryptic serial numbers of the drives.

 

SNAP is hosted on GitHub here: https://github.com/dlandon/unraid-snap/.

 

Download snap.plg directly from GitHub:  https://github.com/dlandon/unraid-snap/raw/master/snap.plg

 

To install SNAP you need to download the snap.plg and put it in the /boot/config/plugins directory.  You can download the file directly from GitHub and then browse to your flash drive and copy it to the /config/plugins directory or use a telnet session to download the file directly from GitHub with wget.  To install the plugin file, use a telnet session to your server, log in to the server, and then issue the following commands:

 

cd /boot/config/plugins

 

wget --no-check-certificate https://github.com/dlandon/unraid-snap/raw/master/snap.plg

 

Reboot your server

or

installplg snap.plg

 

SNAP will install.

 

NTFS Write Driver

===========

 

Before you install this plugin, delete any ntfs-3g packages from the /boot/extra directory otherwise you could end up with multiple package versions.  I know this is messy, but until unRAID package management is sorted out, this is the best I can do.

 

If you are using NTFS disk drives and need to write on them, you will need the ntfs-3g driver installed.  unRAID only supports reading from NTFS devices.  To enable NTFS write capability, use a telnet session to your server, log in to the server, and then issue the following commands:

 

cd /boot/config/plugins

 

wget --no-check-certificate https://github.com/dlandon/unraid-snap/raw/master/ntfs-3g.plg

 

Reboot your server.

or

installplg ntfs-3g.plg

 

This will install the ntfs-3g package.

 

I will submit SNAP as an official plugin once Tom sorts out the plugin scheme.

 

EDIT: There is a minor issue when using IE 9, 10, and 11.  One of the SNAP tabs is labeled "Events".  This is a web editor that lets you make changes to the snapEvents.sh script based on the event selected from the dropdown.  I have tested the editor on Chrome and IE 9, 10, and 11.  It does not work on IE because support is lacking for some HTML5 features.  The rest of SNAP works fine in IE.  I haven't tested with FireFox.  It works fine with Safari on an iPad.

 

Release Notes

=========

Version 5.10 - Initial Release.

Version 5.11 - Fixed drive busy detection and some unmount problems.

Version 5.12 - Fixed a mount and unmount issue on disks with multiple partitions.  SNAP should only mount the first partition found.

Version 5.13 - Minor UI fixes.

Version 5.14 - SNAP drives are now unmounted when the unRAID array is stopped.  Moved packages to the snap.plg where they belong.  Updated to latest inotify package.  Fixed "No FS" indicator when stopping a preclear and the disk has a valid file system.  Created ntfs-3g plugin to install ntfs-3g driver needed for writing to ntfs disks.

Version 5.15 - More organizational changes.  All packages are now managed by the SNAP plugin.  Updated all packages to Slackware 14.0 - screen, libelf, inotify, and utempter.  I think this fixed a few webgui lockups I experienced when preclearing disks.  It hasn't happened since this update on my test server.  I have added a new command parameter -MW to snap.sh to wait for a disk to not be busy and then unmount it.  This is handy in your hot plug scripts to be sure the drive is successfully unmounted.  If the disk is busy, the -M command would not unmount the disk.  See the example below on the use of -MW.

Version 5.16 - I guess I changed too much and broke the webgui update.  I fixed it in this version.  If you happened to update to 5.15 and SNAP went away in the webgui, just login to a telnet session and run 'installplg snap.plg' or re-boot and it will fix SNAP.  Sorry about the problem.

Version 5.17 - Separated out the logs into separate tabs.  This makes it a lot easier to read the logs because the full screen is available.  Removed preclear.

Version 5.18 - Updated SNAP plugin to be more standard so it can work with plugin managers like Control Panel.

Version 5.19 - No functional changes.  Copyright notices were added and the GNU General Public License was added to GitHub.

Version 5.20 - Aligned version with SNAP 64bit and minor changes for unRAID v6.

Version 5.21 - Updated jQuery, jQuery ui, jQuery cookie, and fixed php errors.  Removed some unused jQuery files.

Version 5.22 - Fixed a situation where a drive was shared and not mounted.

Version 5.23 - Modified SNAP for V6 because USB drives were not being recognized when hot plugged.  One of the benefits of this change is that any hot pluggable drive should be recognized by SNAP when hot plugged.

Version 5.24 - Fixed some incompatibilities with Dynamix.

Version 5.25 - Fixed a hot plug issue with some devices.

Version 5.26 - SNAP will adjust to the white/black theme of Dynamix.

 

To update SNAP, click on the "Check for Update" at the bottom right of the screen and follow the prompts.

 

EDIT: If you have used SNAP before Version 5.10, be sure to remove the /boot/config/snap directory from your flash drive and the entry in the "go" file that was added by SNAP to start it.  SNAP is no longer started with an entry in the "go" file.  It was an entry that looked like this: /boot/config/snap/snap.sh or /boot/config/plugins/snap.sh.

 

SNAP Operation

==========

- SNAP only shares USB drives that are plugged in and powered when it starts (i.e. when unRAID is booted).  It will not automatically share SATA drives.  These have to be shared manually.

- SNAP only mounts the first partition found on a multiple partition drive.

- SNAP unmounts all drives when the unRAID array is stopped.

 

Hot Plug Operation

============

When a USB storage device is plugged into unRAID a hot plug event is initiated by SNAP.  The hotPlugAfterShareEvent.sh is executed and the share name of the USB device indicates the device that has been plugged in.  The actions that you want to perform are then performed.  Because each situation is different, the hotPlugAfterShareEvent.sh should contain the commands unique to your situation.  I typically use rsync to copy files.

 

I have a spare USB flash that I use to back up my flash drive by just plugging it into a USB port once in a while.  When it is plugged in, SNAP detects it and initiates a hot plug event.

 

I have the following in the hotPlugAfterShareEvent.sh file to back up my flash drive:

'FlashBackup')
LOGFILE=/var/log/FlashBackups
PROG_NAME=FlashBackup

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

logger Started -t$PROG_NAME
echo "Started" > $LOGFILE

rsync -a -v -q --delete /boot/ $MOUNTPOINT/ 2>&1 >> $LOGFILE

logger Log File - FlashBackups  -t$PROG_NAME

/boot/config/plugins/snap/snap.sh -MW FlashBackup

logger USB Flash Drive can be removed -t$PROG_NAME
echo "USB Flash Drive can be removed" >> $LOGFILE
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

All of the "beep" lines give me audible sounds in the system speaker so I know what is happening without having to look at the webGUI.  the 'FlashBackup' is the share name of the device that was plugged in.  The logging is so I can look at the log and see the progress of the backup.

 

I also have entries for Weekly and Monthly USB drive backups so I can backup some important files onto portable USB drives and take them off-site.  The beauty of this scheme is that all I have to do is plug in the USB drive and the backup happens automatically.

Link to comment
  • Replies 188
  • Created
  • Last Reply

Top Posters In This Topic

Latest revision (5.11) Working for me on version 5.0

 

Thank you for reviving this App.

 

Addendum to Read.me:

 

From "NTFS Write Driver"

 

"cp /boot/config/plugins/snap/ntfs-3g-2011.1.15-i486-1.txz /boot/extra

 

Reboot your server. This will install the ntfs-3g package."

 

run from cd /boot/extra installplg ntfs-3g-2011.1.15-i486-1.txz to install instead

 

Worked without rebooting.

Link to comment

"cp /boot/config/plugins/snap/ntfs-3g-2011.1.15-i486-1.txz /boot/extra

 

Reboot your server. This will install the ntfs-3g package."

 

run from cd /boot/extra installplg ntfs-3g-2011.1.15-i486-1.txz to install instead

 

Worked without rebooting.

Thank you.  Added this to the first post and read.me on GitHub.

Link to comment

Getting the following error on invoking installplg snap.plg

 

installing plugin: snap

Warning: simplexml_load_file(): I/O warning : failed to load external entity "snap.plg" in /usr/local/sbin/installplg on line 13
xml parse error

 

On rebooting server I get the  following in the syslog:

 

Oct  6 09:17:37 Tower logger:  file /tmp/preSnapInstallCleanup.sh: successfully wrote INLINE file contents
Oct  6 09:17:37 Tower logger:   /bin/bash /tmp/preSnapInstallCleanup.sh ... success
Oct  6 09:17:37 Tower logger:  file /tmp/prepareForSnapInstall.sh: successfully wrote INLINE file contents
Oct  6 09:17:38 Tower logger:   /bin/bash /tmp/prepareForSnapInstall.sh ... Error: Unable to download LatestSnapVersion information from GitHub. (Errors)
Oct  6 09:17:38 Tower logger: success
Oct  6 09:17:38 Tower logger:  file /tmp/SnapInstall.sh: successfully wrote INLINE file contents
Oct  6 09:17:38 Tower logger:   /bin/bash /tmp/SnapInstall.sh ... success
Oct  6 09:17:38 Tower logger:  plugin successfully installed

 

Any ideas?

Cheers,

Phil

Link to comment

The first problem appears to be from not invoking installplg correctly.  That is an installplg error.

 

The second problem is obviously from not being able to download the latest version from GitHub.  SNAP did not install.

 

Do the following and let me know the results:

 

telnet to your server.

cd /boot/config/plugins

installplg snap.plg

 

Link to comment

I get the error message:

installing plugin: snap

Warning: simplexml_load_file(): I/O warning : failed to load external entity "snap.plg" in /usr/local/sbin/installplg on line 13
xml parse error

 

Not sure if it thinks the snap.plg file is corrupt? I have re-downloaded to check but no change...

 

Edit: Managed to fix the error by using the wget command in your first post to download direct to the server. Not sure if the file was being corrupted during download via my Windows 7 PC.

 

Cheers,

Phil

Link to comment

Thanks

Installed and working.

 

I put in three NTFS drives and two show as No FS.

 

Would it be possible to add an option to format the drive in the right click menu.  If possible, could NTFS be an option?

 

Need to pull the drives and try the format again in the windows box.

 

Second question

 

Now that I have a drive mounted how do I use it?  I can see the share from the server, but I want to use mc or a copy command to transfer files within the unRaid OS and not via windows.  I can't the share under /mnt or the drive anywhere else (very green with Linux so forgive me if its a simple question)

 

Edit---  Found it.  It mounted as disk.  I looked at the last disk (disk4) expecting it to be there but it jumped the queue and mounted as 'disk' which is what I expected to be an existing disk in the array.

 

Last request

I have a norco case and it has drive LED on the caddy.  Is it possible somehow to flash one of the LED's to identify the drive.  When there are 24 bays it is easy to select the wrong drive when pulling them out.

Link to comment

I put in three NTFS drives and two show as No FS.

 

Would it be possible to add an option to format the drive in the right click menu.  If possible, could NTFS be an option?

 

Probably not.  I don't think SNAP should format drives.

 

Last request

I have a norco case and it has drive LED on the caddy.  Is it possible somehow to flash one of the LED's to identify the drive.  When there are 24 bays it is easy to select the wrong drive when pulling them out.

 

No.

Link to comment

First off nice work on picking this up. As I have said many times SNAP IMHO is one of the most important unRAID addons there is.

 

So please do not take any this negatively I really want to see this succeed.

 

Comments:

 

You have forked the addon development but not renamed the project i.e it is still called SNAP. This is generally considered bad form as the donor project is still a thing in its own right. Imagine if the donor project released a new version. Suggest you rename your project or contact the donor to see if you can turn your project into a continuation rather than a fork.

 

You seem to be using git hub to just release binary and not work on the raw code there. This is your choice but not what people expect. You should really have all the .sh code in github and also the script to compile.collate the binarys. If you want to also have /releases/blah.tar there that deals with your distribution problem.

 

The git commit logs have duplciates. i.e. "Version 5.13 Release" Again this comes back to the development ofline but each commit should be uniqie so that people can follow it and it sets the bedrock for community submissions.

 

You have incluided inotify. I could be wrong but I believe this is in unRAID 5 as standard now. Eityher way IMHO it is better for the script to grab any upstream packages from upsteam rather than bundling the package in your. This relevaes you of you GPL requirements of the upstream and also allows code reviewers to better trust the source. etc

 

You correctly identify that NTFS is not part of the package but include it for ease. I agree SNAP has no place installing NTFS supprt that is the job of unRAID proper or a simple separate addon. To that end i suggest you fmeove the package and either create a new NTFS plg or ask someone else to. It also saves you the effort as with inotify GPL etc.

 

This one is hard to write without sounding like a dick. I believe the spirit of all things OSS is in place here and it is a short step to getting this fixed but technically you have breached both GPL and the donor projects copyright by forking. This is because neither SNAP or you fork has included any copyright or license notes which means that SNAP is not free to fork. Because the way you have cehcked in binarys you have no means to apply original copyright or show your code vs. the original.

 

The simplest way to deal with most of this is to ask the donor to clarify license (suspect GPL).

Backup you code

Blank your repo

Upload the donor as a newly named repo fullfilling the GPL requirements and showing the point of the fork.

Work on you code in github with a commit and comment per single change.

 

 

Again super nice work. The reason I have taken to time to write so much here is I think you have the potential for one of the biggest addons so the groundwork should be right.

 

Kudos

Link to comment

Thank you for your comments.

 

First of all I did not intend to fork a new plugin project.  I've been in communication with Queeg and he is unable to work on SNAP at this time.  The original SNAP project does not work.  I agree that it is a valuable plugin, so I worked on it to get it working properly.  I did not substantially change the plugin or add any new functionality.  I'm hoping the Queeg will be able to take it and continue on with it at some time.

 

I have not done a good job with the GitHub commits because of my inexperience with it and because I had to put the early releases on GitHub for "live" testing.  The plugin downloads the bundle directly from GitHub and I experienced some problems getting it working.

 

In general, the situation with unRAID plugins and Slackware packages is not worked out at this point.  What really needs to happen is for a plugin to specify a Slackware package and unRAID manage installing/verifying the latest version.

 

I appreciate your comments about the project, forking, copyrights, etc.  At this time I feel the best thing to do is to work with Queeg to get him to take what I have done and incorporate it back into his original work and release that as the offical SNAP plugin for unRAID, or to get his original SNAP working on his own.  I'd be happy to work with him.

 

I agree the way I've done this is messy and not to "protocol".  What I have done is at best a temporary situation.  I will wait for the unRAID plugin schema to settle down, and work with Queeg to come up with a final resolution, which I hope will be for him to maintain and support SNAP.

Link to comment

External Drive not mounting?

 

What did I do wrong? I installed the latest SNAP 5.13, my Unraid version is 5.0. The installation including the ntfs was runnung smoothly without any problem. But when I try to mount an external 2.5 hard disk (usb) the drive will be detected without any problem. But I can`t mount the drive or share anything. Only the "drive is spiining" is shown in green colour.

 

Best regards for your help

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.