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.It is a good habit to issue "sync" command, before disconnecting any USB storage devices.
Since then I've learned of the existence of 'lsof', but at the time my experience of Windows and macOS suggested that, under these kinds of circumstances, performing a shutdown will clear the holds on the drives and cleanly eject them during the process. So as I didn't know what else to do I shut down Debian using the menu.
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, 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. Following this incident I've had to recover some several GBs of files from each drive.
Obviously this wasn't a very pleasant experience, so I'd like to know what steps I can take to make Debian act more responsibly in future.
IM(H)O part of the problem was that the first thing to get torn down during the shutdown was the GUI, which meant that there was no way for a user to intervene if there was a problem with ejecting the drives cleanly. Windows and macOS will prompt the user using the GUI if there's a problem that means a drive can't be automatically ejected cleanly during a shutdown, giving users an opportunity to abort. Can I modify the Debian shutdown sequence to keep the GUI available until all drives are safely ejected?
I'd welcome any other suggestions to make Debian less likely to cause data loss on external drives during shutdown.
On 5/1/26 00:30, coffeeforblood.pardon117@slmail.me wrote:
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.
Since then I've learned of the existence of 'lsof', but at the time
my experience of Windows and macOS suggested that, under these
kinds of circumstances, performing a shutdown will clear the holds
on the drives and cleanly eject them during the process. So as I
didn't know what else to do I shut down Debian using the menu.
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, 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. Following this incident I've
had to recover some several GBs of files from each drive.
Obviously this wasn't a very pleasant experience, so I'd like to
know what steps I can take to make Debian act more responsibly in
future.
IM(H)O part of the problem was that the first thing to get torn
down during the shutdown was the GUI, which meant that there was no
way for a user to intervene if there was a problem with ejecting
the drives cleanly. Windows and macOS will prompt the user using
the GUI if there's a problem that means a drive can't be
automatically ejected cleanly during a shutdown, giving users an opportunity to abort. Can I modify the Debian shutdown sequence to
keep the GUI available until all drives are safely ejected?
I'd welcome any other suggestions to make Debian less likely toIt is a good habit to issue "sync" command, before disconnecting any
cause data loss on external drives during shutdown.
USB storage devices.
Some storage devices have very slow write speeds, so you have to wait
for the "sync" command to finish syncing cached writes.
When it finishes you can run it again, just to be sure it worked and
it should finish in an instant.
Now you can safely unmount and then physically disconnect USB storage devices.
"Alexander V. Makartsev"<avbetev@gmail.com> wrote:I'm guessing "umount" command is just as good to safely unmount
On 5/1/26 00:30,coffeeforblood.pardon117@slmail.me wrote:Why doesn't the OS run synce twice on every storage device when it's
I have some USB-attached HDDs connected to a laptop running DebianIt is a good habit to issue "sync" command, before disconnecting any
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.
Since then I've learned of the existence of 'lsof', but at the time
my experience of Windows and macOS suggested that, under these
kinds of circumstances, performing a shutdown will clear the holds
on the drives and cleanly eject them during the process. So as I
didn't know what else to do I shut down Debian using the menu.
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, 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. Following this incident I've
had to recover some several GBs of files from each drive.
Obviously this wasn't a very pleasant experience, so I'd like to
know what steps I can take to make Debian act more responsibly in
future.
IM(H)O part of the problem was that the first thing to get torn
down during the shutdown was the GUI, which meant that there was no
way for a user to intervene if there was a problem with ejecting
the drives cleanly. Windows and macOS will prompt the user using
the GUI if there's a problem that means a drive can't be
automatically ejected cleanly during a shutdown, giving users an
opportunity to abort. Can I modify the Debian shutdown sequence to
keep the GUI available until all drives are safely ejected?
I'd welcome any other suggestions to make Debian less likely to
cause data loss on external drives during shutdown.
USB storage devices.
Some storage devices have very slow write speeds, so you have to wait
for the "sync" command to finish syncing cached writes.
When it finishes you can run it again, just to be sure it worked and
it should finish in an instant.
Now you can safely unmount and then physically disconnect USB storage
devices.
shutting down?
As an additional thought, there could be something wrong with the
OP's HDD drive, like bad\remapped sectors, or any other issue, making
its write speed even slower.
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.
Since then I've learned of the existence of 'lsof', but at the time my
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,
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.
Following this incident I've had to recover some several GBs of
files from each drive.
heI have some USB-attached HDDs connected to a laptop running Debian
12. Recently I had a problem ejecting them using the file manager and t
losedDisks app, something on the drives was still "in use" even when I had c
every open application.
I assume here that the "in use"ness was very limited: the drives were basically idle.
I've found that "in use" can also mean that you're looking at the
disk. Try just "cd" to get off it and get back home.
On 5/1/26 00:30, coffeeforblood.pardon117@slmail.me wrote:[...]
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 think this is the most plausible explanation. Some application "sittingI'd welcome any other suggestions to make Debian less likely to cause data loss on external drives during shutdown.It is a good habit to issue "sync" command, before disconnecting any USB storage devices.
Some storage devices have very slow write speeds, so you have to wait for
the "sync" command to finish syncing cached writes.
When it finishes you can run it again, just to be sure it worked and it should finish in an instant.
Now you can safely unmount and then physically disconnect USB storage devices.
I'm guessing "umount" command is just as good to safely unmount filesystems during shutdown, but the actual process (systemd units?) that does it could be getting interrupted by timeout.
IIRC 1 minute 30 seconds is the default timeout for systemd units.
If a slow USB storage device has a few gigabytes of cached writes it won't make it in time.
SATA\M.2 connected storage devices are not affected because they are many times faster and the connection is more robust.
I've never actually tested this and never tried to shutdown a PC with a few terabytes of pending writes to the root filesystem.
If the drive is making noise, it is time to retire it.
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 5 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 493853:23:26 |
| Calls: | 146 |
| Files: | 547 |
| D/L today: |
6 files (97K bytes) |
| Messages: | 76,985 |