Disk expansion - CentOS
-
I have a VPS that I just upgraded to a larger disk of 40 GB. Can someone walk me through the process of exactly how to expand the partition below (mainly vda2) to make use of the larger disk?
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 1024M 0 rom vda 252:0 0 40G 0 disk ├─vda1 252:1 0 300M 0 part /boot ├─vda2 252:2 0 24G 0 part / └─vda3 252:3 0 768M 0 part [SWAP]
-
No LVM?
-
Those are partitions, you have major issues here. You will have to remove the swap partition completely, and then you will need to blow away the partition table LIVE while the system is running and create a new one that lines up exactly where the old one used to be. I've done this, it's risky and foolish, but it can be done.
-
You have not mentioned your filesystem, which matters a bit. Once the new partition is made, you can then use your filesystem's commands to expand into the newly created partition.
-
Obviously, the recommended procedure is to move to a new VM and not expand this one.
-
This is a test FPBX box that was installed from the ISO, snapshoted, and then restored to a larger VPS.
# mount /dev/vda2 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw) /dev/vda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
-
As a general practice for a case like this, start by removing the swap partition and moving to swap file instead. Way more flexible.
-
Consider just making a new partition for whatever it is you plan to store that needs all of this space. I can only imagine that you want loads of voicemails or something? Make them their own filesystem.
-
@scottalanmiller said in Disk expansion - CentOS:
As a general practice for a case like this, start by removing the swap partition and moving to swap file instead. Way more flexible.
This is the way it is setup from the FPBX installer. Perhaps there are more options to check out in the installer. (like to use LVM) I'll have to look.
-
@scottalanmiller said in Disk expansion - CentOS:
Consider just making a new partition for whatever it is you plan to store that needs all of this space. I can only imagine that you want loads of voicemails or something? Make them their own filesystem.
Yeah, I probably won't NEED all of that extra space, but was just looking to use all available space that I'm paying for on the VPS and keep it "clean".
-
@fuznutz04 said in Disk expansion - CentOS:
@scottalanmiller said in Disk expansion - CentOS:
Consider just making a new partition for whatever it is you plan to store that needs all of this space. I can only imagine that you want loads of voicemails or something? Make them their own filesystem.
Yeah, I probably won't NEED all of that extra space, but was just looking to use all available space that I'm paying for on the VPS and keep it "clean".
In which case, split out the voicemail and call it a day. Other than voicemails and logs, FreePBX has no need for more space, it's stateless beyond those functions.
-
So it looks like the default installer doesn't default to LVM. I'm running another install now to see if advanced options allows me to do it.
-
So choosing advanced install, and choosing to use the entire disk, then uses LVM and chooses the following layout:
[root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 40G 0 disk ├─sda1 8:1 0 500M 0 part /boot └─sda2 8:2 0 39.5G 0 part ├─VolGroup-lv_root (dm-0) 253:0 0 37.6G 0 lvm / └─VolGroup-lv_swap (dm-1) 253:1 0 2G 0 lvm [SWAP] sr0 11:0 1 1024M 0 rom
-
@fuznutz04 Much better.
-
@scottalanmiller said in Disk expansion - CentOS:
@fuznutz04 Much better.
That's crazy. I've even used a VPS provider that specializes in FPBX hosting, and their default partitioning scheme (which you cannot change, it is done automatically) is this:
lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 1024M 0 rom vda 252:0 0 60G 0 disk ├─vda1 252:1 0 59G 0 part / └─vda2 252:2 0 1G 0 part [SWAP]
-
@fuznutz04 said in Disk expansion - CentOS:
@scottalanmiller said in Disk expansion - CentOS:
@fuznutz04 Much better.
That's crazy. I've even used a VPS provider that specializes in FPBX hosting, and their default partitioning scheme (which you cannot change, it is done automatically) is this:
"Specialize" might be a strong term there.
-
So playing with the advanced options some more, I can customize this exactly how I need. Default on the advanced installer is setup like the following:
Are you suggesting to customize it further, removing the lv_swap?
-
Swap on LVM is fine. Ext4 is fine. FreePBX basically does nothing with storage, so fine tuning it is not very practical, beyond having LVM of course. That's not fine tuning, that's just basic good installation.
-
@scottalanmiller said in Disk expansion - CentOS:
Swap on LVM is fine. Ext4 is fine. FreePBX basically does nothing with storage, so fine tuning it is not very practical, beyond having LVM of course. That's not fine tuning, that's just basic good installation.
But what about other workloads? Would you still recommend the same if it was lets say, a wordpress box using Mariadb, or any other similar workload?
-
@fuznutz04 said in Disk expansion - CentOS:
@scottalanmiller said in Disk expansion - CentOS:
Swap on LVM is fine. Ext4 is fine. FreePBX basically does nothing with storage, so fine tuning it is not very practical, beyond having LVM of course. That's not fine tuning, that's just basic good installation.
But what about other workloads? Would you still recommend the same if it was lets say, a wordpress box using Mariadb, or any other similar workload?
No, partially because they are not static in the same way, they depend on disk performance. FreePBX does not. Also, your FreePBX is on a version about to be replaced with one that is vastly updated. So lots of tuning for things like the filesystem that are already addressed in the upcoming release doesn't seem fruitful.