Manjaro not committing file system changes until the (external) drive has been ejected

Hey there, I have come across and issue that I have had with Manjaro for a while but hasn’t really been a problem until now.

When copying files to an external drive - be it a USB Drive, HDD or anything that stores data - the files “copy” at a blazing fast speed, speeds that aren’t even possible on SATA3 never mind USB 3.0 (for example, I was backing up my Music library to an external drive via SATA to USB 3 and it copied 3GB of data in 2 seconds). However, when you remove the drive without unmounting/safely ejecting the files aren’t actually there. The data only seems to get committed to the drive when it is ejected.

Has anyone else had this issue before and if so, how did you fix it/work around it? If needs be, I can send screenshots/logs but I need to know what would be useful.

First of all, never remove the drive without safely unmounting it. Secondly, try mounting the drive with the sync option.

This is completely normal for Linux.

Linux is using available memory as cache and if you have enough - yes - then the initial copy operation appearing fast - but you still have to flush the buffer to disk. You can of course tweak settings - but you wall always be depending on the write speed of the connected port and the device type.

E.g. a WD Passport USB3.1 is way faster than a highspeed USB3 Sandisk.


Aye, I’m aware that Linux using disk buffers/caches in the RAM to help assist IO operations. How do I tweak the settings so that I don’t have to wait for the buffer to flush when ejecting? It’s somewhat frustraiting to eject then wait a good while before I’m able to actually remove the device from my system. I’m using KDE’s mounting system, though I’ll move to scripts, /etc/fstab or the command line if I have to.

Se the above mentioned script - created by @cscs and @Kresimir - the script is well documented.

No matter how to approach this - the time taken is the time it takes whether it is during the operation or after the operation. The operation will not be faster if the sync is ongoing - your real issue is impatience - the system works as fast as the system can.

As already noted by @Aragorn you can use the sync option

sync   All I/O to the filesystem should be  done  synchronously.   In
       the  case of media with a limited number of write cycles (e.g.
       some flash drives), sync may cause life-cycle shortening.

mount(8) - Linux manual page

You can use systemd to mount an USB device to a specific mount point and use the sync option. As pointed out the device may have a shorter life-cycle if the option is used.

You got me there haha. Alright, thanks for your patience and help - it’s much appreciated. I don’t often use external media but for when I do I’ll change my thinking from the inferior Windows way (been using it for 19 years compared to me using Linux for 4 months) to the Chad Linux mindset. Thanks again to both of you, keep up the good work!

1 Like

In addition to the above.

I just run the sync command before removing the device.
KDE has a Device Notifier in the System Tray, which has a “Safe to Remove” button.
It’ll display whether safe to remove or not.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.