Resize a linux file system with resize2fs

On cloud servers, once you upgrade disk, you will need to resize the filesystem. On Linux ext4 file system, you can do this with command resize2fs.

To resize filesystem on /dev/sdb, run

root@leonestage:~# resize2fs /dev/sdb
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/sdb is mounted on /mnt/HC_Volume_2899894; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
The filesystem on /dev/sdb is now 10485760 (4k) blocks long.

root@leonestage:~#

Here the full disk is used as file system with NO partition. If you have partion, you need to specify partition number like /dev/sdb1

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *