> I have some USB-attached HDDs connected to a laptop running Debian
> 12. Recently I had a problem ejecting them using the file manager and the
> Disks app, something on the drives was still "in use" even when I had closed
> every open application.

I assume here that the "in use"ness was very limited: the drives were
basically idle.

> Since then I've learned of the existence of 'lsof', but at the time my

[ FWIW, while I used to like `lsof` and `fuser`, they haven't been very
  helpful over the last decade or so, for me: all too often telling me
  that nothing using the mount point even though `mount` tells me it's
  still busy.  ]

> The last thing I saw before the laptop powered off was a series of
> messages reporting that both external drives had failed to unmount
> cleanly,

Presumably for the same reason you couldn't "eject" them.

> and this was confirmed by the nasty clunking noise from the drives
> indicating sudden parking of the drive heads when the USB power was
> unexpectedly removed.

AFAIK, this has nothing to do with the unmounting of the partitions.
IOW, you'd have heard the exact same noise even if the OS had been able
to successfully unmount the partitions (what you call "eject")
before rebooting.

> Following this incident I've had to recover some several GBs of
> files from each drive.

What filesystem are you using on those drives?
Ext4?  FAT?  Something else?

For most filesystems nowadays, a forced disconnection should not cause
any significant data loss if the drive was idle when the
disconnection occurred.


=== Stefan

Reply via email to