I have a few templates that I use when deploying Linux based VMs around here. These come pretty stripped down and minimalist. Getting them up to a usable system is fairly quick with vmware.
But I just made it a bit quicker with my latest template.
The use of LVM is pretty slick for disk type stuff and I was amazed how simple it was to resize and work with the system and other disks. I have just stream-lined my disk growing process by locating the swap space on a LV rather than out on a separate disk partition. This makes the growing of a system disk especially quick and simple.
- Do the initial low level work with
fdisk /dev/sda. This will be resizing only /dev/sda2 to the max cylinders. Reboot to sync new partitions. - Now we just have to run pvresize and lvresize.
> pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [14.88 GB / 0 free]
Total: 1 [14.88 GB] / in use: 1 [14.88 GB] / in no VG: 0 [0 ]
> pvresize /dev/sda2
Physical volume "/dev/sda2" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
> lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [10.97 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [3.91 GB] inherit
> lvresize -l +100%FREE /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 27.97 GB
Logical volume LogVol00 successfully resized
> lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [27.97 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [3.91 GB] inherit
By placing the swap on the same PV as the / we don't have to muck with moving the swap around any longer. And
by using the -l +100%FREE option on the lvresize command it lets lvresize do the work of giving us
the whole chunk of new disk.
Well it speed thing up a little anyway..
Posted by Kevin Foote in work on October 27, 2009

