A "USB Drive" daemon for Sun Ray sessions - AKA "usbdrived" (V2)

Hopefully you are reading this because you either have a need to better present USB disks via the Sun Ray platform or because you are an "existing customer" of version 1, first blogged here.

After looooong in the making and with careful analysis of requirements and listening to useful feedback from the likes of Brad Lackey, I am pleased to announce that "version 2" of the good old "usbdrived" is finally ready  (well, not really v2,  it has had more iterations than that...)

Features that you will find in this version are:

  1. Multiple mount partitions & drives connected to the same Sun Ray

  2. Mount point "unwriteability" (Yeah!)

  3. Address Gnome/JDS and Windows sessions from the same script, automatically

  4. Polished Disk icons on Gnome/JDS (instead of links)

  5. No stale mount points presented to the end user

  6. Usage documentation provided as text files on the desktop/mountpoint (this can be switched off)

  7. Installer for system-wide or single user with no root permissions

  8. Single point of aggregation for all Windows mounts (Drive "USBDRVS")

Simply download it, and then execute it (chmod +x first) on every Sun Ray server of your FOG, like so:

./usbdrived install

Option 0 will give you generic install instructions... Enjoy!


I get a lot of comments telling me "it doesn't work, can you help me?" - as it turns out usbdrived is actually a pretty simple beast, and if you think it's not working, you may be looking in the wrong place. Start with some of these hints:

  • Can you see usbdrived running in your Solaris session? (ps -ef | grep usbdrived)

  • Can you see a file called "Attaching USB Drives to your Sun Ray README.txt" on your Solaris desktop?

  • Did you install it properly? If so, can you see and what permissions does this have:
    It should be executable by everybody, something like rwxr-xr-x

  • When you plug in a USB drive, does it mount in /tmp/SUNWut/mnt/<username> under Solaris?

  • Under Windows, can you see in  "My Computer" a Network drive (In "Others") called "USBDRVS" and is there a file within that explains usage?

  • Have you hit refresh in file manager when looking at your USBDRVS mount?

  • Most important and useful of all: Do any mounts show up if on a Solaris Sun Ray session you issue:
    /opt/SUNWut/bin/utdiskadm -l

  • With Sun VDI 2.0, make sure that you have properly positioned your arguments in the kiosk call, as "-service hostname" needs to be the last parameter:
    -t 1800 -- -m -b -r disk:USBDRVS=$HOME/USBDRVS -service localhost

  • With Sun VDI 3.0, this works for me:
    -- -m -b -r disk:USBDRVS=$HOME/USBDRVS
    where the actual vda kiosk parameters go to the left of "--"

  • With the Sun Ray Connector for VMware View, this works for me:
    -s viewmanager-server -http -- -m -b -r disk:USBDRVS=$HOME/USBDRVS

  • Unfortunately, NOT ALL USB drives work. Some drives, Solaris refuses to mount (PCFS issues) either because the device is simply not "liked", or because Solaris can't read the file system. Look at "dmesg" for errors.

  • Is your drive FAT16/32 or is it NTFS? The latter does not work, the formatting mut be FAT.

  • Many people have asked me why passing the parameter does not work
    as explained within the script... It appears that people look at the guts of the
    script to understand the instructions and bump into the line that reads
    and assume that that is the literal context. Noooooo! That "\\" is there
    so that when you read the instructions offered via the command line
    option of "usbdrived install" and press "0", the actual HOME directory
    of the user is not displayed...

NOTE OF SUPPORT: This tool is provided as is. It is not supported by Oracle. If you find any issues, please contact me and will try to help!


    Hey, nice work!! Thank you!

    Posted by David Neal on July 24, 2008 at 10:39 PM EST #

    easy to install and works like a charm. Thanks!


    Posted by patrick on July 25, 2008 at 04:23 PM EST #

    easy to install and works very good!


    Posted by patrick on July 25, 2008 at 04:32 PM EST #

    Hi Daniel,

    that´s a great script, but theres one little mistake.
    The parameter for the windows-connector must be
    -r disk:USBDRVS=\\$HOME/.USBDRVS
    Please take care of the first ":"


    Posted by Steffen on July 28, 2008 at 04:27 PM EST #

    Steffen -

    That little error slipped through the cracks a few times... :)

    I will soon post a new revision with some small changes including this one.



    Posted by danielc on July 28, 2008 at 06:16 PM EST #

    This is definitely an improvement but is there any way to include the drives in computer:/// (vfolders? http://docs.sun.com/app/docs/doc/806-6878/6jfpqt2td?a=view) like a 'real' USB drive, or in the favorite locations that show up on the left of many Gnome applications?

    Posted by thadk on July 31, 2008 at 12:51 PM EST #

    This worked great for me. I've now finished my SRSS 4.0 install with SRWC 2.0. This is replacing my previous SRSS 3.1 w/ SRWC 1.0 on another machine, including all of the ugly hacks I had to do to get a solution almost as useful as this one. Thanks for the very nice script.


    Posted by Seth G. on August 12, 2008 at 12:46 AM EST #

    This worked great for the Solaris Sessions but I could not get it to work with windows sessions.
    In the arguments section of the Kiosk mode in Sun Ray Administration console, I placed the following: -r disk:USBDRVS="$HOME/USBDRVS"
    I restarted the SR Server but when I plugged in the USB drive, I did not see a network drive named USBDRVS or anything like that. Am I missing anything? Is there anything else I should be doing?

    Posted by Deniz on August 20, 2008 at 04:38 PM EST #


    Posted by James Tan on August 28, 2008 at 09:31 PM EST #


    Can see the USBDRV mount point under 'My Computer' but can't see the contents of the usb drive it's just empty. Tried this on two sun ray servers and got the same result both times. Tried 3 different sticks. Works very well under JDS . Using SRSS 4.0, SRWC 2.0 using -r disk:USBDRVS=\\$HOME/.USBDRVS in the argument field of Kiosk Mode Setting in the Sun Ray gui . Target windows server is Windows 2003 R2. Any idea where Im going wrong ?

    Posted by James P on September 07, 2008 at 12:59 AM EST #


    The problem is the order in which you're supplying the parameters in the administration console:

    You need to change: -r disk:USBDRVS="$HOME/USBDRVS"

    and make it:


    Posted by Daniel Cifuentes on September 07, 2008 at 02:39 AM EST #


    Your problem stems from leaving the "\\" in the call to $HOME, and so, should read -r disk:USBDRVS=$HOME/.USBDRVS.

    The reason for the "\\" within the script is so that the instructions display properly when using the script itself to display the install instructions!!! It has happened to a few people, don't worry.

    Posted by Daniel Cifuentes on September 07, 2008 at 02:41 AM EST #

    Great script, thanks very very much for your work :)

    Posted by dave on October 03, 2008 at 06:52 AM EST #

    Hi Daniel,

    just trying my lock here, do you think you could work your script to mount only 'authorized' flash disks as posed in <http://www.mail-archive.com/sunray-users@filibeto.org/msg10700.html>?

    James Tan

    Posted by James Tan on October 05, 2008 at 02:23 PM EST #

    Great work on this Daniel, its intuitive and extremely easy to install compared to previous scripts provided on ThinkThin.

    Thanks and keep up the great work on DC\*3!



    Posted by bashprompt on October 07, 2008 at 09:21 AM EST #

    Hi Daniel,

    Fantastic script. I'm currently implementing vmware view and using the sun ray as my front end... Is there any chance to post a step by step scenario on how to install this script to a sun ray server. I will be using vmware view manager session "kiosk mode". Congratulations for the great work!!!! Thanks in advance.

    Regards, Ed

    Posted by Ed on April 15, 2009 at 10:06 AM EST #


    The procedure for usbdrived to work under View is not different - just make sure you modify the kiosk preferences in the Sun Ray Web GUI for VDM so that they read something like:
    -s viewmanager-server.ssc -http -- -m -b -r disk:USBDRVS=$HOME/USBDRVS

    That's it!

    Posted by Daniel Cifuentes on April 20, 2009 at 04:17 AM EST #


    Thanks a million for another great script!

    - John Moyles

    Posted by John Moyles on May 19, 2009 at 03:40 AM EST #


    what am I doing wrong?
    I installed the script with ./usbdrived install with argument: 1

    then I added in the Sunray WebUI under Kiosk Mode:
    -r disk:USBDRVS="$HOME/USBDRVS" -http -s IP-FOR-ESX (Its required for view Connector)

    then I have cold-restarted the sunrayserver: utrestart -c

    if I connect to my Windows XP in ESX I cant see a Drive called: USBDRVS


    Posted by John on June 18, 2009 at 12:16 PM EST #


    The actual and correct syntax when using the Sun Ray connector for View would be:


    We obviously have some discrepancies... Try that?

    Posted by Daniel Cifuentes on June 18, 2009 at 01:46 PM EST #

    it works perfectly,
    thanks for fast response.

    Posted by John on June 18, 2009 at 03:00 PM EST #

    I also have problems with making this work in Vmware View. I put the parameters -s IP-FOR-VIEWMANAGER-SERVER -http -- -r disk:USBDRVS=$HOME/USBDRVS into the SunRay web UI and did a cold restart. I can't get it to work. I'm using Solaris 10 x86. I seem some examples with $HOME/.USBDRVS and others with $HOME/USBDRVS (no "dot"). Any other ideas? Thank you.

    Posted by Bob on June 27, 2009 at 12:01 AM EST #

    I used that same syntax for vmware view but no luck. Any other ideas? Thanks for the contribution.

    Posted by Bob on June 27, 2009 at 12:52 AM EST #

    I am using solria 10 5/09 and the utaction is running with the usbdrived script properly. The Solaris JDS is not mounting the usb drives and creating the mount points and icons as expected. The sun rays are split in two groups (one with JDS and one with the Windows connector). Any help is appreciated.

    Posted by fred on July 08, 2009 at 10:23 PM EST #

    I've received a few queries as of late, does this work like this, does this work with that, etc., so I've updated the entry with a "Troubleshooting" section. I hope it helps most people out!

    Posted by Daniel Cifuentes on July 09, 2009 at 05:34 AM EST #

    Hi Daniel,
    thank you for this great script. I still have one question: Is there a need to unmout the usb device before unplugging it? Or is unmounting somehow implemented in the script?

    Posted by Christian Kluge on July 20, 2009 at 10:33 AM EST #

    Unmounting/ejecting strictly speaking is not a requirement - you should however ensure that files are not being transferred or copied on the device at the time of manually extracting the device. It's always useful to look at the light on the drive itself to determine if there is still activity going on, besides the feedback you get from the O/S.

    I dind't implement this because:
    1) the above is quite safe
    2) Windows cannot be implemented
    3) I wasn't that interested in spending more time under Unix/Linux to figure out how to enable a menu entry for "eject"...

    Keep a lookout for Sun Ray SW 5 EA2...

    Posted by Daniel Cifuentes on July 21, 2009 at 04:11 AM EST #

    How do you uninstall this?

    Posted by Tom on September 25, 2009 at 05:14 PM EST #

    Ah.. good question! Never thought about that in the code. The below code will work on any system that has it installed system-wide.

    if [ -f /usr/dt/config/Xsession.d/1350.usbdrived ]
    rm /usr/dt/config/Xsession.d/1350.usbdrived
    rm /etc/X11/xinit/xinitrc.d/1350.usbdrived.sh

    rm /opt/SunRayAddons/bin/usbdrived

    If the install was done to /etc/profile or to the user's .profile, then you need to edit those files accordingly, but you get the idea.

    Posted by Daniel Cifuentes on September 28, 2009 at 09:04 AM EST #

    Hi, thanks for putting this together, works great.

    I have a question though; In our environment we really just use SRWC to forward all DTUs to a few different Windows Terminal Servers. All DTUs only have one USB port available for flash drives. What do you think would be the best way to modify the script to mount directly to USBDRVS and not a subfolder? The "nonname" volume label can be somewhat confusing to our users.

    Thanks again!

    Posted by Stefan on October 20, 2009 at 04:46 PM EST #


    usbdrived doesn't actually "mount" anything - it simply uses what the Sun Ray platform mounts, but it presents it in a more dynamic and palatable way than the "default". Unfortunately, the nature of RDP doesn't allow what you're asking for - since I have to know \*before\* establishing the session what it is that I want to mount - and this would mean plugging in the USB drive before actually connecting to your desktop... even worse than what you are getting now. The script does allow for the name of the partition to be used in the mapping so that you don't see "noname" though, but that depends on whether the partition was named initially upon creation, and even then, I have seen partitions whose names don't get carried across to the mount point on Solaris (hence "noname").

    Perhaps you can modify the script so that when it detects "noname" it replaces this string by something like "USB Drive #"? Let me know if you do!


    Posted by Daniel Cifuentes on October 22, 2009 at 03:33 AM EST #

    works perfect, did adapt it to allow only exactly one type of device, which is mandatory encrypted, namely lok-it USB devices.

    Posted by Thomas Fürle on April 14, 2012 at 03:04 AM EST #

    Post a Comment:
    • HTML Syntax: NOT allowed

    A thin thinker down under


    « December 2016