A tool for hot resizing (without reboot) disk partitions and filesystems.
- Hot resizing of partitions without rebooting
- Support for ext4, XFS, and Btrfs filesystems
- LUKS encrypted container support
- Automatic verification of required tools
- Simple command-line interface with JSON input
The following tools must be installed on your system:
sfdiskandpartx(typically in util-linux package)resize2fs(for ext4, typically in e2fsprogs)xfs_growfs(for XFS, typically in xfsprogs)btrfs(for Btrfs, typically in btrfs-progs or btrfs-tools)cryptsetup(optional, for LUKS support)
Device information (block device size, partition layout, filesystem detection) is read directly from sysfs and superblock magic bytes — no external tools are needed for that.
environment.systemPackages = with pkgs; [
hot-resize
];sudo apt-get update
sudo apt-get install -y util-linux e2fsprogs xfsprogs btrfs-progs cryptsetup-binsudo dnf install -y util-linux e2fsprogs xfsprogs btrfs-progs cryptsetupsudo pacman -S util-linux e2fsprogs xfsprogs btrfs-progs cryptsetupsudo zypper install util-linux e2fsprogs xfsprogs btrfs-progs cryptsetupsudo apk add util-linux e2fsprogs xfsprogs btrfs-progs cryptsetupcargo install --path .git clone https://github.com/liberodark/hot-resize.git
cd hot-resize
cargo build --release
sudo cp target/release/hot-resize /usr/local/bin/Precompiled binaries are available in the Releases section.
The tool requires root privileges:
sudo hot-resize --devices '[{"device":"/dev/vda1","fs_type":"ext4","mount_point":"/"}]'The --devices parameter accepts a JSON array containing:
device: Path to the device to resizefs_type: Filesystem type (ext4,xfs, orbtrfs)mount_point: Mount point of the filesystem
You can specify multiple devices in the same array:
sudo hot-resize --devices '[
{"device":"/dev/vda1", "fs_type":"ext4", "mount_point":"/"},
{"device":"/dev/vdb1", "fs_type":"xfs", "mount_point":"/data"}
]'--dry-run: Simulate operations without making changes--skip-verify: Skip verification after resizing
A NixOS module is available to integrate hot-resize directly into your configuration:
# Add to your configuration.nix
imports = [
./path/to/hot-resize-module.nix
];
services.hot-resize = {
enable = true;
skipVerify = false;
devices = [
{
device = "/dev/vda1";
fs_type = "ext4";
mount_point = "/";
}
];
};See the hot-resize-module.nix file for more details.
If you encounter errors regarding missing tools, use the --dry-run option to see which tools are needed for your configuration.
The tool must be run with root privileges. Make sure you're using sudo or logged in as root.
For devices encrypted with LUKS, ensure that cryptsetup is installed and that devices are unlocked before running the tool.
This project is distributed under the GPL-3.0 license.