Hi, I posted on this a while ago, and it seemed to spark some serious unix fighting talk: A: you should sync 3 times B: no you shouldn't. Linux only does it once A: okay how about sync'ing 2 times? B: if you read subsection 8(i) of part 4b of the man page it clearly states.... and so on..... All of which doesn't help me one little bit. The USB harddisk is mouted automatically by HAL. This bypasses /etc/fstab, and thus (from a non-root user's perspective) is not actually mounted. When they issue a umount command, they get the error message "/media/foo is not listed in the mnttab, and anyway you're not root, so piss off" So what is the solution? Sync then unplug the disk? Come on, I'm sure loads of people must use these disks - what's the recommended way to disconnect them?????? Cheers, Jon.
On Wed, 2005-10-26 at 11:11 +0100, Jonathan Brooks wrote:
.... The USB harddisk is mouted automatically by HAL. This bypasses /etc/fstab, and thus (from a non-root user's perspective) is not actually mounted.
When they issue a umount command, they get the error message "/media/foo is not listed in the mnttab, and anyway you're not root, so piss off"
So what is the solution? Sync then unplug the disk?
My disk is a camera (well, the disk is an SD card in a camera) and this doesn't work because I want to turn the camera off before unplugging it. And it won't turn off until it's unmounted ...
Come on, I'm sure loads of people must use these disks - what's the recommended way to disconnect them??????
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion. Cheers, Dave
On Wednesday 26 October 2005 12:01, Dave Howorth wrote:
On Wed, 2005-10-26 at 11:11 +0100, Jonathan Brooks wrote:
.... The USB harddisk is mouted automatically by HAL. This bypasses /etc/fstab, and thus (from a non-root user's perspective) is not actually mounted.
When they issue a umount command, they get the error message "/media/foo is not listed in the mnttab, and anyway you're not root, so piss off"
So what is the solution? Sync then unplug the disk?
My disk is a camera (well, the disk is an SD card in a camera) and this doesn't work because I want to turn the camera off before unplugging it. And it won't turn off until it's unmounted ...
Come on, I'm sure loads of people must use these disks - what's the recommended way to disconnect them??????
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion.
Cheers, Dave I dont know what version of SUSE you have but 10 has a service menu (right click) "safely remove"
On Wed, 2005-10-26 at 12:22 +0100, Dave Chapman wrote:
On Wednesday 26 October 2005 12:01, Dave Howorth wrote:
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion.
I dont know what version of SUSE you have but 10 has a service menu (right click) "safely remove"
I use 9.3 with gnome. Enlightenment has 'unmount device' (IIRC) but it doesn't work - it gives the 'you aren't root' message. If yours works, could you post the actual command that is run by 'safely remove'? Or tell me which configuration file it's in, or at least which software component is providing that menu on your system. Thanks, Dave
On Wednesday 26 October 2005 13:20, Dave Howorth wrote:
On Wed, 2005-10-26 at 12:22 +0100, Dave Chapman wrote:
On Wednesday 26 October 2005 12:01, Dave Howorth wrote:
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion.
I dont know what version of SUSE you have but 10 has a service menu (right click) "safely remove"
I use 9.3 with gnome. Enlightenment has 'unmount device' (IIRC) but it doesn't work - it gives the 'you aren't root' message.
If yours works, could you post the actual command that is run by 'safely remove'? Or tell me which configuration file it's in, or at least which software component is providing that menu on your system.
Thanks, Dave It's a Kde service menu /opt/kde3/share/apps/konqueror/servicemenus
Dave Chapman wrote:
On Wednesday 26 October 2005 13:20, Dave Howorth wrote:
On Wed, 2005-10-26 at 12:22 +0100, Dave Chapman wrote:
On Wednesday 26 October 2005 12:01, Dave Howorth wrote:
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion.
I dont know what version of SUSE you have but 10 has a service menu (right click) "safely remove"
You don't need to do all of this, just make sure any disc activity has finished and unplug the device. As Dorothy once said to Toto:
"I don't think we are using Windows anymore...." Ok, she didn't say that, it just sounded cool. James W
On Thu, 2005-10-27 at 17:41 -0400, James Wright wrote:
On Wednesday 26 October 2005 12:01, Dave Howorth wrote:
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion.
You don't need to do all of this, just make sure any disc activity has finished and unplug the device.
I think you missed something I wrote earlier:
My disk is a camera (well, the disk is an SD card in a camera) and this doesn't work because I want to turn the camera off before unplugging it. And it won't turn off until it's unmounted ...
Cheers, Dave
On 28/10/05, Dave Howorth
On Thu, 2005-10-27 at 17:41 -0400, James Wright wrote:
On Wednesday 26 October 2005 12:01, Dave Howorth wrote:
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion.
You don't need to do all of this, just make sure any disc activity has finished and unplug the device.
I think you missed something I wrote earlier:
My disk is a camera (well, the disk is an SD card in a camera) and this doesn't work because I want to turn the camera off before unplugging it. And it won't turn off until it's unmounted ...
Cheers, Dave
Perhaps I'm missing something here but what's wrong with simply unplugging the camera? Or, get hold of one the now very cheap USB card readers. That's why I 'have' to use as my camera is not supported under any distro. It does have the added bonus of not wasting the cameras battery. -- ============================================== I am only human, please forgive me if I make a mistake it is not deliberate. ============================================== Take care. Kevan Farmer 34 Hill Street Cheslyn Hay Staffordshire WS6 7HR
On Fri, 2005-10-28 at 11:37 +0100, Kevanf1 wrote:
On 28/10/05, Dave Howorth
wrote: On Thu, 2005-10-27 at 17:41 -0400, James Wright wrote:
On Wednesday 26 October 2005 12:01, Dave Howorth wrote: >... So what I do is su to root and eject it. I've been thinking about >writing a suid shell script to do that, unless somebody else comes with >a better suggestion.
You don't need to do all of this, just make sure any disc activity has finished and unplug the device.
I think you missed something I wrote earlier:
My disk is a camera (well, the disk is an SD card in a camera) and this doesn't work because I want to turn the camera off before unplugging it. And it won't turn off until it's unmounted ...
Perhaps I'm missing something here but what's wrong with simply unplugging the camera?
Because the manufacturer's instructions say to turn off the camera before plugging/unplugging and I don't want to void my warranty.
Or, get hold of one the now very cheap USB card readers. That's why I 'have' to use as my camera is not supported under any distro. It does have the added bonus of not wasting the cameras battery.
Because my camera is supported :) I checked before I bought. Why should I have to fiddle around taking the card out? Cheers, Dave
On 28/10/05, Dave Howorth
Perhaps I'm missing something here but what's wrong with simply unplugging the camera?
Because the manufacturer's instructions say to turn off the camera before plugging/unplugging and I don't want to void my warranty.
Ah, I understand. Very good point.
Or, get hold of one the now very cheap USB card readers. That's why I 'have' to use as my camera is not supported under any distro. It does have the added bonus of not wasting the cameras battery.
Because my camera is supported :) I checked before I bought. Why should I have to fiddle around taking the card out?
Cheers, Dave
Good point number two :-) Never mind, they were just suggestions. -- ============================================== I am only human, please forgive me if I make a mistake it is not deliberate. ============================================== Take care. Kevan Farmer 34 Hill Street Cheslyn Hay Staffordshire WS6 7HR
Dave, On Friday 28 October 2005 03:45, Dave Howorth wrote:
On Fri, 2005-10-28 at 11:37 +0100, Kevanf1 wrote:
...
Perhaps I'm missing something here but what's wrong with simply unplugging the camera?
Because the manufacturer's instructions say to turn off the camera before plugging/unplugging and I don't want to void my warranty.
Sorry, but USB is _by definition_ hot pluggable. This is probably a nonsense requirement promulgated by an ignorant party or a CYA attitude within the manufacturer's organization. It may also have to do with a misunderstanding of the limits of using removable USB storage media under Windows. Don't stay backed into a corner. Use the SuSE default synchronous writing for USB mass (or flash) storage devices and just disconnect when the commands that write to the device complete. If you're reading it only, disconnect whenever you like. Similarly, there's no reason you can't turn it off first if that makes you feel better. Again, use synchronous writing. When the device goes away, Linux will clean up its internal structures.
...
Cheers, Dave
Randall Schulz
On 28/10/05, Randall R Schulz
Dave,
On Friday 28 October 2005 03:45, Dave Howorth wrote:
On Fri, 2005-10-28 at 11:37 +0100, Kevanf1 wrote:
...
Perhaps I'm missing something here but what's wrong with simply unplugging the camera?
Because the manufacturer's instructions say to turn off the camera before plugging/unplugging and I don't want to void my warranty.
Sorry, but USB is _by definition_ hot pluggable. This is probably a nonsense requirement promulgated by an ignorant party or a CYA attitude within the manufacturer's organization. It may also have to do with a misunderstanding of the limits of using removable USB storage media under Windows.
Don't stay backed into a corner. Use the SuSE default synchronous writing for USB mass (or flash) storage devices and just disconnect when the commands that write to the device complete. If you're reading it only, disconnect whenever you like.
Similarly, there's no reason you can't turn it off first if that makes you feel better. Again, use synchronous writing. When the device goes away, Linux will clean up its internal structures.
...
Cheers, Dave
Randall Schulz
Well, again, I may be missing something here, but.. surely the only reason not to simply unplug a USB device when you want to is if any data was being cached instead of written direct to the disk (or storage device). Does this happen in this case? I know that you couldn't simply unplug old style serial or parallel port drives etc because of the risk of burning the port out, this shouldn't happen with USB. Should it? -- ============================================== I am only human, please forgive me if I make a mistake it is not deliberate. ============================================== Take care. Kevan Farmer 34 Hill Street Cheslyn Hay Staffordshire WS6 7HR
Kevan, On Friday 28 October 2005 14:01, Kevanf1 wrote:
...
Well, again, I may be missing something here, but.. surely the only reason not to simply unplug a USB device when you want to is if any data was being cached instead of written direct to the disk (or storage device). Does this happen in this case? I know that you couldn't simply unplug old style serial or parallel port drives etc because of the risk of burning the port out, this shouldn't happen with USB. Should it?
Not keeping such unwritten cached data is what the "sync" option is all about. By using it for all writeable, removable mass storage devices, the opportunity for data loss exists only if one disconnects _while data is being transferred_. Because synchronous transfers prevent the user-level calls from returning before the data has reached its final desination, you usually know positively when it's safe to disconnect the device. And yes, as I said before, USB is hot-pluggable. If the device's design and manufacture is correct, the hardware will never be damaged by connecting and disconnecting the devices.
Kevan Farmer
Randall Schulz
On Friday 28 October 2005 17:01, Kevanf1 wrote:
I know that you couldn't simply unplug old style serial or parallel port drives etc because of the risk of burning the port out, this shouldn't happen with USB. Should it?
No, the automounting is in sync mode so you should be able to unplug any time there is no activity. I have never heard of a usb port "burning out." Bryan ******************************************************** Powered by SuSE Linux 9.2 Professional KDE 3.3.0 KMail 1.7.1 This is a Microsoft-free computer Bryan S. Tyson bryantyson@earthlink.net ********************************************************
On 29/10/05, Bryan Tyson
On Friday 28 October 2005 17:01, Kevanf1 wrote:
I know that you couldn't simply unplug old style serial or parallel port drives etc because of the risk of burning the port out, this shouldn't happen with USB. Should it?
No, the automounting is in sync mode so you should be able to unplug any time there is no activity. I have never heard of a usb port "burning out."
Bryan
Ok, I'm with you guys so far :-) Now, my next question is how do you know when data has finished its transfer to the USB device? I know that a lot of USB devices have a light that wither blinks on and off or stays on during data transfer. But there must be a another way of registering the transfer - it usually opens a window if you are in GUI mode but this is not the case in command prompt mode. What I'm getting at is the same as with a car. You should never rely on the oil warning light to come on and tell you that you are low on oil because the light/bulb may have blown or be otherwise defective. The same goes for this tell tale light on the USB device. Or am I now worrying for no reason? -- ============================================== I am only human, please forgive me if I make a mistake it is not deliberate. ============================================== Take care. Kevan Farmer 34 Hill Street Cheslyn Hay Staffordshire WS6 7HR
Kevan, On Saturday 29 October 2005 02:08, Kevanf1 wrote:
On 29/10/05, Bryan Tyson
wrote: On Friday 28 October 2005 17:01, Kevanf1 wrote:
I know that you couldn't simply unplug old style serial or parallel port drives etc because of the risk of burning the port out, this shouldn't happen with USB. Should it?
No, the automounting is in sync mode so you should be able to unplug any time there is no activity. I have never heard of a usb port "burning out."
Bryan
Ok, I'm with you guys so far :-) Now, my next question is how do you know when data has finished its transfer to the USB device? I know that a lot of USB devices have a light that wither blinks on and off or stays on during data transfer. But there must be a another way of registering the transfer - it usually opens a window if you are in GUI mode but this is not the case in command prompt mode. What I'm getting at is the same as with a car. You should never rely on the oil warning light to come on and tell you that you are low on oil because the light/bulb may have blown or be otherwise defective. The same goes for this tell tale light on the USB device. Or am I now worrying for no reason?
For god's sake, drop the automotive analogies, OK? Once again, ... There are two parts to synchronous file system writing. One is that the kernel does not hold on to dirty buffers--it always flushes them to the device immediately upon receipt of new data from the user-level application. The other is that it does not return control from the write system call that sent data to the device until the write is complete. If you're using simple GUI commands that perform some operation and return (as opposed to interactive commands which _might_ be multi-threaded, though many are not), then by the time you see the prompt after issuing the command that sends data to the USB-attached device, all the I/O is complete and the device may be disconnected. And LEDs have a very, very, very long lifetime. You'll have long abandoned your USB device as obsolete for one reason or another (or because it has failed, stopped on or dropped in the toilet) before the indicator lights stop working.
.. Kevan Farmer
Randall Schulz
Hi, On Saturday 29 October 2005 07:23, Randall R Schulz wrote:
Kevan,
...
Once again, ...
There are two parts to synchronous file system writing. One is that the kernel does not hold on to dirty buffers--it always flushes them to the device immediately upon receipt of new data from the user-level application.
The other is that it does not return control from the write system call that sent data to the device until the write is complete. If you're using simple GUI commands that perform some operation and
I meant to write "CLI" (command-line interface) _not_ "GUI" here.
return (as opposed to interactive commands which _might_ be multi-threaded, though many are not), then by the time you see the prompt after issuing the command that sends data to the USB-attached device, all the I/O is complete and the device may be disconnected.
...
Randall Schulz
On Friday 28 October 2005 05:15, Dave Howorth wrote:
I think you missed something I wrote earlier:
My disk is a camera (well, the disk is an SD card in a camera) and this doesn't work because I want to turn the camera off before unplugging it. And it won't turn off until it's unmounted ...
Two possible answers: 1. Unplug it first, then turn it off. 2. For $15-25 get a USB SD card reader and plug it into your computer without the camera. Bryan ******************************************************** Powered by SuSE Linux 9.2 Professional KDE 3.3.0 KMail 1.7.1 This is a Microsoft-free computer Bryan S. Tyson bryantyson@earthlink.net ********************************************************
On 28/10/05, Bryan Tyson
On Friday 28 October 2005 05:15, Dave Howorth wrote:
I think you missed something I wrote earlier:
My disk is a camera (well, the disk is an SD card in a camera) and this doesn't work because I want to turn the camera off before unplugging it. And it won't turn off until it's unmounted ...
Two possible answers:
1. Unplug it first, then turn it off.
2. For $15-25 get a USB SD card reader and plug it into your computer without the camera.
Bryan
Sorry Bryan, I've already put that suggestion (well both actually) and they are not acceptable. Check the later postings and you'll see why and understand why as I did :-) -- ============================================== I am only human, please forgive me if I make a mistake it is not deliberate. ============================================== Take care. Kevan Farmer 34 Hill Street Cheslyn Hay Staffordshire WS6 7HR
Doesn't that sort of defeat the object of being able to hotplug USB devices? Plus, I could use sudo to get round the problem, but think there must be a better way??? Cheers, Jon. Dave Howorth wrote:
On Wed, 2005-10-26 at 11:11 +0100, Jonathan Brooks wrote:
.... The USB harddisk is mouted automatically by HAL. This bypasses /etc/fstab, and thus (from a non-root user's perspective) is not actually mounted.
When they issue a umount command, they get the error message "/media/foo is not listed in the mnttab, and anyway you're not root, so piss off"
So what is the solution? Sync then unplug the disk?
My disk is a camera (well, the disk is an SD card in a camera) and this doesn't work because I want to turn the camera off before unplugging it. And it won't turn off until it's unmounted ...
Come on, I'm sure loads of people must use these disks - what's the recommended way to disconnect them??????
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion.
Cheers, Dave
On Wed, 2005-10-26 at 12:49 +0100, Jonathan Brooks wrote:
Doesn't that sort of defeat the object of being able to hotplug USB devices? Plus, I could use sudo to get round the problem, but think there must be a better way???
Well, yes, su root defeats the object but it works. That's why I plan to write a setuid script to avoid the problem. Unless we find an existing solution.
... So what I do is su to root and eject it. I've been thinking about writing a suid shell script to do that, unless somebody else comes with a better suggestion.
Cheers, Dave
On Wednesday 26 October 2005 06:11, Jonathan Brooks wrote:
Come on, I'm sure loads of people must use these disks - what's the recommended way to disconnect them??????
Simply unplug. Bryan ******************************************************** Powered by SuSE Linux 9.2 Professional KDE 3.3.0 KMail 1.7.1 This is a Microsoft-free computer Bryan S. Tyson bryantyson@earthlink.net ********************************************************
participants (7)
-
Bryan Tyson
-
Dave Chapman
-
Dave Howorth
-
James Wright
-
Jonathan Brooks
-
Kevanf1
-
Randall R Schulz