Resize2fs

From LQWiki
Jump to navigation Jump to search

resize2fs is a command that allows you to resize an ext2 filesystem or an ext3 filesystem. You typically do this when you find out that having separate partitions on your hard disk is only hindering. You cannot resize a mounted ext2 filesystem. The linux 2.6++ kernel supports on-line resizing of mounted ext3 filesystems.

To unmount your / filesystem, best restart your computer from a live CD.

 resize2fs [ -fFpPM ] [ -d debug-flags ] [ -S RAID-stride ] device [s size ]

Note that older versions do not support all options.

Example:

To resize a mounted lvm filesystem, unmount it, check the filesystem, resize the filesystem to its minimimum size (-M option), reduce the number of extents and remount

 umount /dev/myGroup/myVol
 e2fsck -f /dev/myGroup/myVol
 resize2fs -M /dev/myGroup/myVol
 lvreduce /dev/myGroup/myVol
 mount /dev/myGroup/myVol

See also