cgcreate
Create new control groups
TLDR
Create a new [g]roup
Create a new [g]roup with multiple cgroup types
Create a subgroup
SYNOPSIS
cgcreate [-g <controllers>:<path> ...] [-f] [-t <task-ids>] [-v] [-x]
PARAMETERS
-g controllers:path
Comma-separated controllers (e.g., cpu,memory) and relative path where cgroup is created. Multiple -g options allowed for different controllers/paths.
-f
Force creation of parent cgroups if they do not exist.
-t task-ids
Comma-separated list of task IDs (PIDs) to move into the new cgroup after creation.
-v
Enable verbose output for detailed operation logging.
-x
Proceed even if some specified controllers are not mounted; skip them.
DESCRIPTION
cgcreate is a command-line utility from the libcgroup package designed to create new control groups (cgroups) for managing and limiting resource usage of processes in Linux. Cgroups organize processes hierarchically, allowing allocation and control of resources like CPU, memory, I/O, and network bandwidth across subsystems (controllers).
Usage typically involves specifying controllers and a relative path with -g, creating corresponding directories under /sys/fs/cgroup/<controller>/<path>. For instance, cgcreate -g cpu,memory:/production establishes cgroups for both cpu and memory controllers at path /production.
Multiple -g options support complex hierarchies. The -t option moves specified tasks (PIDs) into the new cgroup immediately after creation. Verbose output (-v) aids debugging, while -x skips unmounted controllers.
Primarily for cgroup v1 hierarchies, cgcreate requires mounted cgroup filesystems. It complements tools for attaching processes and setting limits, enabling fine-grained resource policies in containers or service isolation.
In modern systems with cgroup v2 (unified hierarchy), systemd supplants these tools, rendering cgcreate legacy.
CAVEATS
Fails if target cgroup already exists (no overwrite option). Requires cgroup v1 filesystems mounted. Parent cgroups must exist unless -f used. Deprecated on cgroup v2 systems managed by systemd.
EXAMPLE
cgcreate -g cpu,memory:/myapp
Creates /sys/fs/cgroup/cpu/myapp and /sys/fs/cgroup/memory/myapp.
cgcreate -g blkio:/data -t 1234
Creates blkio cgroup and moves PID 1234 into it.
FILES
Operates on /sys/fs/cgroup/* directories. Check mounts with mount | grep cgroup.
HISTORY
Developed in the libcgroup project (2007-2008) for cgroup v1 support. Actively used pre-2015; maintenance waned as kernel adopted cgroup v2 (2016+) and systemd integrated native management.
SEE ALSO
cgdelete(1), cgexec(1), cgclassify(1), cgrulesengd(8), systemd-cgtop(1)


