LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-07-2009, 07:23 AM   #1
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 816

Rep: Reputation: 69
Question Unmounting external USB drives


Hi guys,

Sometimes I get a problem with the basic "umount" command. I get an error message telling me that for one reason or another, the device couldn't be unmounted. Usually, it says the device is busy, when I can't see how it possibly can be.

When this happens I'll use "umount -l" or "umount -f" or sometimes "eject" but I'm still not happy, because at the back of my mind I'm worried about damaging the integrity of the device's filesystem. What's the CORRECT way to deal with this problem?

Thanks, cc.

Last edited by Completely Clueless; 04-07-2009 at 07:24 AM. Reason: missing apostrophe
 
Old 04-07-2009, 07:52 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,291

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Hi

To find out what program is having open files, you can use "lsof |grep mountpoint". So if your disk is mounted on e.g. /media/usb the command would be "lsof |grep /media/usb". Then stop all the programs you see in the list. An open terminal with the current directory on the USB will keep it busy.
 
Old 04-07-2009, 08:02 AM   #3
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 816

Original Poster
Rep: Reputation: 69
Quote:
Originally Posted by Guttorm View Post
Hi

To find out what program is having open files, you can use "lsof |grep mountpoint". So if your disk is mounted on e.g. /media/usb the command would be "lsof |grep /media/usb". Then stop all the programs you see in the list. An open terminal with the current directory on the USB will keep it busy.
Many thanks for that. So, just out of curiosity, suppose one has a terminal up and the pwd is in the root of the USB device, will removing it damage the filesystem - even if no data is being read or written at the time?
 
Old 04-07-2009, 08:37 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,714
Blog Entries: 27

Rep: Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058
Hi,

You don't want to remove it. Just leave the working directory by either changing the directory within the console or closing the console. The only damage you possibly could have would be any files that are not completed or 'sync' before closing.
 
Old 05-03-2010, 12:48 PM   #5
vsurlan
Member
 
Registered: Jun 2004
Location: Zagreb, Croatia
Distribution: Debian Lenny
Posts: 49

Rep: Reputation: 15
You can also use fuser to check exactly what is using the drive as it can be something other than the shell as well.

fuser /media/stick

If you own the process you can also kill it using fuser:

fuser -k /media/stick

Taken from: Documentation planet: Linux trick: Unmounting unresponsive drives
 
  


Reply


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
External USB DRIVE - Not fully unmounting rperrine Linux - Newbie 2 07-30-2008 03:13 PM
Red Hat: Can't mount external hard drives anymore. Was rebooted without unmounting jwhitman Linux - General 5 04-21-2008 05:33 PM
mounting and unmounting USB drives Ian D Linux - Software 3 10-15-2005 02:45 PM
External USB drives in redhat? ultrablue Linux - Newbie 3 06-10-2005 04:16 AM
External USB drive mounting/unmounting nsk078 Linux - Hardware 1 09-22-2004 05:15 PM


All times are GMT -5. The time now is 12:32 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