We've expanded our news coverage and improved our search!
for the latest or search for all things across O'Reilly!
Managing Disk Space with LVM
simple logical volume extension
Good article, guys. I've used this guide as a reference on several occasions. Thanks.
I ran across a simple use case that wasn't explicitly covered in the article, but I was able to piece together the required commands from various examples in the article. I thought I'd share concisely.
- A single disk (/dev/sda), partitioned to a Physical Volume (/dev/sda2) in an active Volume Group (VolGroup00), and allocated to a Logical Volume (/dev/VolGroup00/LogVol00)
- An active filesystem (ext3) mounted (/) on that Logical Volume, where more disk space is required
- No RAID involved
- To add disk space (/dev/sdb) to the mounted filesystem (/)
- Partition the disk (/dev/sdb1), mark as type 8e
# fdisk /dev/sdb
- Create the physical volume
# pvcreate /dev/sdb1
- Extend the volume group by adding the new physical volume
# vgextend VolGroup00 /dev/sdb1
- Check the new volume group size
# vgdisplay | grep "VG Size"
- Extend the logical volume to the new total available
# lvextend -L 28G /dev/VolGroup00/LogVol00
- Find the filesystem mount point
- Perform an online resize of the filesystem to the max available
# ext2online -v /dev/mapper/VolGroup00-LogVol00
- Now check your disk free
# df -h