LinuxCommandLibrary

pct-resize

Resize container filesystem

TLDR

Resize the container size to 20GB

$ pct [[resi|resize]] [100] rootfs 20G
copy

Add 10GB to the container storage
$ pct [[resi|resize]] [100] rootfs +10G
copy

SYNOPSIS

pct resize <vmid> <disk> <size>

PARAMETERS

<vmid>
    The unique integer ID of the Proxmox LXC container to resize.

<disk>
    The identifier of the disk to resize. Commonly rootfs for the primary disk, or mp0, mp1, etc., for additional mount points configured in the container's configuration.

<size>
    The target size for the disk. This can be an absolute size (e.g., 8G for 8 Gigabytes, 512M for 512 Megabytes) or a relative change (e.g., +2G to add 2 Gigabytes, -1G to reduce by 1 Gigabyte). The unit (G for Gigabytes, M for Megabytes) is required.

DESCRIPTION

The pct resize command is part of the Proxmox Container Toolkit (PCT) and is used to modify the allocated disk space for Linux Container (LXC) virtual machines within a Proxmox Virtual Environment (PVE) host.

It allows administrators to expand or shrink the size of a container's virtual disk, such as its primary filesystem (rootfs) or additional mount points (mpX). When resizing the rootfs, pct resize typically handles the underlying filesystem expansion (for ext4 and xfs) automatically, making it a convenient tool for dynamic resource management of unprivileged containers.

CAVEATS

Proxmox VE Requirement: This command is specific to Proxmox Virtual Environment and is not a standard Linux utility found on non-Proxmox systems.

Container State: While rootfs resize often works with the container running, it is generally safer to stop the container before performing resize operations, especially for shrinking or for other mount points.

Filesystem Consistency: For rootfs, pct resize attempts to grow/shrink the filesystem automatically for common types (ext4, xfs). For other mount points (mpX), only the underlying block device is resized; you must manually resize the filesystem inside the container using tools like resize2fs or xfs_growfs.

Shrinking Risks: Shrinking a disk carries a higher risk of data loss. It typically requires shrinking the filesystem inside the container first, and then shrinking the underlying block device via pct resize. Always back up critical data before shrinking operations.

HISTORY

pct resize is an integral part of the Proxmox Container Toolkit (PCT), developed by Proxmox Server Solutions GmbH. It was introduced as part of the pct command-line utility to simplify the management of LXC containers within Proxmox VE, evolving with the platform to provide robust disk management capabilities for container storage.

SEE ALSO

pct(1), lxc(7), resize2fs(8), xfs_growfs(8)

Copied to clipboard