Setting disk read/write limits

Hello,
I am trying to set the read/write limit on the container. So, the container does not affect other containers

lxc config device set container root limits.read 30MB

Error: The device doesn’t exist

Any idea?

Regards,
Mangesh

The likely issue is that the root disk device exists in the profile(s) being applied to the container rather than the container’s own config (so the device cannot be modified directly on the instance).

If so, then you need to copy the root disk device into the container’s config and then modify it.

There is a shortcut command to do just this called override, e.g.:

lxc config device override container root limits.read=30MB

BTW I opened an issue to see if we can make the error clearer in the future:

Hi Thomas,

When I try to set up limits.read, I am getting error i.e.

lxc config device override container root limits.read 30MB
Error: No value found in “limits.read”

Hi Mangesh,
May be you can solve like that, you have to set the size of the root and then set the limit of the disk, like that.
lxc config device override container root size=10GB
lxc config device set container root limits.read 30MB

Regards.

Or you could have overriden both at once with lxc config device override container root size=10GB limits.read=30MB

Ohh, that’s perfect. Thanks @stgraber for the tip.
Regards.
One last thing, limits.read=30M should be 30MB, it is a typo.
Regards.

Fixed the typo :slight_smile: