1

I need to understand a couple of things: every USB pen (2.0 and 3.0) I connect to my notebook with Ubuntu 17.10 results very slow writing files on them. If I paste 1GB (a movie for example) to a 3.0 pen it starts very fast (the right fast I think), but then it slows down to hell and it remains on 99% for 3 minutes. I remember I didn't have this problem on the old pc with the same Ubuntu version, with the same USB pens. Can I do something to mitigate the situation?

1 Answer 1

3

Copy to RAM and then to the USB pendrive

What you see is that the copy process writes to a buffer in RAM, and then the copy process will be busy with the next step, to write from the buffer to the USB pendrive's memory cells. Different versions of Ubuntu have different 'break-points' where the buffering is stopped and the writing to the USB drive starts and sets the copying speed.

I have seen this behaviour in several versions of Ubuntu and how it may vary from one version to the next one. It is very obvious, when creating USB boot drives with mkusb. This is illustrated with the following output from mkusb, when writing to a Sandisk Extreme USB 3 pendrive in Ubuntu 17.10,

...
Installing 'lubuntu-16.04.1-desktop-amd64.iso' to '/dev/sdb' ... :

< "lubuntu-16.04.1-desktop-amd64.iso" pv -s 896532480 | dd bs=4096  of=/dev/sdb
 Please wait for sync until 'Done' is written 
 (flushing file system buffers to the device)
 855MiB 0:00:05 [ 150MiB/s] [===========================================>] 100%
218880+0 records in
218880+0 records out
896532480 bytes (897 MB, 855 MiB) copied, 19,4446 s, 46,1 MB/s
Syncing the device ...
 Done :-) 
p_clean:
live system or temporary superuser permissions
clean if necessary and return

sync

In this case it is important that the buffers are flushed so that you can be sure that the writing to the USB drive has finished, and you can unplug the USB pendrive. You can use the command

sync

for this purpose. When the shell returns to prompt, sync has finished, and the buffers are flushed.


When you have written a file to a file system and unmount that file system, sync is run automatically before the file system (partition) is unmounted. But when you clone from an iso file to a USB pendrive, there is no mounted file system in the target drive, and you should use sync.

Look for fast USB 3 pendrives

There are big differences in write speed between USB pendrives. Some USB 3 pendrives are quite fast, while others are not much faster than USB 2 pendrives. If you want fast writing, you can get useful tips via this link,

help.ubuntu.com/community/Installation/FromUSBStick#Notes_about_speed

Restore speed by wiping the whole device

When old pendrives get slower (typically reduce the writing speed to half), I wipe the whole device with mkusb (overwrite with zeros). That way I can recover the original (or near original) write speed. I think it is a way to relieve the internal management of the memory cells (connecting logical cells with physical cells, maybe by releasing cells that have been written to seldom because they have been storing data). But don't do it too often, because of the wear.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .