Increase the size of a smeserver Virtual Machine HOWTO
Author(s) Lloyd Keen, David Biczo
SCOPE
This document describes the procedure to increase the size of a single disk smeserver V7.0 setup running in a VMware virtual machine. The vm has a fixed size disk as opposed to a "growable" disk. As usual "All care taken but no responsiblity accepted". This document was written for our benefit only - if you can gain any benefit from it all well and good.
Procedure
Resize the vmware virtual disk:
"Path\to\vmware-vdiskmanager.exe" -x 10GB -t 1 "C:\Virtual Machines\Red Hat Enterprise Linux 4\Red Hat Enterprise Linux 4 (3).vmdk"
Where "-x 10GB" is the total size of the new disk. Reboot the smeserver, then delete partition /dev/sda2 and recreate using the extra disk space as shown below. This doesn't destroy the data - it just modifies the partiton table with info about the new free space.
[root@guru ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 8855.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-8855, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-8855, default 8855):
Using default value 8855
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): fd
Changed system type of partition 2 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
At this point we've just wiped out the superblock from /dev/sda2, so the raid device (/dev/md2) wont start if we reboot, we need to now boot into resuce mode from the smeserver CD-Rom and rewrite the superblock:
Procedure:
Hold down the shift key while booting from the smeserver CD. At the command prompt type "sme rescue". No need to start the network and "skip" mounting the filesysytem. At the command prompt type the following:
#mdadm --create /dev/md2 --level 1 --raid-devices=2 /dev/sda2 missing
Type exit and remove the CD then boot into the smeserver system. Now we have to resize the PhysicalVolume (PV):
#pvresize -v /dev/md2
Find out the number of Free PhysicalExtents (PE) using vgdisplay:
#vgdisplay
--- Volume group ---
VG Name main
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 204.78 GB
PE Size 32.00 MB
Total PE 6553
Alloc PE / Size 4367 / 136.47 GB
Free PE / Size 2186 / 68.31 GB
VG UUID Btsy6N-bwJ8-koAc-UKVh-M5wm-9mBD-JIvPU2
From the above we can see that we have 2186 Free Physical Extents, so lets go ahead and add them to the LogicalVolume using lvresize:
#lvresize -l +2186 /dev/main/root
Then resize the filesystem:
#ext2online -d -v /dev/main/root
Regards, Lloyd