Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-09-2009, 06:39 AM
|
#1
|
Member
Registered: Dec 2005
Location: UK
Distribution: Slackware 12.1
Posts: 249
Rep:
|
Safely Remove USB External Hard Drive
I have just started to use a Western digital USB external hard drive on my Slackware 12.1 box.
It mounts as expected when powered up and plugged in.
My main concern is a 'safe-removal' of the drive.
If I right-click on the drive in KDE the drive is definitely unmounted as confirmed by disappearance from 'etc/mtab', but the drive does not spin-down. Same result if I issue 'umount /dev/sda1' from terminal window.
I feel uneasy about pulling out and disconnecting the drive whist it still spins. I can of course spin it down by issuing 'hdparm -y /dev/sda1'
what is the best / correct way to unmount and remove these drives?.
Thanks,
Bill.
|
|
|
02-09-2009, 06:44 AM
|
#2
|
Member
Registered: Dec 2006
Location: Glasgow, UK
Distribution: Slackware current
Posts: 425
Rep:
|
Bill
I've got an external WD USB drive and it spins down if you remove the usb cable,
or if you just wait for a few minutes after it's been unmounted and idle.
I usually do the former and it hasn't caused any problems to date.
|
|
|
02-09-2009, 07:28 AM
|
#3
|
Member
Registered: Dec 2005
Location: UK
Distribution: Slackware 12.1
Posts: 249
Original Poster
Rep:
|
Quote:
Originally Posted by mcnalu
Bill
I've got an external WD USB drive and it spins down if you remove the usb cable,
or if you just wait for a few minutes after it's been unmounted and idle.
I usually do the former and it hasn't caused any problems to date.
|
Yes, I too noticed that it powered-down when removing the USB cable, but it certainly wasn't such a 'quite' power-down as when I issued the 'hdparm
-y /dev/xxx' command to put it in 'Standby'. It is causing an 'emergency' head-park?.
I just wonder if something extra is needed to get the same kind of unmounting that one gets with Windows XP 'safely remove hardware'
Bill.
|
|
|
02-09-2009, 07:54 AM
|
#4
|
LQ Newbie
Registered: Sep 2008
Location: England
Distribution: Slackware
Posts: 15
Rep:
|
I have a similar issue, which is probably related. When using a USB stick on Windows and doing "safely remove the device" from the windows menu, the LED on the USB stick switches off - so I know it's definitely dismounted. However, in Linux, when I umount a USB stick the LED stays on. Now I'm sure it's safely dismounting, but I'm curious why it doesn't get switched off.
|
|
|
02-09-2009, 08:26 AM
|
#5
|
Member
Registered: Dec 2005
Location: UK
Distribution: Slackware 12.1
Posts: 249
Original Poster
Rep:
|
Quote:
Originally Posted by mrgreedy
I have a similar issue, which is probably related. When using a USB stick on Windows and doing "safely remove the device" from the windows menu, the LED on the USB stick switches off - so I know it's definitely dismounted. However, in Linux, when I unmount a USB stick the LED stays on. Now I'm sure it's safely dismounting, but I'm curious why it doesn't get switched off.
|
Yes, I see this same thing with my USB Flash Drive.
I've got into the habit now of running 'mount' after 'safely removing' on Linux just to make sure it really is not still mounted.
I can obviously continue to issue the 'hdparm -y' command to manually spin-down my USB HDD drive, but I just wondered if there is a more elegant way of doing it in Slackware.
Bill.
|
|
|
02-09-2009, 08:27 AM
|
#6
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
You might try using the eject command instead of umount. But, many drives will not 'disconnect' (I mean where the light goes out and drive becomes inactive) in an orderly fashion the way they do under windows.
|
|
|
02-09-2009, 12:39 PM
|
#7
|
LQ Newbie
Registered: Sep 2008
Location: England
Distribution: Slackware
Posts: 15
Rep:
|
Quote:
Originally Posted by gnashley
You might try using the eject command instead of umount. But, many drives will not 'disconnect' (I mean where the light goes out and drive becomes inactive) in an orderly fashion the way they do under windows.
|
Great, the eject command worked! The LED switched off properly. I just need to change my alias to this instead. Thanks.
This should work for your flash drives as well, Toods.
Last edited by mrgreedy; 02-09-2009 at 12:41 PM.
|
|
|
02-09-2009, 02:44 PM
|
#8
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
"This should work for your flash drives as well" -what I meant is that not all drives will do this -some wil, but others won't(which do disconnect under windows). The USB kernel drivers are still in flux -maybe someday they'll get it right and keep it that way.
|
|
|
02-09-2009, 03:43 PM
|
#9
|
Member
Registered: Dec 2006
Location: Glasgow, UK
Distribution: Slackware current
Posts: 425
Rep:
|
Hmm, perhaps my method of removing my all-important backup disk wasn't as safe as I assumed
Unfortunately eject doesn't seem to do anything other than unmount my WD external disk. From now on I'll just wait until it spins down or use hdparm.
EDIT: Actually hdparm -y /dev/sd.. resulted in the same clunk, whizz as pulling the usb cable.
Intererestingly, windows XP refused to safely "stop" the same disk connected to the same laptop - said some process was busy using it.
Last edited by mcnalu; 02-09-2009 at 03:48 PM.
|
|
|
02-09-2009, 05:25 PM
|
#10
|
Member
Registered: Dec 2005
Location: UK
Distribution: Slackware 12.1
Posts: 249
Original Poster
Rep:
|
Several useful suggestions made in this thread. Many thanks.
An interesting observation I made:
I can 'right-click' on my mounted corsair USB pen drive and it is unmounted and the entry disappears from the KDE 'storage Media directory'. When I try the same with the WD external USB drive, it is certainly unmounted (disappears from mtab) but the icon remains in the KDE 'storage Media directory'. Moreover, if I click the mouse on the icon it re-mounts.
Anyone know why these two USB mass-storage devices should be treated differently in this way?,
On the subject of quietly disconnecting my WD USB drive, I found the most 'comforting' and quiet way is to first 'unmount' in KDE then run the following bash script:
Code:
#!/bin/bash
echo "Sync and Flush cache"
hdparm -f /dev/sda
sleep 2
echo ""
echo "Now Drive to Stand-by"
hdparm -y /dev/sda
Bill.
|
|
|
02-09-2009, 05:37 PM
|
#11
|
Member
Registered: Apr 2007
Posts: 41
Rep:
|
Is it not true that when you "safely remove hardware" in windos you cannot get the drive back until you unplug and replug??
If I am right (and I might be wrong since i have not used such operating system for a long time), then in the case of the umount command, it does not power down because it expects that you will mount it back again (either through gui double click or mount command) without you having to take the usb out and in??
|
|
|
02-10-2009, 01:53 AM
|
#12
|
Member
Registered: Dec 2005
Posts: 140
Rep:
|
Code:
#!/bin/bash
echo "Sync and Flush cache"
hdparm -f /dev/sda
sleep 2
echo ""
echo "Now Drive to Stand-by"
hdparm -y /dev/sda
Thanks Toods for this good script.
|
|
|
02-10-2009, 02:57 AM
|
#13
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
If you want to be extra safe, you could run 'sync' before unmounting or ejecting. Both umount and eject should do this, but it doesn't hurt anything to do it manually. If you have ever noticed that it takes a while for umount to finish, it is because it is running sync before unmounting. And, eject runs the umount command before doing an 'eject'. If you have run sync and allowed it to finish flushing the write buffer, you should be able to simply unplug the device without harming it -but I wouldn't do that on purpose. The device would still show to be mounted even when physically removed.
The difference in the way different drives react to the commands has to do with the nature of the device. Real hard drives may not register as removable devices, whereas FLASh devices usually will. Also, if you are using a card-reader, insert and remove eventy are not sent to the driver and the same may happen if using an extra hub between the device and the computers' USB port.
|
|
|
All times are GMT -5. The time now is 04:39 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|