Drive can't be ejected the first time, despite "Quick removal" being enabled

1

This related answer isn't relevant because it's FAT-specific and I use NTFS.

I have a 1.5TB BitLocker-encrypted external hard drive formatted in NTFS on which I make large backups using BorgBackup on the Ubuntu for Windows (WSL). This drive has write-caching disabled in the Device Manager:

screenshot of the Properties tab where Quick removal is enabled

When the backups are finished (Borg has exited), I umount the drive from WSL, wait for this to exit, then close the terminal and ask to Eject the drive in Windows' task bar.

The first time always fails: after a few seconds where the drive's activity LED blinks, I get a warning from Windows that "the drive is still in use". If I ask to eject it a second time, it is ejected correctly.

Why does Windows still do something with the drive before ejecting, for long enough for the ejection to fail? I thought Quick removal should prevent this.

Hey

Posted 2020-01-19T11:17:58.183

Reputation: 939

Answers

1

This is a well-known problem with ejecting drives too fast after the last operation.

The problem is not with Quick Removal, which does work, but with two factors:

  • Even with Quick Removal, it does take some short while to transmit the data from memory to the disk.

  • Every time something changes on the disk, Windows will look it up. Some of this can be avoided by ensuring that the disk is not marked for indexing, but there may be other programs still verifying the disk status. When that happens, the first Eject acts as a signal to stop all access, so that the second one succeeds.

harrymc

Posted 2020-01-19T11:17:58.183

Reputation: 306 093