"Alexander V. Makartsev" <[email protected]> wrote:
> On 5/1/26 00:30, [email protected] 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 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.

Why doesn't the OS run synce twice on every storage device when it's
shutting down?

Reply via email to