This article details how to grow or expand an ext2, ext3, ext4 file system using resize2fs. resize2fs does not alter the size of partitions, to do this refer to How to Resize a File System with fdisk.
- A created partition that you know the name of. To check the name, run cat /etc/fstab. The first field is the name of the partition.
- A created file system. If you need to create a new file system refer to the *How to Create a File System with mkfs* [LINK TO COME] article
1. If the partition the file system is on is currently mounted, unmount it.
~]# umount /dev/vdb1
2. Run fsck on the unmounted file system.
~]# e2fsck /dev/vdb1 e2fsck 1.41.12 (17-May-2010) Pass 1:Checking inodes, blocks, and sizes Pass 2:Checking directory structure Pass 3:Checking directory connectivity Pass 4:Checking reference counts Pass 5:Checking group sumary information ext4-1:11/131072 files (0.0% non-contiguous),27050/524128 blocks
3. Resize the file system with the resize2fs /dev/device command.
~]# resize2fs /dev/vdb1 resize2fs 1.41.12 (17-May-2010) Resizing the filesystem on /dev/vdb1 to 524128 (1k) blocks. The filesystem on /dev/vdb1 is now 524128 blocks long.
Accepted size units for file system block sizes are:
S - 512 byte sectors
K - kilobytes
M - megabytes
G - gigabytes
4. Mount the file system and partition.
~]# mount /dev/vdb1 /ext4-1
man resize2fs – man page for resize2fs that contains information on what resize2fs is, what it supports, and the various options it takes.