Ejecting usb stick takes a long time

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Pascal Illustrator
Level 3
Level 3
Posts: 155
Joined: Thu Jun 07, 2018 2:27 pm
Contact:

Ejecting usb stick takes a long time

Post by Pascal Illustrator » Thu Aug 15, 2019 8:28 am

Hello,
When I have copied large files to a removable medium in Mint like an usb stick and everything seems to be copied then I want to eject the usb stick. But when I do that I get a message that it's still busy and I have to wait.
After a while I don't get this wait message anymore and I can eject the usb stick.
With big files this can take a long time after the copy before I can eject.
Why is this?
And isn't there a faster way?
Linux Mint 19.1 Tessa - Xfce 64-bit

User avatar
catweazel
Level 19
Level 19
Posts: 9213
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Ejecting usb stick takes a long time

Post by catweazel » Thu Aug 15, 2019 9:04 am

Pascal Illustrator wrote:
Thu Aug 15, 2019 8:28 am
And isn't there a faster way?
Yes. Buy faster sticks.

The reason you're getting that message is because of the way file copies work. The file first starts to write to the medium, then fills up RAM as the data being written backs up. The delay is caused by the device being slow and data remaining in RAM that still needs to be written.
¡uʍop ǝpısdn sı buıɥʇʎɹǝʌǝ os ɐıןɐɹʇsnɐ ɯoɹɟ ɯ,ı

Pascal Illustrator
Level 3
Level 3
Posts: 155
Joined: Thu Jun 07, 2018 2:27 pm
Contact:

Re: Ejecting usb stick takes a long time

Post by Pascal Illustrator » Thu Aug 15, 2019 10:36 am

But does this mean that the copy system in Lunux is different than Mac OS or Windows.
In all 3 systems I have a progress bar, but only in Linux I still have to wait at the end. In Windows and Mac OS I can eject as soon as the copy is completed.
Linux Mint 19.1 Tessa - Xfce 64-bit

User avatar
catweazel
Level 19
Level 19
Posts: 9213
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Ejecting usb stick takes a long time

Post by catweazel » Thu Aug 15, 2019 10:38 am

Pascal Illustrator wrote:
Thu Aug 15, 2019 10:36 am
In Windows and Mac OS I can eject as soon as the copy is completed.
Then the copy isn't being buffered.
¡uʍop ǝpısdn sı buıɥʇʎɹǝʌǝ os ɐıןɐɹʇsnɐ ɯoɹɟ ɯ,ı

Pascal Illustrator
Level 3
Level 3
Posts: 155
Joined: Thu Jun 07, 2018 2:27 pm
Contact:

Re: Ejecting usb stick takes a long time

Post by Pascal Illustrator » Thu Aug 15, 2019 10:49 am

Oh. ok. Thanks.
Is there a way to switch the buffer off in Linux Mint?
Linux Mint 19.1 Tessa - Xfce 64-bit

pbear
Level 7
Level 7
Posts: 1829
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Ejecting usb stick takes a long time

Post by pbear » Thu Aug 15, 2019 11:05 am

Pascal Illustrator wrote:
Thu Aug 15, 2019 10:36 am
In Windows and Mac OS I can eject as soon as the copy is completed.
Sounds like a hardware difference. For comparison, I have Windows and Mint on similar machines - both with modest specs as I do no gaming and little graphics intensive stuff - and observe this phenomenon in Windows also. If anything, seems to be more of a problem there.

Anyhoo, no, you can't just turn off buffering. The best you can do is reduce it by using faster USB drives, as catweazel advised at the start.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Pascal Illustrator
Level 3
Level 3
Posts: 155
Joined: Thu Jun 07, 2018 2:27 pm
Contact:

Re: Ejecting usb stick takes a long time

Post by Pascal Illustrator » Thu Aug 15, 2019 11:20 am

Ok. Thank you.
Ps: I use both Linux Mint and Windows on the same computer (dual boot).
Linux Mint 19.1 Tessa - Xfce 64-bit

pbear
Level 7
Level 7
Posts: 1829
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Ejecting usb stick takes a long time

Post by pbear » Thu Aug 15, 2019 11:23 pm

That is puzzling. One thing I will mention. If you're using an older machine, although it's counter intuitive, 3.0 USB drives run much faster than 2.0 drives even on a 2.0 port. One of my machines has only the latter and I've observed this personally. Also, brand matters. I've had good luck with Samsung.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

athi
Level 6
Level 6
Posts: 1283
Joined: Sun Mar 30, 2014 10:15 am
Location: USA

Re: Ejecting usb stick takes a long time

Post by athi » Thu Aug 15, 2019 11:41 pm

pbear wrote:
Thu Aug 15, 2019 11:23 pm
That is puzzling. One thing I will mention. If you're using an older machine, although it's counter intuitive, 3.0 USB drives run much faster than 2.0 drives even on a 2.0 port. One of my machines has only the latter and I've observed this personally. Also, brand matters. I've had good luck with Samsung.
Difference is in the controller on the drives. Better quality controller of the same generation device have faster transfer speed. That is also why USB3 have faster transfer speed on USB2 ports. And also why USB dock have faster transfer speed on the same port than the best USB drives.
Mint Mate 19.1. Main rig is HP 800G2 I5 6500 16GB ram, 120GB boot drive, 2x3TB, 1x4TB data drives. Oldest rig is Mate 18.3 on Dell D620 with 32bits core duo.

pbear
Level 7
Level 7
Posts: 1829
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Ejecting usb stick takes a long time

Post by pbear » Fri Aug 16, 2019 11:22 am

I knew about the controller, but not the implications for a USB dock. Thanks.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

athi
Level 6
Level 6
Posts: 1283
Joined: Sun Mar 30, 2014 10:15 am
Location: USA

Re: Ejecting usb stick takes a long time

Post by athi » Fri Aug 16, 2019 12:03 pm

pbear wrote:
Fri Aug 16, 2019 11:22 am
I knew about the controller, but not the implications for a USB dock. Thanks.
For the ultimate in USB3 speed, use a M.2 NVMe SSD in a NVMe external enclosure. Pricey but fast, great for a portable Mint installation.
https://www.amazon.com/nvme-drive-enclo ... +enclosure
Mint Mate 19.1. Main rig is HP 800G2 I5 6500 16GB ram, 120GB boot drive, 2x3TB, 1x4TB data drives. Oldest rig is Mate 18.3 on Dell D620 with 32bits core duo.

ColdBootII
Level 4
Level 4
Posts: 456
Joined: Wed Aug 02, 2017 8:19 am

Re: Ejecting usb stick takes a long time

Post by ColdBootII » Fri Aug 16, 2019 6:37 pm

Hi,

Since I also face the same "issue" often, I will come up with a different approach/partial solution, though a very fast stick always helps.

Namely, I've devised 2 scripts (for Caja but easy enough to alter for use in Nemo):

1) one to calculate the total size of all files selected for transfer:

Code: Select all

#! /bin/bash
SELECTED=$( while IFS= read -r f; do
    wc -c "$f";
done < <(echo "$CAJA_SCRIPT_SELECTED_FILE_PATHS") \
| grep -o "^[0-9]*" \
| paste -sd+ | bc )

SELECTED=$((SELECTED / 1000/1000))

if [ -f  "/dev/shm/forcopy.txt" ]
then
  SELECTEDBEFORE=$(cat "/dev/shm/forcopy.txt")
  SELECTED=$((SELECTED + SELECTEDBEFORE))
  echo $SELECTED > /dev/shm/forcopy.txt
else
  echo $SELECTED > /dev/shm/forcopy.txt
fi
To use it, select all files in a folder you intend to copy, run this script, then drag and drop them to the stick.

2)-ond script displays the actual progress of a copy operation on panel in a command applet. When you see "USB idle", you can eject the stick.

Code: Select all

#!  /bin/bash
if [ -f  "/dev/shm/forcopy.txt" ]
then
  TOCOPY=$(cat "/dev/shm/forcopy.txt")
else
  TOCOPY=0
fi

if [ $(awk "{ print \$9 }" /sys/block/sdb/stat) -gt 0 ]
    then
        let DataWrittenUSB=$(awk "{ print \$7 }" /sys/block/sdb/stat)*512/1000/1000
        echo $DataWrittenUSB'MB of  '$TOCOPY"MB written to USB"
 else
        echo "USB idle"
fi
So, displaying exact copy progress can be done but unfortunately, not through any file manager.

HTH,
Cheers.

Pascal Illustrator
Level 3
Level 3
Posts: 155
Joined: Thu Jun 07, 2018 2:27 pm
Contact:

Re: Ejecting usb stick takes a long time

Post by Pascal Illustrator » Sun Aug 18, 2019 5:31 am

Sorry for the delay.
Thanks for all the comments. I think I have the information I need.
Terminal and code is not really something I work with because I am an end-user.
The usb stick is actually a Samsung EVO SD XC card in an Transcend USB 3.0 adapter.
If there's some delay that's ok for now.
My computer hardware is pretty new: Ryzen 7 1700X - 32 GB ram - NVME drive for Windows - Samsung EVO for Linux - Samsung 1 TB ssd - 1 TB harddisk - ASUS Prime X-370 Pro motherboard - GPU: something with the number 1060, I think MSI nvidia or so...
Linux Mint 19.1 Tessa - Xfce 64-bit

athi
Level 6
Level 6
Posts: 1283
Joined: Sun Mar 30, 2014 10:15 am
Location: USA

Re: Ejecting usb stick takes a long time

Post by athi » Sun Aug 18, 2019 8:25 am

Pascal Illustrator wrote:
Sun Aug 18, 2019 5:31 am
Sorry for the delay.
Thanks for all the comments. I think I have the information I need.
Terminal and code is not really something I work with because I am an end-user.
The usb stick is actually a Samsung EVO SD XC card in an Transcend USB 3.0 adapter.
If there's some delay that's ok for now.
My computer hardware is pretty new: Ryzen 7 1700X - 32 GB ram - NVME drive for Windows - Samsung EVO for Linux - Samsung 1 TB ssd - 1 TB harddisk - ASUS Prime X-370 Pro motherboard - GPU: something with the number 1060, I think MSI nvidia or so...
Screenshot at 2019-08-18 07-07-59.png
The EVO SD XC and Transcend adapter is very fast USB3.0 hardware. That ASUS Prime X-370 Pro is newer hardware with mixed USB 2.0, USB3.0 and USB3.1 and could be part of the issue. Not sure how good USB3.1 support is right now. Per above picture, try connecting the drive to the USB3.0 (#3) ports and see if that help. Also, internal USB connectors 7 is USB3.1 and 13 is USB2.0 per below manual pp16, so you may want to mark the relevant external USB ports as such.

https://dlcdnets.asus.com/pub/ASUS/mb/S ... 170712.pdf

BTW: What kernel version are you using? For newer hardware like this, you may want to use the latest supported 5 series.
Mint Mate 19.1. Main rig is HP 800G2 I5 6500 16GB ram, 120GB boot drive, 2x3TB, 1x4TB data drives. Oldest rig is Mate 18.3 on Dell D620 with 32bits core duo.

pingvinche2
Level 1
Level 1
Posts: 6
Joined: Mon Aug 19, 2019 10:38 am
Location: Novi Sad

Re: Ejecting usb stick takes a long time

Post by pingvinche2 » Mon Aug 19, 2019 10:47 am

I'm having same problem as author of this thread, on Linux Mint 19.2 Cinnamon
Thou din't have it on 17.2 . USB is working good on Windows.

But in other thread i will start an longer issue I'm having with USB ports in general. (long time mount/unmount with usb-mouse and usb-stick)
LM 19.2 Cinnamon, Dell Inspiron N5010

Pascal Illustrator
Level 3
Level 3
Posts: 155
Joined: Thu Jun 07, 2018 2:27 pm
Contact:

Re: Ejecting usb stick takes a long time

Post by Pascal Illustrator » Mon Aug 19, 2019 11:22 am

The computer store has build my computer.
I'm not planning to change internal parts unless really neccessary.
It works and that's the most important to me.
Linux Mint 19.1 Tessa - Xfce 64-bit

athi
Level 6
Level 6
Posts: 1283
Joined: Sun Mar 30, 2014 10:15 am
Location: USA

Re: Ejecting usb stick takes a long time

Post by athi » Mon Aug 19, 2019 12:18 pm

Pascal Illustrator wrote:
Mon Aug 19, 2019 11:22 am
The computer store has build my computer.
I'm not planning to change internal parts unless really neccessary.
It works and that's the most important to me.
I am not saying you need to make changes, just that USB3.1 maybe the cause for the delay and there is no way to visually determine USB3.0 from USB3.1. To test this, try using the back USB3.0 and USB3.1 ports and see if they both have the same issue.
Mint Mate 19.1. Main rig is HP 800G2 I5 6500 16GB ram, 120GB boot drive, 2x3TB, 1x4TB data drives. Oldest rig is Mate 18.3 on Dell D620 with 32bits core duo.

Pascal Illustrator
Level 3
Level 3
Posts: 155
Joined: Thu Jun 07, 2018 2:27 pm
Contact:

Re: Ejecting usb stick takes a long time

Post by Pascal Illustrator » Wed Aug 21, 2019 12:33 pm

I will try that. Thank you.
Linux Mint 19.1 Tessa - Xfce 64-bit

Post Reply

Return to “Newbie Questions”