Increase hard drive space in hyper-V

Hi All,

So, I’m NOT that clever with FreePBX yet - My friend set mine up for me and my folks.

So, I have a hyper-V set to 20Gb (Not good) - It filled up the other day and stopped working. Thankfully I had a copy of the VHD file and I got the system back up and going in 5 or so mins.

However, I want to increase the HDD space from say 20Gb to 100Gb on the Hyper-V. I tried to expand it there and it killed the image. So, in silly simple insructions - Could someone tell me how to increase the HDD capacity of the hyper-V virtual free PBX hard drive please.

Many thanks
John

This is a Hyper-V issue not a FreePBX issue. How you expand the disk space on Hyper-V is a Hyper-V thing.

You need to add disk space, and also probably mess with the partitions.

My opinion: upgrade all nodules to the latest version, take a full backup, download a clean image (same version as you are currently running) do a fresh install on a new VM (remember to give enough space) and retrieve from backup.

Hi -

Excuse me ignorance, - How do I get the backup off and then back in on new image (I too had this thought)

I attempted a backup last night and killed the PBX stone dead. - (I have my friend re making a new one with more space).

But for future use it would be great to know how to get the backup OFF and back ON to the machine.

John

If your PBX was full, then you obviously had to free up some space for the backup to be saved…

This wiki explains everything.

https://wiki.freepbx.org/display/FPG/Using+the+Backup+module

** As with all things Hyper-V, before you do anything, make a backup of the VHD and then if you screw anything up, you can just switch back to the old VHD, All instructions past this point will assume you have a GOOD backup! **

Stretching a drive in Hyper-V is fairly Simple - shut down the machine, go into Properties of the VHD(x) and choose Edit:

Then choose Expand:

Finally, pick a new size for the Drive:

When this is done, you will have a larger drive - BUT - your Partitions on the drive will be the same size they were before - the drive will just be bigger.

On a standard Load, partitions are laid down like so:

[root@pbx-bdc ~]# fdisk -l

Disk /dev/sda: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0008fd94

Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 8257 66014208 83 Linux
/dev/sda3 8257 8355 786432 82 Linux swap / Solaris
[root@pbx-bdc ~]#

If you look at the Start and End you will see that the partitions are actually laid down like this on the Drive:

/boot
/
/swap

This is a problem - because the Swap is AFTER the root (/) partition - so you will need to nuke the existing swap, extend the root but make sure you leave enough space for swap, and then recreate the swap - Here is a guide I have used in the past to increase partitions sizes:

Again, because you are working with a backup, you can proceed with confidence.

You may also need to edit your /etc/fstab after you are done:

https://www.centos.org/forums/viewtopic.php?t=9209

If this seems like too much, the Backup-And-Restore might be simpler.