Skip to content

Instantly share code, notes, and snippets.

@tfiskgul
Created May 25, 2018 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfiskgul/6f4e468fb99e46eb15c41b9a616c629d to your computer and use it in GitHub Desktop.
Save tfiskgul/6f4e468fb99e46eb15c41b9a616c629d to your computer and use it in GitHub Desktop.
systemd background io slice for defragmentation, scrub, deduplication etc
[Unit]
Description=Background slice with much lower system (particularly IO) impact
Before=slices.target
[Slice]
# CPU
# cgroup v1. The allowed range is 2 to 262144. Defaults to 1024.
CPUShares=10
# IO, cgroup v1.
BlockIOAccounting=yes
BlockIOWeight=10
# FIXME: Make this dynamic with a generator
BlockIOReadBandwidth=/dev/sda 2M
BlockIOReadBandwidth=/dev/sdb 2M
BlockIOReadBandwidth=/dev/sdc 2M
# These limits only apply to synchronous writes (O_SYNC)
BlockIOWriteBandwidth=/dev/sda 2M
BlockIOWriteBandwidth=/dev/sdb 2M
BlockIOWriteBandwidth=/dev/sdc 2M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment