New Application: S. N. A. P.


Recommended Posts

  • Replies 566
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Firstly I'll confess to not reading the whole thread word for word.. :-[

 

I'll list the commands i've done:

 

snap.sh -a 010101012 MyShare

snap.sh -m MyShare

snap.sh -s MyShare

 

Nothing appears in my folder list on my Win7 PC.

 

However, if I restart samba via unmenu everything works. Its this normal or should the script reload the samba config?

 

Did this happen only on the very first time you add a drive and then share it or does it happen every time?

Link to comment

sam9s,

 

After reading your posts I wasn't sure if you still have questions or if it's working for you now?

 

Sorry for the confusion on creating a partition and filesystem.  I intentionally left that capability out of SNAP. 

 

I'll take a look at the error you saw.  The blue parts below are intended.  The green part was not - I'll fix that up.

 

 

root@SamTower:/boot/config/snap# snap.sh -m temp

./snap.sh: line 863: [: /mnt/disk/temp: binary operator expected

basename: missing operand

Try `basename --help' for more information.

Partition doesn't exist, cannot be mounted.

 

If I try the same with device ID I get

 

root@SamTower:/boot/config/snap# snap.sh -m WD-WMAM9CAY2782

File system is unknown, cannot be mounted for device: /dev/disk/by-id/scsi-SATA_WDC_WD800BD-22M_WD-WMAM9CAY2782-part1

 

 

Link to comment

sam9s,

 

After reading your posts I wasn't sure if you still have questions or if it's working for you now?

 

Sorry for the confusion on creating a partition and filesystem.  I intentionally left that capability out of SNAP.  

 

I'll take a look at the error you saw.  The blue parts below are intended.  The green part was not - I'll fix that up.

 

 

root@SamTower:/boot/config/snap# snap.sh -m temp

./snap.sh: line 863: [: /mnt/disk/temp: binary operator expected

basename: missing operand

Try `basename --help' for more information.

Partition doesn't exist, cannot be mounted.

 

If I try the same with device ID I get

 

root@SamTower:/boot/config/snap# snap.sh -m WD-WMAM9CAY2782

File system is unknown, cannot be mounted for device: /dev/disk/by-id/scsi-SATA_WDC_WD800BD-22M_WD-WMAM9CAY2782-part1

 

No things were sorted out as per my post no. 322. I have explained everything there. About the green part, I think the error came because of three entries (2 wrong and one correct) in my shap.list file check Post no 321. I am just guessing though. But anyway, unclear instruction does not take away the fact that SNAP is one to the top utilities created for Unraid. Hope this becomes a default feature in the coming versions. Thanks again for such a powerful tool.

Link to comment

Firstly I'll confess to not reading the whole thread word for word.. :-[

 

I'll list the commands i've done:

 

snap.sh -a 010101012 MyShare

snap.sh -m MyShare

snap.sh -s MyShare

 

Nothing appears in my folder list on my Win7 PC.

 

However, if I restart samba via unmenu everything works. Its this normal or should the script reload the samba config?

 

Did this happen only on the very first time you add a drive and then share it or does it happen every time?

 

I've only tried it the once as I hardly ever restart my unraid box. If it's worth testing tho I'll hue it a reboot and run the above again and get back to you.

Link to comment

Firstly I'll confess to not reading the whole thread word for word.. :-[

 

I'll list the commands i've done:

 

snap.sh -a 010101012 MyShare

snap.sh -m MyShare

snap.sh -s MyShare

 

Nothing appears in my folder list on my Win7 PC.

 

However, if I restart samba via unmenu everything works. Its this normal or should the script reload the samba config?

 

Did this happen only on the very first time you add a drive and then share it or does it happen every time?

 

I've only tried it the once as I hardly ever restart my unraid box. If it's worth testing tho I'll hue it a reboot and run the above again and get back to you.

 

It seems to only happen the first time on the first use of SNAP.  Maybe it is the samba restart issue.  I thought I remembered having it try to mount/share whenever a new drive is added to SNAP thinking that was enough.  It never happens after the first time so it keeps getting pushed to the back burner if you know what I mean. 

Definitely the error in green is something to fix so I'll look at that. 

 

I do appreciate all input in improving it and making the instructions more readable.  I was interested in providing some sort of gui to add new drives.  I'm sort of waiting to see how all the plug in support will work in unRAID v5.  If I were to do it today I'd add a new tab to bpj999's MyMain add-on. 

 

Link to comment

I'm having issues with SNAP too (being a linux noob) instructions were a little hazy. (I could just be an idiot.  That's what my friends tell me). Anyways.  I've successfully snapped my USB drive (its FAT32 and I'm pretty sure this is my problem but I wanted to make sure - I just want to transfer files over!)

 

Anyways I've snapped my USB drive and gave it the name TEMPDR (original)

Then i used snap.sh -s TEMPDR to share it. 

Now when I use Finder to get into the drive I get this error - The operation can’t be completed because the original item for “TEMPDR” can’t be found.  Did I miss something? 

Link to comment

I'm having issues with SNAP too (being a linux noob) instructions were a little hazy. (I could just be an idiot.  That's what my friends tell me). Anyways.  I've successfully snapped my USB drive (its FAT32 and I'm pretty sure this is my problem but I wanted to make sure - I just want to transfer files over!)

 

Anyways I've snapped my USB drive and gave it the name TEMPDR (original)

Then i used snap.sh -s TEMPDR to share it. 

Now when I use Finder to get into the drive I get this error - The operation can’t be completed because the original item for “TEMPDR” can’t be found.  Did I miss something? 

 

Glad to help.  You did pretty good so far. 

Since it's right after you first added the drive, you would also needed to have also done snap.sh -m TEMPDR to mount the device.  Or, you could unplug and replug it and then SNAP should do it by itself. 

 

SNAP actually does the two separate steps of mounting the device and then creating the share each time.  One of these days I'll have to make that first step a little more automatic.  Thanks for hanging in there.

Link to comment

Just want to say thanks for this and ask a question.

 

I finally got around to actually using S.N.A.P. I'd only played around with it before, but as my backup storage requirements have increased I decided it was time to really utilize it with hot plug events.

 

My Antec case has a built in eSata hard drive dock, so, with help from gfjardim's script, I found it surprisingly easy to set up a couple drives to automatically back up my most important data. Now it can be accomplished in a much more automated and time efficient method than before, which had been over my LAN using a couple of old Buffalo LinkStation NAS and manually executed scripts. Another plus is that the backup drives now are very easy to transport off site, and also increasing capacity will be a simple matter.

 

So big thanks to queeg and gfjardim and everyone else who has contributed with suggestions.

 

Now I'm thinking about other slick ways to possibly utilize S.N.A.P. I can see how it might work well to sync my music library to my mp3 player. Every time I add new music to the server, I'd just plug in the player and with an automated hotplug event rsync the music library. But here's the rub and the question.

 

My Sansa Fuze and Clip+ players have both internal flash storage and high capacity micro sd card slots. So there are, in effect, two drives in the player. I'm wondering if it would be feasible, and not a huge amount of hassle, to use Logical Volume Management (LVM) to treat the two physical "drives" as one logical drive to rsync to?

 

Any advice on how to do this or any other alternatives would be greatly appreciated since I'm essentially a linux noob.

 

Link to comment

Hey, I want to use this to mount a non-array applications drive. Is this alright:

 

1) Preclear 320GB drive (application drive)

2) Use snap to mount drive

3) Install SAB/SB/CP

4) Point mover options for SB/CP to media share

 

 

Thanks.

 

It sounds like your going to install the apps on the unRAID box - correct?  Apps running on unRAID can get to the SNAPed share like this:  /mnt/disk/sharename  where the sharename is whatever you have used for the SNAPed drive share.

 

I have SAB/SB/CP working currently on a non-array drive. Currently I have been using the "Disk Management" utility in unMenu to manually mount, mount as writable, then share the drive. Someone pointed me towards SNAP so this will happen automatically upon restarts. I have SNAP installed and have added the drive WD-WCAZA5734311. I can use the snap.sh -b and the drive becomes available. However I still have to do this manually. How do I get this to happen upon a restart?

 

I am currently using unRaid 4.7

 

Thanks!

Link to comment

For an application drive, what would be the benefit of SNAP over a cache drive ?

 

I currently have what the system is a cache drve installed and SAB/SB/CP installed on that. In the unRAID setting I tell the system not to use cache.

 

It seems to work well for apps, whether the cache is used for caching as well as apps or not.

 

I can see SNAP being very handy is I want to plug in an external disk that I can backup too or use for large transfers. I'll install it soon for that so if there is an advantage of snaping my current non-caching cache apps disks I'd love tp hear it.

Link to comment

Hey, I want to use this to mount a non-array applications drive. Is this alright:

 

1) Preclear 320GB drive (application drive)

2) Use snap to mount drive

3) Install SAB/SB/CP

4) Point mover options for SB/CP to media share

 

 

Thanks.

 

It sounds like your going to install the apps on the unRAID box - correct?  Apps running on unRAID can get to the SNAPed share like this:  /mnt/disk/sharename  where the sharename is whatever you have used for the SNAPed drive share.

 

I have SAB/SB/CP working currently on a non-array drive. Currently I have been using the "Disk Management" utility in unMenu to manually mount, mount as writable, then share the drive. Someone pointed me towards SNAP so this will happen automatically upon restarts. I have SNAP installed and have added the drive WD-WCAZA5734311. I can use the snap.sh -b and the drive becomes available. However I still have to do this manually. How do I get this to happen upon a restart?

 

I am currently using unRaid 4.7

 

Thanks!

 

Add the command to your /boot/config/go file.

 

Link to comment

For an application drive, what would be the benefit of SNAP over a cache drive ?

 

I currently have what the system is a cache drve installed and SAB/SB/CP installed on that. In the unRAID setting I tell the system not to use cache.

 

It seems to work well for apps, whether the cache is used for caching as well as apps or not.

 

I can see SNAP being very handy is I want to plug in an external disk that I can backup too or use for large transfers. I'll install it soon for that so if there is an advantage of snaping my current non-caching cache apps disks I'd love tp hear it.

 

A cache drive is used by unRAID to do caching for writes.  Snap drives are outside the unRAID array.  I suppose you can put applications on either.  You can't use a snap drive for caching.  You better not try hot swapping a cache drive. 

Link to comment

A cache drive is used by unRAID to do caching for writes.  Snap drives are outside the unRAID array.  I suppose you can put applications on either.  You can't use a snap drive for caching.  You better not try hot swapping a cache drive.   

 

True, but under Share settings I select No for "Use cache disk:" and I assume it's not used for cache.  It just mounts the cache when it boots up.

 

I was never going to replace cache with a removable disk.

 

I was just wondering if there is any advantage to moving the apps disk I have to a SNAP mountable or leave assigned as the a non-caching cache drive.

Link to comment

Hey, I want to use this to mount a non-array applications drive. Is this alright:

 

1) Preclear 320GB drive (application drive)

2) Use snap to mount drive

3) Install SAB/SB/CP

4) Point mover options for SB/CP to media share

 

 

Thanks.

 

It sounds like your going to install the apps on the unRAID box - correct?  Apps running on unRAID can get to the SNAPed share like this:  /mnt/disk/sharename  where the sharename is whatever you have used for the SNAPed drive share.

 

I have SAB/SB/CP working currently on a non-array drive. Currently I have been using the "Disk Management" utility in unMenu to manually mount, mount as writable, then share the drive. Someone pointed me towards SNAP so this will happen automatically upon restarts. I have SNAP installed and have added the drive WD-WCAZA5734311. I can use the snap.sh -b and the drive becomes available. However I still have to do this manually. How do I get this to happen upon a restart?

 

I am currently using unRaid 4.7

 

Thanks!

 

Add the command to your /boot/config/go file.

 

 

what should that command look like? should that be placed right after //boot/unmenu/uu ?

 

Thank you

Link to comment

Hey, I want to use this to mount a non-array applications drive. Is this alright:

 

1) Preclear 320GB drive (application drive)

2) Use snap to mount drive

3) Install SAB/SB/CP

4) Point mover options for SB/CP to media share

 

 

Thanks.

 

It sounds like your going to install the apps on the unRAID box - correct?  Apps running on unRAID can get to the SNAPed share like this:  /mnt/disk/sharename  where the sharename is whatever you have used for the SNAPed drive share.

 

I have SAB/SB/CP working currently on a non-array drive. Currently I have been using the "Disk Management" utility in unMenu to manually mount, mount as writable, then share the drive. Someone pointed me towards SNAP so this will happen automatically upon restarts. I have SNAP installed and have added the drive WD-WCAZA5734311. I can use the snap.sh -b and the drive becomes available. However I still have to do this manually. How do I get this to happen upon a restart?

 

I am currently using unRaid 4.7

 

Thanks!

 

Add the command to your /boot/config/go file.

 

 

what should that command look like? should that be placed right after //boot/unmenu/uu ?

 

Thank you

 

Put this in your go file.  In mine it's the last line of the go file but it doesn't really matter.

 

/boot/config/snap/snap.sh -b

Link to comment

A cache drive is used by unRAID to do caching for writes.  Snap drives are outside the unRAID array.  I suppose you can put applications on either.  You can't use a snap drive for caching.  You better not try hot swapping a cache drive.   

 

True, but under Share settings I select No for "Use cache disk:" and I assume it's not used for cache.  It just mounts the cache when it boots up.

 

I was never going to replace cache with a removable disk.

 

I was just wondering if there is any advantage to moving the apps disk I have to a SNAP mountable or leave assigned as the a non-caching cache drive.

 

I don't really have an opinion on it.  It might not be better either way.  Just different.

Link to comment

I have apps running on my cache drive and sometimes I have difficulty stopping the array because the cache cannot stop. If I move apps to a snap drive, could I stop the array without closing the apps?

 

 

Yes, but why would you want to do that.  Not closing the apps properly could lead to corruption of there databases, config files, and settings.

Link to comment

I have apps running on my cache drive and sometimes I have difficulty stopping the array because the cache cannot stop. If I move apps to a snap drive, could I stop the array without closing the apps?

Yes, but why would you want to do that.  Not closing the apps properly could lead to corruption of there databases, config files, and settings.

was a thought, I had to rebuild a disk to get it 4k aligned but couldnt find which app was stopping cache from unmounting (I'm a noob in Linux). I guess that its not often I need to do that :)

 

Was running sabnzb and couchpotato on cache...

Link to comment

couple of queries, have installed on 5b12a, seems to run

 

1) iphone/ipad do not appear in the usb devices list..... is this correct?. Would like to just plug in the iphones and it will backup to photos directory...

2) When mounting a flash usb drive for testing, I cant see the files on the drive - it disconnects when I click on the share (I'm using a mac with Lion osx). Looking at the permissions, the disk directory is 755 with owner "root root". The mounted drive is 760 and "root users". The other disk1-6 dirs are 770 and "nobody users" and subsequent directories (shares) are 770 and "nobody users". Remember, I'm using the 5b12a and I believe that ownerships have changed.

 

cheers

Tony 

Link to comment

I have been using S.N.A.P for the past few months and am enjoying this great addon.

 

I have been using an auto copy script which has been working fine.

 

This evening I added a new usb thumbdrive with a share name of "lex8gjump"

I see the drive and can copy to and from just fine.

 

The problem is that it does not auto copy when inserted.  I have added the share name, to the auto copy script, inserted and reinserted but no copy or beeps occur.

My previously added thumbdrives  (bluec4) etc - auto copy fine....

 

Would someone please have a look to see where I might have made a mistake?? Or

have some suggestions to solve the issue

I am using unraid 4.7

THANKS

JOEMAN

 

Below is THE AUTOCOPY SCRIPT

----------------------------------------------------------------------------------------

 

### hotPlugAfterShareEvent.sh

### This script will be called when a device is hotplugged in, after it has been shared.

###

 

BOOTCONFIG=/boot/config

SNAPHOME=/boot/config/snap

#Load common code.

source $SNAPHOME/snapCommon.sh

 

PATH=$PATH:./

export PATH

 

usage()

{

cat << EOF

usage: $0 options

 

OPTIONS:

  -d      Device Id

  -e      Event

  -p      Partition

  -m      Mount point

  -s      SerialNumber from snap.list

  -h      Share name from snap.list

  -q      Quiet

EOF

}

if [ -z "$1" ]

then

usage

fi

while getopts a:d:e:h:m:p:s:q option

do

 

       case "${option}"

       in

               a) ACTION=$OPTARG;;

d) DEVICEID=$OPTARG;;

e) EVENT=$OPTARG;;

               p) PARTITION=$OPTARG;;

               m) MOUNTPOINT=$OPTARG;;  # same as sharepoint

s) SERIALNUMBER=$OPTARG;;

               h) SHARENAME=$OPTARG;;

               q) QUIET="TRUE";;

               \?) usage

                   exit 1;;

       esac

 

done

 

echo "Running hotPlugAfterShareEvent.sh"

case $SHARENAME in

'bluec4' | 'blackc4' | 'blackhip16' | 'SDCARD' | 'photosd' | 'lex8gjump')

   #

# MAKE A BEEP STARTING COPY SOUND ----------------------------------

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

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

#ASSIGN A LOCATION WHERE YOU WANT DATA TO BE COPIED TO -------------

destination="/mnt/disk2/${SHARENAME}data"

#

#IF DESTINATION DOES NOT EXIST THEN MAKE DIRECTORY------------------

if [ ! -d $destination ]

then

mkdir $destination

fi

#It will copy updated and new files only.  It will work for both sharenames and create a folder for each using ${SHARENAME}data

#

rsync -aq --size-only $MOUNTPOINT/* $destination/ 2>&1 >> $SNAPHOME/hotPlugAfterShareEvent.log

#

# cp -r $MOUNTPOINT/* $destination 2>&1 >> $SNAPHOME/hotPlugAfterShareEvent.log

# MAKE WINDOWS SHARE VISABLE PLUS READ / WRITE -----------------------

chmod 666 $destination/*

#BEEP JOB IS DONE-----------------------------------------------------

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

;;

esac

 

----------------------------------------------------------------------------------------------------------

I found out the problem - I inadvertently used a text editor which introduced some hidden formats which s.n.a.p did not like..

The cure was to save my modified script using METAPAD - the free text editor

 

Oops .......

Thought I would leave the post here in case someone finds it useful..

 

Link to comment

Followup to my previous post regarding the use of gfjardim's script to run automated backups to hot plugged drives.

 

His script is designed to create a new archival directory named for the current date every time it is run, so there are soon multiple generations of copies. This is a nice strategy, except, as I found, it can fill up a hard drive pretty quickly. Once the drive is full the script doesn't provide any warning of that fact, which leads to other complications.

 

I'd appreciate it if someone would please share some code that could provide notification when space is getting tight on a drive. One approach might be to play an alternate beep code should there be less than a designated amount of free space on the drive when the hot plug events script begins. Depending on the space threshold, it could either abort the copy or allow it to continue with a warning logged.

 

 

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.