Take the 2-minute tour ×

We have several HP Thin-Clients of type t5545 in use. We redirect USB-Media to the terminalserver. Because the t5545 runs a debian customized by hp, we can treat it like a debian in some way.

First, I'll explain how usb-redirection is configured:

  • automatically mount it to /tmp/tmpfs/media
  • /tmp/tmpfs/media is redirected as disk "Z" via rdesktop-parameter -r disk:sharename=path
  • in case of removed usb-media udev will run a script to umount -l the device and delete the mountpoint

The environment:

  • Thin-Clients run linux: root@mac-addr:/tmp/tmpfs/media# uname -a
    Linux mac-addr 2.6.26-2-686 1 SMP Wed Nov 4 20:45:37 UTC 2009 i686 GNU/Linux
  • Terminalserver runs Windows Server 2008 R2

Problem: When users write to usb-media, it seams to be written instantly. But in fact the file needs a few seconds to be written even if it has only a few kb. Server 2008 R2 doesn't show any hint about that. If the user removes his usb-media directly after writing to the usb-media, the file won't be at his usb-media.

Question: Is there anything I can do to inform the user about the write-progress? If possible, that shouldn't be a third-party tool that has to be installed on the thinclient because there's very less space.

Edit: No ideas? The solution shouldn't be like the windows-7-known save removal of usb-media. It would be fine if there's even a notification if the write-progress is ongoing or ready.

No solution yet! There's still the chance to get the 150 reputation points!

I need one of these 2 points:
- a way to inform the user when the write-process is done, or...
- a script/little application with no dependencies (because the flash-disk is almost full) that allows save removal of usb-media

I would really like to give that bounty away. Hurry up ;)

share|improve this question
Wait, Rdesktop to 2008 R2? I have never made this to work! It always disconnects instantly... –  sinni800 May 16 '11 at 11:23
Yes it works... mostly... According to dpkg -l | grep rdesktop there's rdesktop 1.6.0-1.36 customized by hp installed. They had to apply a patch to resolve some usb-redirection errors like not beeing able to delete non-empty-directories and an additional udev-rule to unmount usb-media automatically when it's unplugged. But apart from that, it works. –  wullxz May 16 '11 at 12:37
Huh, last time I tried it it didn't work, I have to try again... –  sinni800 May 16 '11 at 13:49
add comment

4 Answers

up vote 1 down vote accepted

Mount your local stuff (/tmp/tmpfs/* in your case) with sync option.

share|improve this answer
meanwhile, we don't supervise the client anymore. Nevertheless, this hint would mostly prevent data from getting lost and I accept this answer for this reason. However, I'm not able to test this solution - I only read the manpage of mount to learn what the sync option does. –  wullxz Jul 23 '12 at 21:49
add comment

The problem is not with RDESKTOP nor with Windows. It's from the way how Linux (and other OS) works with Removable Media. They are supposed to be removed safely and then be unplugged in order to make sure freshly written data has been synced.

What you can do is to inform your system to make those "syncs" more often.

you can write a C daemon which would do it for you. Or you can dig into the kernel module settings and specify not to use write-cache.

share|improve this answer
I could've written a C daemon but I'm not a good programmer and even less a linux programmer. I understand your idea and thought of it, too, but it's not possible for me to implement it. However, you gave me no solution but good hints - I vote you up anyway. –  wullxz Jul 23 '12 at 21:54
add comment

You can use fuser to see which pid is using a mount point.

/media/sdc1 is working? fuser -vm /media/sdc1 will show user, pid, access and command. You will need some script to do the trick. Check if F access (open file for writing) is up.

E.g. Checking if someone is using sr0:

$ fuser -m /dev/sr0 -v

dvd 17298 F.... xfburn

share|improve this answer
add comment

This is a tricky one. If I got this right, you want a user to wait a few seconds before removing their USB drive, which appears as a folder inside their remote desktop session. My only idea to solve this would to be use this utility which will see the folder(mount point) has gotten new data and then can trigger a script to launch a dialog box (I'd use autohotkey) that would alert the user, "You have recently inserted a USB device, please wait 20 seconds after the last time you save data to your USB before removing it. Otherwise, your data may not save properly." Have it monitor Z:\ to see if a folder is created.

Or, have you tried freerdp? It might not contain the delay which you mention.

share|improve this answer
the problem is, that my client is a thin-client. There's not much space left on the flash-disk. I would like to have a solution that allows save removal of usb-media or that notfies me exactly after all write-tasks are ended. I don't know what files will be written to usb-media and how large they will be. That means: it could be, that 20 seconds aren't enough to wait... I want to be save with that. –  wullxz May 25 '11 at 16:16
but if people are in an RDP session and something pops up on their machine outside their RDP, will they see it? take a look at this utility: iwatch.sourceforge.net/index.html –  yeedl May 31 '11 at 0:01
okay... I have to look at this. Sadly I have many tasks today and can't test it within the next 24 hours. Can you tell me how much disk space this package needs? Are there any dependancies? If nothing works, I'll have to write a little script for the server and the thin-client to allow the user to unmount the usb-stick (that shouldn't be too difficult). –  wullxz May 31 '11 at 9:39
sadly iwatch has too much dependencies that aren't installed yet on the thinclient. That wouldn't fit on the flash-disk. Do you have other ideas? –  wullxz Jun 1 '11 at 10:03
add comment

Your Answer


