Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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've got 2 LXC containers with these cgroup settings:

lxc.cgroup.blkio.weight = 200
lxc.cgroup.cpu.shares = 200


lxc.cgroup.blkio.weight = 800
lxc.cgroup.cpu.shares = 800

I have verified in /sys/fs/cgroup/blkio/lxc/test1-lxccontainer/blkio.weight is indeed set to 200 on the host OS.

I have verified that cpu.shares are split up 80% to container 1 and 20% to container 2.

But when I run this command in both containers:

# write a 10GB file to disk
dd bs=1M count=10000 if=/dev/zero of=1test conv=fdatasync

I ran a similar test on reads:

davidparks21@test-cgroups1:/tmp$ time sh -c "dd if=1test of=/dev/null bs=1M"
10000+0 records in
10000+0 records out
10485760000 bytes (10 GB) copied, 37.9176 s, 277 MB/s

real    0m37.939s
user    0m0.004s
sys     0m24.306s

The IO speeds see in iotop on the host OS are virtually the same between the two containers.

I expected to see container 2 command 80% of the IO access in this case.

share|improve this question
up vote 3 down vote accepted

The problem here is that you need to use the fair scheduler, I was using the wrong scheduler, and had mis-read a setting (thought I was using fair scheduler, but really wasn't). Swapping to the correct IO scheduler fixed the problem.

To change the IO scheduler (taken from here):

echo cfq > /sys/block/{DEVICE-NAME}/queue/scheduler
share|improve this answer
Notes on how to do that would enhance the answer. – ivotron Dec 8 '14 at 6:18
Added the link on changing the IO scheduler, it's straight forward. – David Parks Dec 8 '14 at 20:43

It may be a dd command problem with your system cache have you tried to flush your cache first :

echo 3 > /proc/sys/vm/drop_caches

And launching dd command with "nocache" option ?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.