After adding some new storage to the backup system at work, I needed a way to transfer the roughly 400GB of backups to the new installation – without the use of a USB disk or another server (would take way too long). So after installing CentOS 5.3 with LVM2 enabled, I dedicated the better part of 1TB to the new backup storage on the new hard drive.
After mounting the old storage, I copied the old archives to the new LVM storage and did the following.
Prepping partition for LVM ∞
Use fdisk to change the partition type to ‘Linux LVM’, hex code ‘8e’: fdisk /dev/sdb
Then create the structure needed for use with LVM on the new partition: pvcreate /dev/sdb1
Finally, add the new LVM partition to the LVM caches by letting the automated scan picking it up: vgscan
Now to actually append the new partition to the storage pool: vgextend VolGroup00 /dev/sdb1
Adding to LVM ∞
If you run vgdisplay
, you should now see the space you just added as free space in the LVM storage pool.
You can now add the free space to one or more storage volumes that need it: lvextend -L +353.5G /dev/VolGroup00/LogVolBackups
Finally, let the filesystem on the drive resize to fill the new space: resize2fs /dev/VolGroup00/LogVolBackups
And there we go, 353.5GiB added to the LVM2 storage. Now next time I won’t think twice to use LVM2.