Introduction to embiggen-disk
The embiggen-disk project is a software tool designed for dynamically resizing filesystems without requiring downtime. It achieves this by sequentially resizing necessary elements underneath the filesystem, including Logical Volume Manager (LVM) logical volumes (LV) and physical volumes (PV), as well as partition tables formatted with either Master Boot Record (MBR) or GUID Partition Table (GPT).
How It Works
The primary feature of embiggen-disk is its capability to adjust the size of a filesystem in real time. This feature is essential for system administrators who want to expand storage space without taking the system offline. The tool intelligently resizes components in a layered approach:
- Partition Table Adjustment: Starts by modifying the partition size if necessary.
- LVM PV and LV Expansion: Following the partition table, LVM elements are resized to accommodate the increased capacity.
- Filesystem Resizing: Finally, the filesystem itself is enlarged to utilize the newly available space.
Practical Example
Consider the following command execution:
# embiggen-disk /
Upon running the tool, users might observe changes such as:
- Increase in the size of a partition, for example,
/dev/sda3
. - Logical and physical volumes under the LVM system, such as
/dev/mapper/debvg-root
, are expanded as needed. - The final target, an ext4 filesystem at the root directory
/
, is resized to gain additional blocks of storage.
If run again with no changes needed:
# embiggen-disk /
No changes made.
This outcome indicates that the filesystem and its underlying structures are already at optimal sizes concerning the current physical disk constraints.
Installation
To use embiggen-disk, users need to install it based on their version of Go:
- For Go version 1.15 and earlier, use:
$ go get github.com/bradfitz/embiggen-disk
- For Go version 1.16 and later, the installation command is:
$ go install github.com/bradfitz/embiggen-disk@latest
Requirements and Compatibility
The tool's requirements include:
- Go Programming Language: Version 1.7 or newer.
- Linux Kernel: Version 3.6 or later, due to its reliance on the
BLKPG_RESIZE_PARTITION
operation for partition resizing.
Although it has been primarily tested on 64-bit x86 Linux systems, known as "amd64", it is expected to work on other Linux-based architectures.
Caution
Before implementing this utility, users are advised to either review the source code or backup their disk. This precaution helps mitigate the risk of potential data loss during the resizing process.
The embiggen-disk tool provides a crucial function for administrators needing to manage storage flexibly and efficiently in a live environment, ensuring systems continue to run smoothly with minimal interruptions.