New Application: S. N. A. P.


Recommended Posts

Note: I'm going to post any files or updates here in this first post.  So to get the latest files, install instructions or version notes here.

Note: SNAP has been tested and is working in unRAID versions 4.5, 4.65, 4.7, 5.0beta6a  

but not officially tested on any unRAID 5.0 version yet.  Member prostuff1 has reported that it doesn't run on unRAID version 50beta3 (many add-ons broke in that beta).  


Snap: Share Non-Array Partitions                                                Updated: 1/30/2011  (New version 0.47)

 

 

What is SNAP for?

Ans:  Adding storage devices to an unRAID server without them being part of the unRAID array.

What's a storage device exactly?

Ans:  USB devices like flash drives, eSata hard drives, even internally mounted hard drives can be added.

What does SNAP do with storage devices?

Ans:  Adding a device to SNAP means that it's filesystem will be mounted to make it available in linux and shared out to make it available on the network.  The device must have one or more partitions and at least one of the partitions must have a filesystem on it.

Where does it get mounted and shared?

Ans:  When you add the device to SNAP, you give it a sharename, something to remember it like LexarWork or MySongs.  Then when you plug in the device SNAP will mount it at /mnt/disk/LexarWork for instance and will create a share like \\tower\LexarWork that is available from the network.

Is that all?

Ans:  Almost.  SNAP supports custom bash scripts that you can modify to do specific actions.  When you plug in the device an event is raised on the server and it can run your script.  Scripts can do things like copy files to and from the device.  

Does it interfer with unRAID?

Ans:  No.  SNAP is aware of the unRAID array drives and doesn't disturb them.

 

 

Key features:

o Mounting and sharing non-unRAID hard drive partitions.

o Supports hotplugging: USB hard drives, flash drives, eSATA hard drives, even [glow=red,2,300]MP3 Players, iPhone or Digital Camera[/glow]!    :o

o Mounts and unmounts automatically.

o Works with internally mounted hard drives drives also.

o User specifies which drives to Snap.  No interference to unRAID volumes.

o Hotplug events exposed:  Automatic file copy/Backup possible now.  << New Feature

o Very small footprint.  No polling for changes so no cpu cycles used when idle.

o Install process.

o Uninstall process.

 

If your like me you have a stack of older hard drives sitting around with data on them.  I didn't want to push all that older data onto my unRAID system so I wrote this application to be able to give a drive an easy name (versus the serial number) to remember.  I tell Snap the serial number and the friendly name.  Then when I plug in the drive Snap detects it, mounts it and makes a share using the friendly name.  When I'm done and unplug the drive then Snap unmounts and removes the share automatically.  

 

I actually have some drives with multiple partitions on them.  So Snap mounts and shares all the partitions on drives it knows about.  Here's an example.  Say you have a drive you wish to call "CarShows09".  Snap will create a share for the first partition called "CarShows09".  The second partition will be shared as "CarShows09-part2" and so on.  This gives you an simple way to assign a simple share name to as many hard drives as you want.  

 

I'm going to post any files or updates here in this first post.  So to get the latest files, install instructions or version notes then this is where to find them.  

 


 

NOTE: New installation procedures as of 0.47.  

 

Install SNAP:

Version 0.47

SNAP comes with an installer script now that supports new install, update or reinstallation.

1. Download the snap_user_script_buttons_01302011.zip  available at the bottom of this post.

2. Extract and copy the two files to /boot/unmenu folder.

3. Open unMenu in browser.  Choose the User Scripts page.

4. Scroll down and click the Check For SNAP Updates button.

5. When the page reloads, scroll down and click the Install, Update, Re-install button depending on which shows up.

6. Clicking the Install, Update or Re-install button will open and install  in a separate browser.  

 

Hint:  For step 2:  Open unRAID web page, on Shares page set the Flash share (SMB): to export.  That makes a share point called \\Tower\Flash which is the unRAID /boot folder.  Then you can copy the button scripts to \\Tower\Flash\unmenu folder from your main computer.

 

Note: If you aren't using unMenu you can install SNAP by following these procedures.

 

Version 0.46 and older

All Snap files are in a single zip file.  

1. Make a folder on your unRAID flash drive:  mkdir /boot/config/snap

2. Unziip Snap and copy contents into /boot/config/snap

3. Run the install:    /boot/config/snap/snap.sh -install

4. Assign drives to Snap:   snap.sh -a [serialnumber] [sharename]

 

Note:  Installing SNAP adds this "/boot/config/snap/snap.sh -b" to your /boot/config/go script so SNAP will be activated when your system is booted up.

If you want to activate SNAP without having to reboot then run that command in a telnet prompt.  You only need to run it once per boot up.

Once SNAP is installed, it will automatically detect hotplugged usb devices and automatically runs "snap.sh -u".  You can also manually run "snap.sh -u" anytime which will look for any SNAP drives that aren't mounted/shared yet and get them mounted/shared out.  

Note: Be sure you're at: root@Tower:/boot/config/snap# and not root@Tower:~#

to enter snap.sh -a [serialnumber] [sharename] and other snap.sh commands

 

 


 

Assign Drives To SNAP:

 

Snap is a command line program.  To use it you need to log in to the unRAID command prompt.  You can do that using telnet or putty or at the main console.  

Note: To assign a storage device to SNAP, it must have a partition and a filesystem.  If you need to partition a bare drive read the section on "Create Partition and Filesystem" below.

 

Sharename

In order for Snap to detect and share drives you have to assign them.  This is done by assigning a sharename to a storage device (usb, flash, hard drive etc).  The sharename is practically any word or combination of letters and numbers (no spaces).  The sharename is how you get access to the files from a remote computer and it will be visible like \\tower\sharename.

Device Name

In unRAID, each storage device has it's own device name.  The last part of the device name is the device serial id that we are interested in.  That serial id is how Snap identifies the correct storage device when it shares it out for you.  So to assign a drive to Snap you have to get the serial id part from it's device name.  

 

 

1. Plug the drive into your unRAID server so linux will create a device name for it.

2. Show the devices on your unRAID server by typing:  snap.sh -listDevInfo  

3. Determine which is the one your interested in.  Plugging/unplugging will make it appear/disappear from the list.

4. Assign the drive to Snap:   snap.sh -a serialnumber  sharename

Note:  The [serialnumber] must to be unique so that Snap can find the correct device.  You don't have to enter the whole linux device id, just the serial number part which will be highlighted in blue.  See my example below.

Example: of snap.sh -showusb

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

usb-Lexar_JD_FireFly_JMSH6RPBKDR7NYYFGIMM-0:0

usb-Lexar_JD_FireFly_JMSH6RPBKDR7NYYFGIMM-0:0-part1

usb-ST312002_4A_35A1E3662222-0:0

usb-ST312002_4A_35A1E3662222-0:0-part1

usb-ST312002_4A_35A1E3662222-0:0-part2

usb-ST312002_4A_35A1E3662222-0:0-part3

usb-ST312002_4A_35A1E3662222-0:0-part5

usb-ST312002_4A_35A1E3662222-0:0-part6

usb-ST325041_6RY6_888888888888-0:0

usb-ST325041_6RY6_888888888888-0:0-part1

 

Example: of snap.sh -listDevInfo

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

root@Queeg:/boot/config/snap# snap.sh -listDeviceConfigurationInfo

unRAID=Yes SNAP=No 3663 /dev/sdb /dev/disk/by-id/ata-ST31500341AS_9VS3057K

unRAID=Yes SNAP=No 3551 /dev/sdd /dev/disk/by-id/ata-ST31500341AS_9VS33P6J

unRAID=No SNAP=Yes 3423 /dev/sda /dev/disk/by-id/ata-ST3500320AS_5QM01S58

unRAID=Yes SNAP=No 3605 /dev/sdc /dev/disk/by-id/ata-ST3500320AS_9QM26B35

unRAID=Yes SNAP=No 3663 /dev/sdb /dev/disk/by-id/scsi-SATA_ST31500341AS_9VS3057K

unRAID=Yes SNAP=No 3551 /dev/sdd /dev/disk/by-id/scsi-SATA_ST31500341AS_9VS33P6J

unRAID=No SNAP=Yes 3423 /dev/sda /dev/disk/by-id/scsi-SATA_ST3500320AS_5QM01S58

unRAID=Yes SNAP=No 3605 /dev/sdc /dev/disk/by-id/scsi-SATA_ST3500320AS_9QM26B35

unRAID=No SNAP=No 3495 /dev/sde /dev/disk/by-id/usb-Lexar_JD_FireFly_JMSH6RPBKDR

7NYYFGIMM-0:0

 


 

Additional Information:

 

Example: of my snap.list file of Snap assigned drives:

This file is populated by using: snap.sh -a serialnumber sharename

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

3LJ2TV1A=cuda160

6RY6_888888888888-0:0=DanceRecitals

4A_35A1E3662222-0:0=Holly

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

Did you notice the 3LJ2TV1A=cuda160 entry?  That drive is an IDE drive I mounted internally so it's not a usb drive.

It's linux device id is:  /dev/disk/by-id/ata-ST3160023A_3LJ2TV1A  Since it's not a usb device, the best way for you

to find out internal drive device ids is to use (snap.sh -listDevInfo).  Otherwise, you can use this linux command

that will show all the linux devices:  "ls /dev/disk/by-id"  

Note:  When you enter [serialnumber] [sharename] - Do not include the bracket characters [].

 

Usage: snap.sh [OPTION]...

     -install                                (install Snap)

     -uninstall                             (un-install Snap)

     -disable                               (disable Snap)

     -enable                                (enable Snap)

     -showusb                             (show linux usb devices)

     -v                                       (version)

     -b                                        (init at boot time)

     -a [serialnumber] [sharename]  (add drive to list)

     -r [serialnumber or sharename]  (remove drive from list)

     -u                                       (check for SNAP drives needing mounting/sharing)

     -m [serialnumber or sharename] (mount drive)

     -M [serialnumber or sharename] (unmount drive)

     -s [serialnumber or sharename]   (share drive)

     -S [serialnumber or sharename]  (unshare drive)

 

     -listAvailableDevices          (lists devices not in SNAP or unRAID)

     -listDevInfo                        (lists config info and highlights device id of all disk devices)

     -listDeviceConfigurationInfo   (lists config info of all disk devices)

     -isDeviceInSNAP [/dev/... or /dev/disk/by-id/...]

     -isDeviceInUnraidArray [/dev/... or /dev/disk/by-id/...]

 

      Note: Do not combine multiple parameters in a single call.

 

 

Create Partition and Filesystem

Your storage device must have at least one partition with filesystem for SNAP to mount and share.  If you are wanting to add a bare drive that doesn't have a partition or one that has a partition but no filesystem then this may help get you started.

If you are going to use NTFS then format the drive in your choice of Windows.  Lots of usb devices use variations on Fat32 and I'll let you search that out yourself.  If you want to format it using the rieserfs filesystem that unRAID uses then I suggest doing it via unMenu which you should install on your unRAID system (it's really useful)  and you also may be interested in preclearing the drive before formatting because it runs a validation test.  

To learn more about unMenu go here.  

 

 

RELEASE NOTES:

version 0.47

Added: -v parameter

Added: support for hfsplus filesystem.

Added: -listDevInfo - better version of -listDeviceConfigurationInfo with highlighting.

Added: Version aware Update and Re-install logic.

Changed: /boot/config/smb-extra.conf is backed up when SNAP is installed preserving any existing settings.

Changed: Process management start/stop of background event notification processes.

Changed: samba restart method to kill -1 method.

Changed: samba user: "nobody" now check if exists, created only if doesn't.

Changed: moved all logs to /var/log/snap directory

Changed: Calling snap.sh with relative path works now, used to require full path.

Corrected: -M usage description.

Corrected: snapEventss.log to snapEvents.log

Corrected: Install now starts SNAP at end of successful install.

Corrected: -b option creates empty snap.list if not exists yet.

 

Note: To install use same procedure as for ver 0.1 (See above).  

To upgrade, copy new snap.sh to /boot/config/snap folder.

version 0.46

Fixed:   syntax bug.

Changed: mount parameters for vfat partitions

 

Note: To install use same procedure as for ver 0.1 (See above).  

To upgrade, copy new snap.sh to /boot/config/snap folder.

 

version 0.45

Fixed:   Hotplug might fire for more than one device, now fixed.

Node:   I experienced a funny thing when I plugged two flash drives into the front usb ports on my computer.

          When one flash drive was already plugged in and I plugged in another, the mobo would disconnect

          the first flash drive and then connect both by itself, and linux responded as if the first had been

          physically unplugged and then plugged back in.  Not good because I had

          a copy event on the first one.  When I spread the devices around, one in the back and one

          in the front then it doesn't happen.  And when I have them both in a USB hub it also

          doesn't happen.  

 

Note: To install use same procedure as for ver 0.1 (See above).  

To upgrade, copy new snap.sh to /boot/config/snap folder.

 

version 0.4

Added:  SNAP Hotplug User Events.

           HOTPLUG_IN, HOTPLUG_OUT, AFTER_MOUNT, AFTER_SHARE, AFTER_UNMOUNT, AFTER_UNSHARE

Fixed: Corrected mount command for vfat and msdos fs to use -t instead of t

Now vfat filesystems will be mounted rw

New files: snapEvents.sh, hotPlugAfterShareEvent.sh

 

Note: To install use same procedur as for ver 0.1 (See above).  

To upgrade, copy new snap.sh, snapEvents.sh, hotPlugAfterShareEvent.sh to /boot/config/snap folder.

 

version 0.3

Now before mounting a disk, SNAP checks if that disk has been added to unRAID array.  If so, SNAP does not mount it.

All shares for reiserfs and ntfs-3g are created rw now with all others readonly.

Filesystem type ext3 now mounted as ext2.  http://lime-technology.com/forum/index.php?topic=3835.0

Filesystem support for reiserfs, ntfs, ntfs-3g, vfat, msdos.  No attempt to mount other types is made.

Added message when trying to -a add when drive already is in the list.

Added -listAvailableDevices

Added -listDeviceConfigurationInfo

Added -getSerialNumberFromPath [/dev/disk/by-id/...]

Added -isDeviceInSNAP [/dev/... or /dev/disk/by-id/...]

Added -isDeviceInUnraidArray [/dev/... or /dev/disk/by-id/...]

 

Note: To install use same procedur as for ver 0.1 (See above).  To upgrade, copy snap.sh over old one in /boot/config/snap folder.

 

Version 0.2

New:

Support for ntfs-3g which allows for rw on ntfs filesystems.  ntfs-3g package must be installed by user.

Support for reiserfs.  Uses the same parameters as unRAID when mounting.

Changes:

In v0.1 all samba shares created were readonly.  Now all are rw.  Readonlyness is controlled by how filesystem is mounted.

All filesystems are mounted rw except the standard built-in ntfs driver.

 

Note: To install use same procedur as for ver 0.1 - (See above).  To upgrade, copy all new files over old ones in /boot/config/snap folder.

 

Wiki entry for ntfs-3g.

http://lime-technology.com/wiki/index.php?title=Mounting_an_external_USB_drive_having_an_existing_NTFS_file_system_in_READ/WRITE_mode_to_transport_files_from/to_unRaid_server

 

Newest ntfs-3g driver install package is here:

ftp://slackware.osuosl.org/pub/slackware/slackware-current/slackware/a/ntfs-3g-2010.3.6-i486-1.txz

 

Version 0.1  

Initial release.  

Note:  To install and use Snap you will be required to type a few simple linux commands on your unRAID console or in a telnet session.

         The install instructions are listed about half way down this post.

snap-0.47-build28.zip

snap_user_script_buttons_07292011.zip

Link to comment
  • Replies 566
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

[glow=red,2,300]

HOTPLUG EVENTS ....... HOTPLUG EVENTS .......  HOTPLUG EVENTS .......  HOTPLUG EVENTS

[/glow]

 

Hotplug events are available whenever you plug-in or unplug USB or eSata storage devices.  What are they good for you may ask...

 

Hotplug uses:

 


  • You can automatically copy or move files when plugging in thumb drives.
     
     

  • You can automatically start backups of folders or files from unRAID to external eSata or USB drives.
     
     

  • You can automatically copy/move pictures or video from camera flash cards to any folder in your unRAID array.
     
     

  • You can write custom code to handle these events in any language to process files or folders in any way you need when devices are plugged in.
     
     

 

 

 

These six events are now available to you.

 

        HOTPLUG_IN       : This happens when linux discoveres the new device has been plugged in.

        HOTPLUG_OUT    :  When the device has been removed.

        AFTER_MOUNT    :  After SNAP has mounted the device.

        AFTER_SHARE     :  After SNAP has shared the device.

        AFTER_UNMOUNT : After SNAP has unmounted the device.

        AFTER_UNSHARE  : After SNAP has unshared the device.

 

 

I have provided a stubbed out example script named hotPlugAfterShareEvent.sh as a working example.

 

Here is an excerpt from that script.  In the code below I have a SNAP share I named Lexar.  The device is a 4GB thumb drive.

When I plug in the device it gets mounted and shared by SNAP then this code gets run automatically.  It copies all the files from this thumb

drive to a folder in my unRAID array.  You may also notice the beeps below.  I added those so when I plug in the device I hear a certain beep

tone from the server speaker and then another different one when the files are finished copying - telling me I can pull the drive out again.

Notice that the script checks to see if the top destination folder exists and creates it if not.  Any action is possible.  

...

case $SHARENAME in

'Lexar')

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

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

if [ ! -d /mnt/user/Backup/Lexar ]

then

mkdir /mnt/user/Backup/Lexar

fi

cp -u -r $MOUNTPOINT/* /mnt/user/Backup/Lexar 2>&1 >> $SNAPHOME/hotPlugAfterShareEvent.log

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

;;

...

 

 

SNAP makes the hotplug events available from the snapEvents.sh script.  That script is used to launch a script or code of your own.  I have provided a sample script hotPlugAfterShareEvent.sh that is run from snapEvents.sh.  Please modify hotPlugAfterShareEvent.sh as you like.  Make clones and run them from snapEvents.sh in the same way.  

When you look in hotPlugAfterShareEvent.sh you will see the 'Lexar' tag.  That is one of my SNAP drives.  I gave it the share name Lexar but I could have named it Workreports or SchoolProjects or anything I felt like.  

 

This is what it looks like in my snap.list file:        

      00027D09134953300507-0:0=Lexar

 

This is what the deviceid looks like:  

        /dev/disk/by-id/usb-LEXAR_JD_LIGHTNING_II_00027D09134953300507-0:0@

        /dev/disk/by-id/usb-LEXAR_JD_LIGHTNING_II_00027D09134953300507-0:0-part1@

 

Once you have added a drive to SNAP,  no matter whether it's USB hard drive, a thumb drive or an eSata hard drive, all hotplugging events can be captured.

 

 

Look at this example where I plug in my Digital Camera and all the images are automatically copied to my unRAID array!

 

...

case $SHARENAME in

'OlympusC770')

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

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

if [ ! -d /mnt/user/Pictures/OlympusC770  ]

then

mkdir /mnt/Pictures/OlympusC770

fi

echo "Copying new files on sharename: $SHARENAME in event: $EVENT" >> $SNAPHOME/snapEvent.log

cp -u -r $MOUNTPOINT/DCIM/100OLYMP/* /mnt/user/Pictures/OlympusC770  2>&1 >> $SNAPHOME/hotPlugAfterShareEvent.log

# changing the file attributes so they will be visible by client windows machines.

chmod 666 $destination/*

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

;;

...

 

This is what it looks like in my snap.list file:        

       000369020971-0:0=OlympusC770

 

This is what the deviceid looks like:  

        /dev/disk/by-id/usb-OLYMPUS_C770UZ_000369020971-0:0@

        /dev/disk/by-id/usb-OLYMPUS_C770UZ_000369020971-0:0-part1@

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment

Is this by any chance the same thing that was causing BSOD errors? I am sorry for asking, I just want to be sure before I download it.

 

 

I have reported you to the moderator.

 

Excuse me, queeg, but why are you reporting him to a moderator?

Why would you start a thread if you don't want people to post in it?

 

Link to comment

I added support for ntfs-3g driver in the attached zip file (ntfs-3g.zip).  It contains one file, snap.sh.  After installing the snap.zip from the first post in this thread, copy this newer snap.sh to /boot/config/snap/snap.sh  to get the functionality.

Change:  If /bin/ntfs-3g exists then Snap will mount ntfs drives using it in rw mode.  Otherwise, it uses the built in ntfs driver in readonly mode.

Link to comment

Hey Joe L.  I need some help with a question about device id's.  I recently changed from IDE to AHCI in my motherboard bios.  Now when I list the /dev/disk/by-id directory I see the old ata* device id's from when it was set to IDE but I also see new scsi-SATA* device id's.  I would expect to see one or the other but not both at the same time.  Is this normal?  Do both work the same?  I added a new sata drive 7200.11 1.5TB drive inside the machine but that drive is not going to be part of the array for awhile ( until I can buy a second big drive to be used as parity).  So I'm mounting that drive myself. 

 

ata-ST31500341AS_9VS33P6J

ata-ST31500341AS_9VS33P6J-part1

ata-ST3160023A_3LJ2TV1A

ata-ST3160023A_3LJ2TV1A-part1

ata-ST3500320AS_5QM01S58

ata-ST3500320AS_5QM01S58-part1

ata-ST3500320AS_9QM0EAHW

ata-ST3500320AS_9QM0EAHW-part1

ata-ST3500320AS_9QM26B35

ata-ST3500320AS_9QM26B35-part1

scsi-SATA_ST31500341AS_9VS33P6J

scsi-SATA_ST31500341AS_9VS33P6J-part1

scsi-SATA_ST3500320AS_5QM01S58

scsi-SATA_ST3500320AS_5QM01S58-part1

scsi-SATA_ST3500320AS_9QM0EAHW

scsi-SATA_ST3500320AS_9QM0EAHW-part1

scsi-SATA_ST3500320AS_9QM26B35

scsi-SATA_ST3500320AS_9QM26B35-part1

usb-Lexar_JD_FireFly_JMSH6RPBKDR7NYYFGIMM-0:0

usb-Lexar_JD_FireFly_JMSH6RPBKDR7NYYFGIMM-0:0-part1

Link to comment

Hey Joe L.  I need some help with a question about device id's.  I recently changed from IDE to AHCI in my motherboard bios.  Now when I list the /dev/disk/by-id directory I see the old ata* device id's from when it was set to IDE but I also see new scsi-SATA* device id's.  I would expect to see one or the other but not both at the same time.  Is this normal? 

Yes, it is normal
Do both work the same?
They are two links to the same device, yes, they'll work the same.
  I added a new sata drive 7200.11 1.5TB drive inside the machine but that drive is not going to be part of the array for awhile ( until I can buy a second big drive to be used as parity).  So I'm mounting that drive myself. 

 

ata-ST31500341AS_9VS33P6J

ata-ST31500341AS_9VS33P6J-part1

ata-ST3160023A_3LJ2TV1A

ata-ST3160023A_3LJ2TV1A-part1

ata-ST3500320AS_5QM01S58

ata-ST3500320AS_5QM01S58-part1

ata-ST3500320AS_9QM0EAHW

ata-ST3500320AS_9QM0EAHW-part1

ata-ST3500320AS_9QM26B35

ata-ST3500320AS_9QM26B35-part1

scsi-SATA_ST31500341AS_9VS33P6J

scsi-SATA_ST31500341AS_9VS33P6J-part1

scsi-SATA_ST3500320AS_5QM01S58

scsi-SATA_ST3500320AS_5QM01S58-part1

scsi-SATA_ST3500320AS_9QM0EAHW

scsi-SATA_ST3500320AS_9QM0EAHW-part1

scsi-SATA_ST3500320AS_9QM26B35

scsi-SATA_ST3500320AS_9QM26B35-part1

usb-Lexar_JD_FireFly_JMSH6RPBKDR7NYYFGIMM-0:0

usb-Lexar_JD_FireFly_JMSH6RPBKDR7NYYFGIMM-0:0-part1

Link to comment

Very good work queeg. I'll have to have a play with this on my test rig. An interesting thought would be to somehow integrate this into either the unraid web GUI or unmenu, I don't mind using the cli, maybe as time goes by and it matures too it could be a unmenu feature or possibily be a native feature.

Link to comment

Very good work queeg. I'll have to have a play with this on my test rig. An interesting thought would be to somehow integrate this into either the unraid web GUI or unmenu, I don't mind using the cli, maybe as time goes by and it matures too it could be a unmenu feature or possibily be a native feature.

 

Thanks.  It would be up to Joe whether it ends up in unMENU.  Personally I'd be very honored if it did.

Link to comment

I'm using this on the device before mounting the filesystem:    hdparm -u1

It worked on the internal IDE drive I have and the usb drives which are all ntfs. 

But I got a warning when I used it on reiserfs filesystem on a new 1.5TB 7200.11 connected internally. 

 

HDIO_GET_UNMASKINTR failed: Inappropriate ioctl for device

 

Should this be working? 

Link to comment

I'm using this on the device before mounting the filesystem:    hdparm -u1

It worked on the internal IDE drive I have and the usb drives which are all ntfs. 

But I got a warning when I used it on reiserfs filesystem on a new 1.5TB 7200.11 connected internally. 

 

HDIO_GET_UNMASKINTR failed: Inappropriate ioctl for device

 

Should this be working? 

It says it was an inappropriate I/O Control (ioctl) command for that device.  Are you going to argue with the hardware?  ;)

Is the port you are connected to using an interrupt you can un-mask?  (probably not)

Link to comment

Ok, maybe I should rephrase my question.  How can I tell what driver is being used for the hard drive?  For instance, if the drive has /dev/disk/by-id/scsi-SATA... does that mean it's using the scsi driver?  If it has /dev/disk/by-id/ata-... does that mean it's using the IDE driver? 

Link to comment

Yes and No.

 

In Linux, the interface to ide and sata devices are done through two main device driver libraries. The old and deprecated IDE (CONFIG_IDE) and the new and prefered libATA (CONFIG_ATA). The libATA provides Serial ATA and Parallel ATA Drivers. The way it does so is by interfacing into the kernel through the basic SCSI interface. This is why you see the ATA and SCSI device ids. FWIW, the Slackware-Current distros no longer use the deprecated drivers. Other distros have changed over as well to libATA.

 

Without looking into this further, the only way I know to be certain as to what actual device driver is used for the disk is by reading the Syslog.

Link to comment
  • 2 weeks later...

Hey Joe, I need to know how to tell if a drive is part of unRAID's array.  Would you mind helping me out with some info?  It's possible that a user could assign a drive to the array forgetting it's in SNAP.  I'll check before mounting.

 

It is not too hard, as I do all the same tests in the preclear_disk.sh script before clearing a disk to ensure it is not part of the array.

# everything below uses $theDisk as the device, assign it to the device being tested. (sda used as an example)

theDisk=/dev/sda

 

#----------------------------------------------------------------------------------

# Verify the disk is a block device

#----------------------------------------------------------------------------------

if [ ! -b $theDisk ]

then

    echo "Sorry: $theDisk does not exist as a block device"

    exit 2

fi

 

# read the disk config file to see if the disk is assigned to the array, just in case this

# command is run with the array stopped.

cat /boot/config/disk.cfg | while read config

do

        case $config in

        parity*|disk[1-9]*|cache*)

        disk=`echo  "$config" | sed "s/\([^=]*\)=\([^=]*\)/\1/"`

        disks[$a]=$disk

        id=`echo  "$config" | sed -e "s/\([^=]*\)=\([^=]*\)/\2/" -e "s/\\r//"`

        device=`ls -ld /dev/disk/by-path/$id 2>/dev/null | awk '{ print substr($11,7,3) }'`

        ;;

        esac

        device=/dev/$device

        if [ "$theDisk" = "$device" ]

        then

          echo "Sorry, $theDisk is already assigned as part of the unRAID array."

          exit 2

        fi

done

 

#----------------------------------------------------------------------------------

# Then, do some basic tests to ensure the disk  is not part of the arrray

# and not mounted, and not in use in any way.

#----------------------------------------------------------------------------------

devices=`/root/mdcmd status | strings | grep rdevName | sed 's/\([^=]*\)=\([^=]\)/\/dev\/\2/'`

 

echo $devices | grep $theDisk >/dev/null 2>&1

if [  $? = 0 ]

then

    echo "Sorry, but $theDisk is already assigned as part of the unRAID array."

    exit 2

fi

Link to comment

Hi Queeg,

 

I tried to follow your steps but I can't find the share drive(MyTemp) from Windows7. Also, I think you should include step 5 to your steps because it took me, a linux noob a while to figure out how to run it.

 

Here's my steps:

 

1. Make a folder on my unRAID flash drive:  mkdir /boot/config/snap

2. Unziip Snap and copy contents into /boot/config/snap

3. Run the install:    /boot/config/snap/snap.sh -install

4. Assign drives to Snap:   snap.sh -a Y42K7MWE MyTemp

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

 

 

 

root@TowerDemo:/dev/disk/by-id# /boot/config/snap/snap.sh -b

Added user nobody.

grep: /etc/samba/smb-names.conf: No such file or directory

Starting Samba:  /usr/sbin/smbd -D

                /usr/sbin/nmbd -D

Mounting filesystem for /dev/disk/by-id/ata-Maxtor_6Y160P0_Y42K7MWE-part1 not attempted: Filesystem (silicon_medley_raid_member) is not supported.

Sharing MyTemp...

Starting Samba:  /usr/sbin/smbd -D

                /usr/sbin/nmbd -D

/boot/config/snap/snap.sh: All shares mounted.

root@TowerDemo:/dev/disk/by-id#

 

 

Here's my drive list:

 

root@TowerDemo:/dev/disk/by-id# ls

ata-Maxtor_6L200P0_L41WVXYH@

ata-Maxtor_6L200P0_L41WVXYH-part1@

ata-Maxtor_6Y160P0_Y42K7MWE@

ata-Maxtor_6Y160P0_Y42K7MWE-part1@

ata-WDC_WD800JB-00CRA1_WD-WMA8E2950670@

ata-WDC_WD800JB-00CRA1_WD-WMA8E2950670-part1@

usb-Sony_Storage_Media_1A08072104689-0:0@

usb-Sony_Storage_Media_1A08072104689-0:0-part1@

 

btw, I am using version3. Log attached.

 

thanks,

~joy

 

snap.txt

Link to comment

Hi jouyang,

I'm happy to help with this issue.

I think  your using an unRAID Pro license?  If so, what do you have share security set to (simple or user)?  I'm using simple and I'm actually using the 3-drive free version of unRAID.  So while it should work the same on Pro if you are using simple, I've only tested on free version - up to now.

 

Ok, the first step is just to make sure the disk mounted in the right place. 

Please type the following in a telnet session and reply with the output:

 

mount

ls /mnt/disk

ls /mnt/disk/MyTemp

You should be able to cd /mnt/disk/MyTemp and copy some file to the partition.  cp /boot/config/snap/snap.log /mnt/disk/MyTemp/snap.log

 

Now, just some information about the Samba share to help me see what is going on.

cat /boot/config/smb-extra.conf

 

 

Link to comment

Hi Queeg

 

Yes, I have the Pro version but I don't have any share setup. My user share is currently disabled. Looks like my drive is not mounted.

 

root@TowerDemo:/boot/config# mount

fusectl on /sys/fs/fuse/connections type fusectl (rw)

usbfs on /proc/bus/usb type usbfs (rw)

/dev/sda1 on /boot type vfat (rw,umask=077,shortname=mixed)

/dev/md1 on /mnt/disk1 type reiserfs (rw,noatime,nodiratime)

root@TowerDemo:/boot/config# ls /mnt/disk

/bin/ls: cannot access /mnt/disk: No such file or directory

root@TowerDemo:/boot/config# ls /mnt/disk/MyTemp

/bin/ls: cannot access /mnt/disk/MyTemp: No such file or directory

root@TowerDemo:/boot/config# cat smb-extra.conf

[global]

  security = USER

  guest account = nobody

  public = yes

  guest ok = yes

  map to guest = bad user

 

 

 

[MyTemp]

  path = /mnt/disk/MyTemp

  read only = No

 

root@TowerDemo:/boot/config#

 

 

thanks,

~joy

Link to comment

Yes, I have the Pro version but I don't have any share setup. My user share is currently disabled. Looks like my drive is not mounted.

 

Ok, try this in the telnet session and reply with the output: 

/boot/config/snap.sh -listDeviceConfigurationInfo

cat /boot/config/snap/snap.list

 

Also, type this:  /boot/config/snap/snap.sh -m MyTemp

 

Then check if the disk is mounted at /mnt/disk/MyTemp

Link to comment

 

root@TowerDemo:/boot/config# /boot/config/snap/snap.sh -listDeviceConfigurationInfo

unRAID=Yes SNAP=No 3593 /dev/hda /dev/disk/by-id/ata-Maxtor_6L200P0_L41WVXYH

unRAID=No SNAP=Yes 3710 /dev/hdd /dev/disk/by-id/ata-Maxtor_6Y160P0_Y42K7MWE

unRAID=Yes SNAP=No 3654 /dev/hdb /dev/disk/by-id/ata-WDC_WD800JB-00CRA1_WD-WMA8E2950670

unRAID=No SNAP=No 3804 /dev/sda /dev/disk/by-id/usb-Sony_Storage_Media_1A08072104689-0:0

root@TowerDemo:/boot/config# cat /boot/config/snap/snap.list

 

Y42K7MWE=MyTemp

 

root@TowerDemo:/boot/config# /boot/config/snap/snap.sh -m MyTemp

Mounting filesystem for /dev/disk/by-id/ata-Maxtor_6Y160P0_Y42K7MWE-part1 not attempted: Filesystem (silicon_medley_raid_member) is not supported.

root@TowerDemo:/boot/config#

 

"Filesystem (silicon_medley_raid_member) is not supported."

 

 

I was using this as my cache drive before then I unassigned to try the SNAP. Do I need to format the drive before mounting it?

 

thanks,

~joy

 

 

 

 

 

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.