Koozali.org: home of the SME Server

[ANNOUNCE] Increase the size of a smeserver VM HOWTO

Offline ldkeen

  • *
  • 401
  • +0/-0
[ANNOUNCE] Increase the size of a smeserver VM HOWTO
« on: November 02, 2006, 12:51:04 PM »
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:

Code: [Select]
"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

Code: [Select]
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:
Code: [Select]
#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):

Code: [Select]
#pvresize -v /dev/md2

Find out the number of Free PhysicalExtents (PE) using vgdisplay:

Code: [Select]
#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:

Code: [Select]
#lvresize -l +2186 /dev/main/root

Then resize the filesystem:

Code: [Select]
#ext2online -d -v /dev/main/root

Regards, Lloyd

Offline mudtoe

  • **
  • 60
  • +0/-0
[ANNOUNCE] Increase the size of a smeserver VM HOWTO
« Reply #1 on: November 07, 2006, 04:59:09 AM »
I've been away for a couple of weeks.  Looks like you've been busy  :wink:    

Your new procedure looks a lot easier than the earlier one, although the earlier one you walked me through worked just fine, and I haven't had any issues since then.  Would there be any reason that I would need to reconfigure my setup to get rid of the extra partitions?

mudtoe

Offline tariqf

  • ****
  • 179
  • +0/-0
Re: [ANNOUNCE] Increase the size of a smeserver VM HOWTO
« Reply #2 on: August 17, 2009, 10:56:59 AM »
Hi I tried this with smeserver 7.4 cd but I cannot find the pvresize command or it appears not to be available when I do a rescue boot from it!

How did you run "pvresize" from the rescue boot?

Offline byte

  • *
  • 2,183
  • +2/-0
Re: [ANNOUNCE] Increase the size of a smeserver VM HOWTO
« Reply #3 on: August 17, 2009, 12:35:48 PM »
How did you run "pvresize" from the rescue boot?

You don't run pvresize in the rescue environment. re-read Lloyds how-to and note this line:

Quote
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:
Code: [Select]
Code: [Select]
#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):

Code: [Select]
Code: [Select]
#pvresize -v /dev/md2

So your actually running pvresize command in the normal server routine.
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline tariqf

  • ****
  • 179
  • +0/-0
Re: [ANNOUNCE] Increase the size of a smeserver VM HOWTO
« Reply #4 on: August 17, 2009, 12:46:03 PM »
oops sorry my mistake! cheers

Offline frederikbay

  • **
  • 41
  • +0/-0
Re: [ANNOUNCE] Increase the size of a smeserver VM HOWTO
« Reply #5 on: July 20, 2010, 01:32:51 PM »
Hi All

Just a some info if you want to do this on SME 8

The last thing you do in the guide:
Code: [Select]
ext2online -d -v /dev/main/root
ext2online is not included in SME 8 - instead you can use this command:

Code: [Select]
resize2fs /dev/main/root
Hope is helps someone

Regards, Frederik


Offline len_chan

  • 8
  • +0/-0
    • Perceptus Solutions Inc.
Re: [ANNOUNCE] Increase the size of a smeserver VM HOWTO
« Reply #6 on: November 12, 2010, 01:05:31 AM »
I just did a "bare metal" restore from a DAR2 backup (actually from one Virtual Machine to a new Virtual Machine).  I picked the wrong initial disk space, so I had to figure out how to make the drive larger.

The instructions here with the fdisk trick didn't work for me, I got a kernel panic after doing the sme rescue portion.  Anyway, this turned into a good chance to play around with LVM - I tried to summarize my notes here:  http://blog.perceptus.ca/2010/11/11/changing-drive-size-sme-server/.  Hopefully someone else will find this useful.

Offline purvis

  • ****
  • 567
  • +0/-0
Re: [ANNOUNCE] Increase the size of a smeserver VM HOWTO
« Reply #7 on: November 14, 2010, 05:54:18 PM »
If you are using any solid state sata drives. Then it might be better tp
have dynamic drives in a vm

Offline ntblade

  • *
  • 252
  • +0/-0
Re: [ANNOUNCE] Increase the size of a smeserver VM HOWTO
« Reply #8 on: May 07, 2013, 12:33:05 PM »
Hi Sorry to dig up an old thread but it came up in a site / google search.

Just to say this worked for me when increasing the drive size (sme8) in a KVM machine on proxmox.  Thanks for this.

NTB