9

When I do a large file transfer from my external USB3 hard drive to my internal hard drive (or vice versa), be it via Nautilus or via terminal, Ubuntu (Unity) will almost completely lock up. Things like alt-tab take 20 seconds or more to complete while the file transfer is running. This is not the case when there are lots of random reads/writes to the disk, such as when installing packages.

When I was running Windows, I could run a file transfer in the background and still be able to do things, albeit more slowly when something needed to access the disk. I could still alt-tab just fine.

It seems that Ubuntu prioritizes the file transfer above all other disk I/O, which is why it locks up. In Windows it appears that file transfers have a lower priority, which means the system can stay responsive while the disk is saturated.

How can I fix this? It's rather annoying, as the computer becomes completely unusable when copying files. This issue happens in both 14.04 and 15.10. I'm forced to plug my hard drive into a USB2 port to prevent this issue, and that results in much longer transfer times.

1

1 Answer 1

10
+100

I have had the same issue on my laptop, which has a fairly slow disk system as compared to the remainder of the computer.

I was able to make this much better, by changing the scheduling algorithm used for disk transfers. By default Ubuntu uses Deadline, but I find my system responds more quickly when I use cfq.

To see what scheduler you are using, issue the command

cat /sys/class/block/sda/queue/scheduler    

To do a one-time change (until reboot) issue the command

echo cfq | sudo tee /sys/class/block/sda/queue/scheduler

Note that it is important that the change be made to whatever it is that you have for your external hard drive; Mine usually loads up as sdb. so I would issue the command echo cfq | sudo tee /sys/class/block/sdb/queue/scheduler

I make my change permanent for all drives attached to my computer, by adding the kernel parameter elevator=cfq in my grub file, which looks like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noautogroup elevator=cfq"
10
  • Wow, this worked. Thanks! My system is now way more responsive while transferring, and is actually faster at loading things overall.
    – Degru
    Commented Nov 30, 2015 at 0:25
  • Glad to hear it helped. Commented Nov 30, 2015 at 0:26
  • 1
    > By default Ubuntu uses Deadline, but I find my system responds more quickly when I use deadline. I suspect you did want this phrase to end in '...when I use cfq'.
    – markus_b
    Commented Nov 30, 2015 at 14:48
  • I never looked for a solution to this for a reason or another. I upvoted this answer when it was posted some days ago, now I've had the chance to test it (I had to migrate a lot of torrents from Deluge back to Transmission, which required rechecking every single torrent) and changing the scheduler was indeed an improvement. The system still stutters, expecially when switching workspaces, but for sure it doesn't almost completely hang like it used to do. Thanks! This answer is so useful that IMO deserves a bounty (and I'm setting one).
    – kos
    Commented Dec 3, 2015 at 18:37
  • @kos It's not a complete solution, or I would certainly be much happier myself - I still stutter occasionally also, and find this to be very frustrating. Commented Dec 3, 2015 at 18:43

You must log in to answer this question.

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