Unable to safetly remove flash drive after file transfer

Hi, since 1st day of using Fedora 42 with KDE plasma I cannot safely remove any USB flash drive after transferring files to it.
I’ve tried with different flash drives and file systems, the most recent being a new 64gb SanDisk Dual Drive formatted to btrfs that I use to transfer files from my PC to a Steamos gaming handheld (Lenovo Legion Go S).
The flash drive is safely removed without issues on the gaming handheld or on the PC if no files have been added to it.

Is there a practical way to troubleshoot if it is an issue with the hardware or software?

Operating System: Fedora Linux 42
KDE Plasma Version: 6.4.2
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.1
Kernel Version: 6.15.4-200.fc42.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × 11th Gen Intel® Core™ i7-11700KF @ 3.60GHz
Memory: 64 GiB of RAM (62.6 GiB usable)
Graphics Processor: AMD Radeon RX 7900 XTX
Product Name: Z590M-ITX/ax

If you open Dolphin and right click the drive and “safely remove”, do you get any error message opening in Dolphin?

I’ve noticed after large file transfers it can take time for it to unmount safely (I don’t know if it’s performing a sync in the background so data isn’t lost).

I also noticed the same drive, when I tried safely unmounting it through Dolphin popped up a warning that the drive was still in use, some kioworker thing at least once. I think for that one I might have manually unmounted it via the terminal with sudo umount /run/media/[DEVICE_NAME].

2 Likes

A device can never be safely removed if there is still an operation writing to the device.

if you use the file manager (dolphin) to dismount/eject the device it will wait until the write operation is completed before performing the eject.
If you attempt the dismount from the command line (with umount) it will refuse until the write has completed, and also will not umount if something is open on that device, such as the file manager viewing the content, or the user having used cd to move into the device file system.

1 Like

Thanks for the reply, there is no error message and I noticed that removing the drive will eventually work after a (very) long period of time.
However a few files end up damaged or corrupted mainly after transferring large video files.
It appears that the write operation takes much longer than indicated by the transfer notification.
I have also tried this operation transferring files from the gaming handheld.
It still take some time to safely remove the drive and the notification now indicates to wait until all operations are completed.
It eventually work and files are intact.
There might a hardware issue with the USB controller on my main system.

Keep in mind that when making a big file transfer, you will fill up the buffer cache very quickly so the transfer appears to be very fast. However, the data in the buffer cache still needs to be written to the USB device and that will take some time, and in some cases a long time.

Thanks for the explanation, now I can understand that the transfer notification solely reflect the buffer cache and not the actual data written onto the flash drive.