Resizing an Ext File System

Resize an Ext file system by using the resize2fs command.

Before resizing an Ext file system, the underlying block device, volume, or file image must have appropriate space to hold the file system if you're increasing the file system size.

Note that you can increase the size of an Ext file system without unmounting the file system first, but decreasing the size of the file system requires that you unmount the file system first. In general, it's good practice to unmount the file system, if possible, regardless of the operation.

See the resize2fs(8) manual page for more information.

  1. Unmount the file system that you intend to resize.
    sudo umount /mnt
    Although not necessary when increasing the file system size, unmounting any file systems on the device ensures data integrity during the resizing process:
  2. Check file system integrity.
    sudo e2fsck -f /dev/sda1
  3. Resize the file system by using the resize2fs command.
    sudo resize2fs /dev/sda1

    If you don't specify a size parameter, the file system is sized to match the space on the underlying block device. To specify a size, you can use unit suffixes to allocate space in kilobytes (K), megabytes (M), or gigabytes (G). For example:

    sudo resize2fs /dev/sda1 120G
  4. Remount the file system.
    If you unmounted the file system earlier, remount it now:
    mount /dev/sda1 /mnt 
  5. Verify the new file system size using the df command.
    df -h /mnt