Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using cp to copy data like so:

cp -r from_here to_there

When I do that, my computer freezes and unfreezes periodically. I have 4 CPUs installed and the HD is connected via SATA. from_here and to_there are both on the same file system so no network is used. The freezing is somehow dependent on the amount of files being copied. For a lot of files it is even impossible to sign in on the machine via ssh.

Is there a way to check why my OS freezes and unfreezes? Can I maybe tell cp to take it easy somehow?

share|improve this question

migrated from Jul 26 '11 at 12:43

This question came from our site for professional and enthusiast programmers.

You can use nice cp [arguments] (for CPU) or ionice cp [arguments] (for disk IO, on some systems), but that won't eliminate the root of your problems I guess (more info) – slhck Jul 26 '11 at 12:47
Is there a way to lower process priority (sorry, not a linux guy) – soandos Jul 26 '11 at 12:47
@slhck for ionice cp -r from_here to_there i get: none: prio 4 ionice: cannot parse number 'cp'. For nice cp -r 24 24m it simply starts copying and I do not get any feedback... – Woltan Jul 26 '11 at 12:57
try renicing the process once it's started. – Sirex Jul 26 '11 at 13:39
I just found out, that the process has a priority of 20. So it cannot get any lower than that. – Woltan Jul 26 '11 at 14:18

Depends on what version of kernel you are using. There was a bug in the kernel causing the machine to be unresponsive under I/O stress.

If you have a recent-enough kernel, just using ionice should be enough. I'm using ionice in conjunction with screen for background downloading and it works great (no impact on machine responsiveness).

screen -d -m ionice -c 3 io_heavy_cmd

share|improve this answer
I gave your recommendation a try and at first sight it seems to not block my computer anymore. I'll test this a little more until I accept the answer^^ – Woltan Jul 27 '11 at 6:48

You must log in to answer this question.

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