Skip to content

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

102 Commits

Folders and files

Repository files navigation

hot-resize

A tool for hot resizing (without reboot) disk partitions and filesystems.

Rust

Features

  • 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

Prerequisites

Required System Dependencies

The following tools must be installed on your system:

  • sfdisk and partx (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.

Installing Dependencies by Distribution

NixOS

environment.systemPackages = with pkgs; [
  hot-resize
];

Debian/Ubuntu

sudo apt-get update
sudo apt-get install -y util-linux e2fsprogs xfsprogs btrfs-progs cryptsetup-bin

Fedora/RHEL/CentOS

sudo dnf install -y util-linux e2fsprogs xfsprogs btrfs-progs cryptsetup

Arch Linux

sudo pacman -S util-linux e2fsprogs xfsprogs btrfs-progs cryptsetup

openSUSE

sudo zypper install util-linux e2fsprogs xfsprogs btrfs-progs cryptsetup

Alpine Linux

sudo apk add util-linux e2fsprogs xfsprogs btrfs-progs cryptsetup

Installation

Via cargo

cargo install --path .

Manual build

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

Precompiled binaries are available in the Releases section.

Usage

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 resize
  • fs_type: Filesystem type (ext4, xfs, or btrfs)
  • 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"}
]'

Options

  • --dry-run: Simulate operations without making changes
  • --skip-verify: Skip verification after resizing

NixOS Integration

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.

Troubleshooting

Missing Dependencies

If you encounter errors regarding missing tools, use the --dry-run option to see which tools are needed for your configuration.

Permission Issues

The tool must be run with root privileges. Make sure you're using sudo or logged in as root.

LUKS Containers

For devices encrypted with LUKS, ensure that cryptsetup is installed and that devices are unlocked before running the tool.

License

This project is distributed under the GPL-3.0 license.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages