Why does mouse and cursor movement become erratic when I copy an entire memory stick to another stick?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Why does mouse and cursor movement become erratic when I copy an entire memory stick to another stick?
I copied a 16 GB USB memory stick to another 16 GB stick (cloned it), by using
the following command:
Code:
cp /dev/sdb /dev/sdd
It took about 27 minutes, and the cloning works. But during the entire copy
process, the mouse and cursor movement become erratic, and lag terribly. This
makes using the laptop during the copy almost impossible.
This happened to me on a previous occasion, so the effect is reproducible.
What causes this effect?
How do I stop the erratic behaviour?
Are you able to replicate the behaviour on your computer?
The kernel is swapping out programs to use memory for disk caching. You can lower the value of /proc/sys/vm/swappiness to as little as 1 to preclude this.
As noted above, you can use "nice cp ..." to run this command. This voluntarily assigns the process a reduced priority, so that it will let other processes which are competing against it (such as your UI ...) "play through." (Which is, after all, a "nice, courteous" thing for resource-intensive processes to do ...)
Interestingly, my experience is that this really doesn't affect the completion time of most things very much. There's usually an abundance of CPU and I/O resources to spare. So, this command simply causes the "nice" process to step aside when challenged. When you move your mouse and the UI needs to redraw the mouse-pointer quickly, the "nice" activity doesn't get in the way.
Last edited by sundialsvcs; 09-08-2021 at 10:50 AM.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,814
Rep:
Quote:
Originally Posted by EdGr
The kernel is swapping out programs to use memory for disk caching.
That assumes that swap space was even allocated. If I got a nickel for every time I ran across a post on the 'Net effectively saying "Nah... you don't need swap".
That assumes that swap space was even allocated. If I got a nickel for every time I ran across a post on the 'Net effectively saying "Nah... you don't need swap".
Swapping is the most likely explanation. The kernel's default swappiness (60) is too high for desktop use. Desktop users need to lower the swappiness to prevent the kernel from swapping out programs during large file copies.
In contrast, lowering the priority is not likely to help because the OP's copy is transferring only 10MB/s (the speed of the USB flash). This rate is far too slow to saturate USB2 or anything else in the computer.
Ed
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.