Author Topic: Cannot 'safely remove' external hard drive  (Read 544 times)

Offline peter_pclos

  • Full Member
  • ***
  • Posts: 158
Cannot 'safely remove' external hard drive
« on: January 29, 2013, 11:21:01 AM »
I have recently had difficulty in closing down a 1TByte external (USB connected) hard drive,
as attempts to safely remove it result in an error message claiming that 'one or more files on this device are open within an application'. A test with lsof when the only thing done on the Device Notifier was to click 'Open with File Manager' gave the following result.

Quote
[root@localhost peter_h]# lsof | grep Volume
nepomukse 3598         peter_h   18r      DIR       8,97        86016          5 /media/Volume
nepomukse 3598         peter_h   19r      DIR       8,97         4096      36376 /media/Volume/disk_5-2
nepomukse 3598         peter_h   20r      DIR       8,97         4096      36379 /media/Volume/disk_5-2/usr
nepomukse 3598         peter_h   22r      DIR       8,97        32768      36536 /media/Volume/disk_5-2/usr/share
nepomukse 3598         peter_h   23r      DIR       8,97         4096      36946 /media/Volume/disk_5-2/usr/share/misc
QThread   3598 3604    peter_h   18r      DIR       8,97        86016          5 /media/Volume
QThread   3598 3604    peter_h   19r      DIR       8,97         4096      36376 /media/Volume/disk_5-2
QThread   3598 3604    peter_h   20r      DIR       8,97         4096      36379 /media/Volume/disk_5-2/usr
QThread   3598 3604    peter_h   22r      DIR       8,97        32768      36536 /media/Volume/disk_5-2/usr/share
QThread   3598 3604    peter_h   23r      DIR       8,97         4096      36946 /media/Volume/disk_5-2/usr/share/misc

umount /media/Volume as root simply tells me 'device is busy' - and suggests I use lsof to get further info!

The directory Volume/disk_5-2, which the system seems to think is in use, contains a set of PCLOS system directories rescued from an old internal disk drive.

Are  the actions of nepomukse and/or QThread necessary, and if so, how can I ever get round this problem.  If not, then how do I keep them away from the external drive directories?

My present expedient to get out of this fix is to close down with Alt-PrtScrn-SUB, but it's not ideal.

Online Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11689
  • ----IOFLU----
Re: Cannot 'safely remove' external hard drive
« Reply #1 on: January 29, 2013, 01:01:27 PM »
I have recently had difficulty in closing down a 1TByte external (USB connected) hard drive,
as attempts to safely remove it result in an error message claiming that 'one or more files on this device are open within an application'. A test with lsof when the only thing done on the Device Notifier was to click 'Open with File Manager' gave the following result.

Quote
[root@localhost peter_h]# lsof | grep Volume
nepomukse 3598         peter_h   18r      DIR       8,97        86016          5 /media/Volume
nepomukse 3598         peter_h   19r      DIR       8,97         4096      36376 /media/Volume/disk_5-2
nepomukse 3598         peter_h   20r      DIR       8,97         4096      36379 /media/Volume/disk_5-2/usr
nepomukse 3598         peter_h   22r      DIR       8,97        32768      36536 /media/Volume/disk_5-2/usr/share
nepomukse 3598         peter_h   23r      DIR       8,97         4096      36946 /media/Volume/disk_5-2/usr/share/misc
QThread   3598 3604    peter_h   18r      DIR       8,97        86016          5 /media/Volume
QThread   3598 3604    peter_h   19r      DIR       8,97         4096      36376 /media/Volume/disk_5-2
QThread   3598 3604    peter_h   20r      DIR       8,97         4096      36379 /media/Volume/disk_5-2/usr
QThread   3598 3604    peter_h   22r      DIR       8,97        32768      36536 /media/Volume/disk_5-2/usr/share
QThread   3598 3604    peter_h   23r      DIR       8,97         4096      36946 /media/Volume/disk_5-2/usr/share/misc

umount /media/Volume as root simply tells me 'device is busy' - and suggests I use lsof to get further info!

The directory Volume/disk_5-2, which the system seems to think is in use, contains a set of PCLOS system directories rescued from an old internal disk drive.

Are  the actions of nepomukse and/or QThread necessary, and if so, how can I ever get round this problem.  If not, then how do I keep them away from the external drive directories?

My present expedient to get out of this fix is to close down with Alt-PrtScrn-SUB, but it's not ideal.

Having opened the mount point with a file manager, (Dolphin) you need to close that Dolphin window, and wait a bit. If the drive will still not unmount when trying the Safely Remove option, check again with lsof, as root, and then enter the command;

[root@localhost ~]# kill -9 <pid number one> <pid number two> <pid etc.>

...for as many numbers as are shown. Check again with lsof. There should be no applications now listed, and Safely Remove should now work.

Example:

Using the pid numbers from the above reported lsof results, the command would be;

[root@localhost ~]# kill -9 3598 3604
« Last Edit: January 29, 2013, 01:04:34 PM by Old-Polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline peter_pclos

  • Full Member
  • ***
  • Posts: 158
Re: Cannot 'safely remove' external hard drive
« Reply #2 on: January 29, 2013, 02:25:56 PM »
Thanks for the suggestion, OP.  However, nepomukse is obviously suffering from obsessive-compulsive disorder, because each time I do the kill, the process vanishes, but when I try to 'safely remove' the drive it fails again with the same error message, and nepomukse is sitting there laughing at me - with a new PID.  Any suggestions?  (I suppose I could try to outwit nepomukse by copying the whole directory contents into a new directory and deleting the old one, but that seems  a bit of a cop-out and I'd rather know what's actually going on.)

btw, I also checked lsof IMMEDIATELY after the kill, and the resurrection under the new PID was instant - lsof is only showing nepomukse now as the offending application.
« Last Edit: January 29, 2013, 03:02:50 PM by peter_pclos »

Offline menotu

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 15515
  • ┌∩┐(◕_◕)┌∩┐
Re: Cannot 'safely remove' external hard drive
« Reply #3 on: January 29, 2013, 03:07:27 PM »
Have you tried first disabling Nepomuk?
PCLinuxOS 32bit KDE 4.10.4; kernel-3.4.11-pclos1.bfs & 64bit 3.4.38bfs; NVidia GeForce 8400GS 1GB 310.19 driver

Sony Vaio SVE1513A4ESI Laptop, Intel Core i5, 2.6GHz, 6GB RAM, 750GB, 15.6" Intel HD Graphics 4000

Offline peter_pclos

  • Full Member
  • ***
  • Posts: 158
Re: Cannot 'safely remove' external hard drive
« Reply #4 on: January 29, 2013, 03:55:39 PM »
Menotu,

I stopped the nepomuk server using the System Monitor, and as you suggested, this cleared the problem.  

The server re-started at the next re-boot, but the problem of the failure to safely remove then re-appeared, and it was necessary again to stop the nepomuk server before the external drive could be removed safely. 

On checking in the System Settings/Workspace Appearance and Behaviour/Desktop Search/Desktop Query  (Nepomuk/Strigi Server Configuration) pane, Removable Media Handling is set to 'Ignore all removable media'.  Does anyone know why Nepomuk is NOT ignoring the USB-connected external drive, and what can be done about it?
« Last Edit: January 30, 2013, 04:07:14 PM by peter_pclos »

Offline menotu

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 15515
  • ┌∩┐(◕_◕)┌∩┐
Re: Cannot 'safely remove' external hard drive
« Reply #5 on: January 31, 2013, 04:20:10 AM »
Menotu,

I stopped the nepomuk server using the System Monitor, and as you suggested, this cleared the problem.  

The server re-started at the next re-boot, but the problem of the failure to safely remove then re-appeared, and it was necessary again to stop the nepomuk server before the external drive could be removed safely. 

On checking in the System Settings/Workspace Appearance and Behaviour/Desktop Search/Desktop Query  (Nepomuk/Strigi Server Configuration) pane, Removable Media Handling is set to 'Ignore all removable media'.  Does anyone know why Nepomuk is NOT ignoring the USB-connected external drive, and what can be done about it?

If you haven't already done so one thing you could check in the Customize Index Folders option on the right hand side of the Desktop Query Tab that the USB drive isn't enabled
PCLinuxOS 32bit KDE 4.10.4; kernel-3.4.11-pclos1.bfs & 64bit 3.4.38bfs; NVidia GeForce 8400GS 1GB 310.19 driver

Sony Vaio SVE1513A4ESI Laptop, Intel Core i5, 2.6GHz, 6GB RAM, 750GB, 15.6" Intel HD Graphics 4000

Offline peter_pclos

  • Full Member
  • ***
  • Posts: 158
Re: Cannot 'safely remove' external hard drive
« Reply #6 on: January 31, 2013, 11:23:22 AM »
menotu,

Have now checked this.  On the one hand, lsof today gives me:

Quote
nepomukse 3713 peter_h   19r   DIR   8,97    94208    5 /media/Volume

but the Customize Index Folders link tells me that /media/Volume 'will not be indexed for desktop search'

Any ideas?