Gpart Resize Partition [repack] May 2026

A key concept is that a partition is merely a defined range of sectors on a disk. Resizing involves either growing the partition into unallocated space immediately following it or shrinking the partition by moving its end boundary inward. The operation is only possible if the adjacent space is free. Moreover, gpart modifies the partition table, but it resize the file system inside the partition. Consequently, any resize operation must be paired with an appropriate file system resize command (e.g., growfs for UFS or zfs online expand for ZFS). Prerequisites and Critical Preparations Before executing any gpart resize command, a prudent administrator must take several preparatory steps. First and foremost is data backup . Although gpart is mature and reliable, an unexpected power loss or kernel panic during a partition table write can corrupt the partition layout, rendering data inaccessible. A full backup or, at minimum, a snapshot of critical data is non-negotiable.

In the realm of operating systems, few tasks are as universally daunting yet routinely necessary as disk partition management. Whether a server is running out of space on a critical file system or a workstation needs to reallocate unused capacity from one volume to another, the ability to resize partitions is a cornerstone of system administration. For users of FreeBSD, the native gpart utility serves as the definitive tool for this purpose. Unlike Linux’s more fragmented ecosystem of tools ( fdisk , gdisk , resize2fs , etc.), gpart provides a unified, scriptable, and highly reliable command-line interface for managing partitioning schemes, including the all-important task of resizing. This essay provides a comprehensive exploration of resizing partitions with gpart , covering its underlying concepts, the prerequisites for a safe operation, a step-by-step procedural guide, and common pitfalls. Understanding gpart and Partition Layouts gpart is the primary partition management utility in FreeBSD, designed to handle modern partitioning schemes such as MBR (Master Boot Record) and, more commonly, GPT (GUID Partition Table). Unlike logical volume managers (LVMs) that offer flexible, online resizing, gpart operates directly on the physical or virtual disk’s partition table. This fundamental difference means that resizing with gpart is not as simple as changing a number; it requires careful attention to disk geometry, partition alignment, and the file system contained within the partition. gpart resize partition

Another pitfall is sector alignment. Modern disks use 4K sectors, and gpart aligns partitions to 1 MB boundaries by default. When resizing manually with -s , specifying a size that does not respect alignment can degrade performance. Always use gpart show to view the current alignment and ensure new sizes are multiples of the alignment value. A key concept is that a partition is

Second, the administrator must inspect the current partition layout. The command gpart show ada0 (assuming ada0 is the target disk) displays partitions, their indices, start sectors, sizes, and, crucially, any free space. For a successful grow operation, there must be unallocated sectors immediately after the target partition. For a shrink operation, the partition must have enough internal free space within its file system to allow the truncation without data loss. Moreover, gpart modifies the partition table, but it

Finally, administrators sometimes forget to update bootcode after moving or resizing a boot partition. While resizing does not typically affect bootcode location, moving a partition’s start sector (which gpart resize never does—it only changes the end sector) would require re-installing the bootloader. The gpart resize command is an indispensable tool in the FreeBSD administrator’s arsenal, offering precise, low-level control over disk partitions. While it does not possess the abstraction and flexibility of a logical volume manager, its directness and reliability make it the standard for managing GPT and MBR layouts. Successful resizing demands a clear understanding of the distinction between partition table manipulation and file system resizing, rigorous preparation including backup and unmounting, and careful execution of a sequence tailored to either growth or shrinkage. By respecting these principles and using gpart in conjunction with growfs or ZFS equivalents, administrators can safely and effectively reallocate disk space, extending the life of legacy systems and optimizing storage utilization without costly downtime or data loss. The power of gpart lies not in flashy features, but in its disciplined, deterministic approach to one of system administration’s most critical tasks.