Resizing /tmp on Red Hat 5.3 (ext3, LVM)

This is how to do a simple file system increase in Logical Volume Manager. For example, increasing /tmp from 512 Mb to 1 Gb.

/tmp is a logical volume:

# df -h /tmp
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg00-tmpvol
                      496M   19M  452M   4% /tmp

Running “vgdisplay /dev/vg00” showed that volume group vg00 contained 3.5 Gb of free space. Extended the logical volume with lvextend:

# lvextend -L +512m /dev/mapper/vg00-tmpvol
  Extending logical volume tmpvol to 1.00 GB
  Logical volume tmpvol successfully resized

Then resized the file system inside it with resize2fs. Resize2fs handles ext2 and ext3 file systems (and ext4 where that is available).

# resize2fs /dev/mapper/vg00-tmpvol
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/vg00-tmpvol is mounted on /tmp; on-line resizing required
Performing an on-line resize of /dev/mapper/vg00-tmpvol to 1048576 (1k) blocks.
The filesystem on /dev/mapper/vg00-tmpvol is now 1048576 blocks long.

Df now reports the new file system size:

# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg00-tmpvol
                       1015496     19352    943754   3% /tmp

Footnote

resize2fs supersedes the older and inferior ext2online, which has been removed in Red Hat 5 onwards.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.