Unplugging usb safely takes a long time or does not work, safely unplug it via terminal?

Hi friends.

I just formatted my USB flash with the latest version of Ventoy, and inside I put the latest EOS ISO. The file was copied and finalized successfully.

From Dolphin, I right clicked on my usb flash => unmount safely unplug. The problem is that it remains loading for a long time, or sometimes forever.

It happens to me with external hard drives too, so I don’t know what the problem is.

I don’t like to unplug USB flash or external hard drives until the hard drive has been properly removed. Since I’m afraid that the files will be corrupted or something like that.

Normally, when this happens, I reboot EOS with the USB connected, as I figure it’s better than forcibly unplugging it.

I’m wondering if maybe the correct way to unplug USB flash and hard drives is through the terminal or something? Maybe since Dolphin it doesn’t work well. I’m on X11/Xorg by the way, and all my usb flash and hard drives are ETX4.

Thanks in advance.

image
image

The graphical write to the external is always faster than the actual drive write. A lot of times if you look at the device you can see the light working. Nothing is going to make the drive write any faster than its meant to. (ie plugging a USB 2 into a USB 3 will not make the write faster on the USB 2 device)

I suggest you use a bit more patience and allow the system to do the job you set it out to do.

3 Likes

The GUI shows “writing complete” long before the actual data is written due to “caching”. To “prevent” caching, removable drives should be mounted with the “sync” mount option. It isn’t always so when you mount via the GUI. So, if you want to ensure that the data gets written when the GUI says so, mount the drive manually in the terminal (or “remount” it manually with the “sync” option added).
And just for completeness: “safely remove” in the terminal is just “umount”. To be even safer, invoke “sync” 3-4 times before “umount”.

3 Likes

Omg, I didn’t know this! That is, when the GUI says “copy finished”, it is actually still copying.

Is this something normal, or perhaps a KDE or DOLPHIN bug that they will fix in the future?

I would really like to know when I can remove my hard drive without breaking files.

My USB flash doesn’t have lights, but my external hard drive does, and I made important backups there and I always had this problem. So I’ll be more careful next time, because I thought it was stuck, and I unplugged it after waiting for a while. I trusted the GUI too much…

Oh, I didn’t really know this, I’m a noob and I didn’t think there were these kinds of problems with the GUI, I guess that’s why everyone uses the terminal…

I’m very sorry, I don’t want to take advantage of your knowledge but, from ignorance:

Is it advisable to disable the “cache”? This doesn’t negatively affect the files when copying them, right?

So if I mount the drive from the terminal, the GUI will work correctly, so theoretically I just have to mount and unmount it from the terminal, and then I won’t have this problem anymore.

Could you give me a guide to use the mount + sync command from the terminal?

After mounting from the terminal, I plan to use the GUI to copy and paste with right click to my hard drive.

And then, synchronize several times as you recommended + unmount, from the terminal.

(By the way, what’s the point of synchronizing? so that the terminal and the GUI are synchronized at the same time?)

Thanks again to both of you, friends, I have had this problem forever and I thought that my hard drives were not compatible with Linux or the Linux Kernel or something like that.

No, it’s for synchronizing the cache and the actual disk data. I guess that “safely remove” actually calls “sync” for that drive behind the curtains.

In my super-humble opinion, it is advisable to “disable” caches only for removable drives.

GUIs are more discoverable if done right, CLIs are more precise.

1 Like

It is normal.

If you safely eject the removable device, it won’t tell you it is safe to remove until it is ready

Some people do disable it because they prefer a certain behavior and prefer that. In my opinion, it is better to keep the cache. It stops the writing application from being blocked on the device.

3 Likes

I took a further look on my own system, and it’s actually pretty easy to configure KDE (udisks2, in fact) to mount removable drives with “sync”. Just search for “udisks2 mount options”.

1 Like

I put nothing into the remove drive safly feature of ANY OS, I have never had anyone issuse just unplugging the USB divice. No brackage of the device, no accidental wiping of the device, nothing. That said when copying to or from any USB drive including flash drives once I’m told moving / copying is done I wait an additional 10 minutes before unplugging it.

1 Like

Have you tried the sync command on the terminal?
(This was already mentioned above.)
Run it after starting the big copy. It should wait until all cache stuff has been written to all disks, so that should help you see when the big copy is ready.

See also: man sync

2 Likes

Thanks friends, now I know how to do it.

I copy what I need (for example 100gb), paste it to the external hard drive, when the EOS UI says “copying is complete”, it is actually still copying and you have to wait about 2 more hours until the SSD/HDD light stops blinking and turns off.

Then, when the light turns off, you can click the unmount/eject arrow, and then it will work and you will get the message that it has been successfully unmounted/ejected.

So, the trick is to look at the SSD/HDD light and not forcefully remove the drive.

By the way, this does not happen with internal hard drives connected to the motherboard via SATA connections.

Thanks again to all of you!

1 Like

To be honest you would be better off copying large files through the terminal. Will take less memory and time than the graphical counter part. While I know drag and drop is easier it does have its limits

the internal bus speed is much faster than the USB speed.

1 Like

Thanks for the tip friend, I didn’t know it was faster via terminal.

By the way, I don’t know if I asked this before, but is it possible that they will “fix” this in the future? I mean, I know it’s not broken, but maybe there is some way to make copying files via GUI as fast as copying files via terminal.

This would be great for new users or users like me who use the GUI a lot on EOS when copying files.

For example, if you use the “X1” command to copy files via terminal, maybe you can use that same command when you use the GUI (and the terminal runs in the background or something), instead of using the “X2” command for the GUI, since it seems that the GUI uses a different command, and that’s why it copies files slower.

Maybe what I said doesn’t make sense because maybe it works differently, sorry!

The issue you have here is a GUI is going to take up more memory which is going to make it naturally slower than CLI.

1 Like

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