LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-26-2008, 07:52 AM   #1
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Rep: Reputation: 15
[Solved]Safe removal of external USB HDD


How do I safely remove my external USB HDD in linux?

Okay so perhaps I wasn't being clear enough with that question. I am mostly using Ubuntu 7.10 and I recently purchased a WD Passport external USB HDD. Now with a little bit of disk use I can't help myself not to notice that the removal of the HDD in linux differs from the procedure WinXP. What bothers me here is not the fact that it does differ, but rather how it differs. In Windows XP I normally choose to safely remove the device in the tray icon and that's it. The device powers down and I remove it - I can tell this because I feel it stops vibrating when I hold it in my hand.

Linux tells a different story. Whenever I plug it in it will power up normally and linux will auto-mount the drive. Everything okay and nice. However I'm not so sure about drive removal. When I tell linux to unmount the volume (the disk has a single NTFS partition) it will only remove the mount point, but will not power down the device - the disk is still spinning. If I pull the plug at this point I can hear the hard shutdown of the HDD. I read somewhere that this kind of removal is rough on the device and shortens its lifetime. I've been a bit paranoid about this method of removal since I'd like to handle my components with care... Until now I had to leave the disk alone for a while until it self-powered down due to idle time, but I'm looking for a quicker way to do this.

Is there a way to power off the disk motor in linux (perhaps a console command) so it can be safely removed?

~Ol

Last edited by <Ol>Origy; 01-26-2008 at 01:54 PM.
 
Old 01-26-2008, 08:39 AM   #2
budword
Member
 
Registered: Apr 2003
Location: Wisconsin
Distribution: Switched to regualr Ubuntu, because I don't like KDE4, at all. Looks like vista on crack.....
Posts: 675

Rep: Reputation: 31
What desktop are you using ? In KDE you can right click the desktop icon for the drive, and chose "Safely Remove" from the drop down menu.

David
 
Old 01-26-2008, 09:10 AM   #3
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Original Poster
Rep: Reputation: 15
I'm using Gnome :s
 
Old 01-26-2008, 09:41 AM   #4
budword
Member
 
Registered: Apr 2003
Location: Wisconsin
Distribution: Switched to regualr Ubuntu, because I don't like KDE4, at all. Looks like vista on crack.....
Posts: 675

Rep: Reputation: 31
I don't use gnome, but it looks like it's the same sort of deal....

http://www.linuxquestions.org/questi...-drive-186194/

You could always open /media or /mnt or wherever you have it mounted in gnomes file browser (nautilus ?), right click it there, and select "Safely Remove".

Hope that helps....

David
 
Old 01-26-2008, 11:27 AM   #5
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Original Poster
Rep: Reputation: 15
Yeah well I kind of can't find the "safely remove" option

http://img405.imageshack.us/img405/6...memenu1xf4.png
http://img141.imageshack.us/img141/6...memenu2af6.png

If I use that unmount option, the disk will keep spinning.
 
Old 01-26-2008, 01:14 PM   #6
budword
Member
 
Registered: Apr 2003
Location: Wisconsin
Distribution: Switched to regualr Ubuntu, because I don't like KDE4, at all. Looks like vista on crack.....
Posts: 675

Rep: Reputation: 31
Have you thought about trying KDE ?

David

P.S.

 
Old 01-26-2008, 01:31 PM   #7
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Original Poster
Rep: Reputation: 15
Well I was hoping for an universal solution (e.g. console command) that works in many linux distros, not just the one I'm using on my laptop (Ubuntu 7.10). I'm not sure if the fact that I cannot safely remove some hardware should be considered the sole reason to change my desktop. What about my other PC's that have XFCE/Fluxbox/(insert your window manager here) or don't have gdm at all?

I'll do some more digging and see if I can find something.

EDIT: Ahaha. I found the link back to this very thread on Google. It appeared second in line.
EDIT2: https://bugs.launchpad.net/ubuntu/+bug/117713

Last edited by <Ol>Origy; 01-26-2008 at 01:41 PM.
 
Old 01-26-2008, 01:46 PM   #8
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Original Poster
Rep: Reputation: 15
Okay apparently this seems to be ubuntu-related bug according to the link above. I must admit that I did not yet get a chance to test the HDD on other linux distros as the drive is relatively new. I'll experiment a bit with my findings and report back later.

EDIT: Works Here's the code:
Code:
#!/bin/sh
WD=/dev/sdb1
sudo umount $WD
if [ $? -eq 0 ]
then
 echo Stopping heads
        #Stop properly the heads and cylinders
 sdparm --command=stop $WD
else
 echo Unmount Failed !
fi
~Ol

Last edited by <Ol>Origy; 01-26-2008 at 01:53 PM.
 
Old 01-26-2008, 02:10 PM   #9
budword
Member
 
Registered: Apr 2003
Location: Wisconsin
Distribution: Switched to regualr Ubuntu, because I don't like KDE4, at all. Looks like vista on crack.....
Posts: 675

Rep: Reputation: 31
Linux is soo cool. Someone else had the same problem, and wrote a script for everyone else to use to solve this problem until the people who do the real coding for Linux can fix it. Then someone else comes along and improves the script, because he usually has a few other devices hooked up, and doesn't want to unmount the wrong device, and he gives that script away to everyone else too. And on top of that, we use Google to find the answer, which was served to us with...yup.... Linux.

So does that updated script work ? I was just goofing off about the KDE comment, because of the gnome vs. kde war that breaks out once in a while. I have trouble using gnome, because I like to tweak every little thing, and I can't do that in gnome, which drives me a little nuts. When it comes to my OS, I want things to be set up exactly how I want them. Gnome sets it up the way THEY want it.

Anyway, let us know how it went...

David
 
Old 01-27-2008, 07:30 PM   #10
mazinoz
Member
 
Registered: Mar 2003
Location: Mansfield Queensland Australia
Distribution: Linux Mint - Tara
Posts: 497

Rep: Reputation: 35
Wink Safe removal of USB hard drive

I think there are two issues here, the unmounting which has been mentioned and the power down of the device. Pulling the power on a spinning hard drive is not a good idea!! What I do is unmount and shutdown.

Then I unplug the USB cable from both hdd and PC. Shortly after this I can hear the hard drive stopping. Then I turn off hdd power switch and unplug power cable.

To mount it I wait till PC has booted, then attach power cable, attach the USB cables, TURN ON the external hard drive. This way linux doesn't get confused as it would if hard drive is spinning, and the hard drive isn't crashed or damaged. This is the sequence of steps stated by the manufacturer.
 
  


Reply

Tags
disk, drive, external, hard, hdd, removal, save, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB 'Safe Removal' gone? mertle Linux - Hardware 1 03-18-2007 09:50 AM
External USB HDD rogere SUSE / openSUSE 6 10-15-2006 01:35 PM
USB external HDD yhus Linux - Hardware 1 06-07-2004 06:18 AM
Unable to edit fstab... problems with ext. usb hdd removal gardyloo Linux - Newbie 1 12-27-2003 07:35 PM
Safe shutdown of external USB hard-drive? blixel Linux - Hardware 3 12-12-2003 01:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration