Expand Disk Space - Virtual Machine

configuration
freepbx
Tags: #<Tag:0x00007f70254cec48> #<Tag:0x00007f70254ceae0>

(Steve) #1

Hello

I am currently testing FreePBX running on an EC2 instance on Amazon AWS.

To migrate onto AWS I first setup FreePBX as a virtual machine on my desktop using VirtualBox and I allocated a relatively small hard drive size. I then exported the VM and uploaded it as an image onto AWS so I could spin up an instance. When I created the AWS instance I gave it a 200GB hard drive. However, the FreePBX server still thinks it has an 8GB hard drive.

Does anyone have any information on how best to expand into the full 200GB.

Below are a few commands that may help profile more information on the setup:


[root@pbx02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/SangomaVG-root 7.1G 3.9G 3.2G 56% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 8.0K 1.9G 1% /dev/shm
tmpfs 1.9G 153M 1.8G 9% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/xvda1 1.9G 127M 1.7G 7% /boot
tmpfs 379M 0 379M 0% /run/user/0
tmpfs 379M 0 379M 0% /run/user/995
[root@pbx02 ~]#


[root@pbx02 ~]# fdisk -l

Disk /dev/xvda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000aa2c4

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 * 2048 4098047 2048000 83 Linux
/dev/xvda2 4098048 20971519 8436736 8e Linux LVM

Disk /dev/mapper/SangomaVG-root: 7562 MB, 7562330112 bytes, 14770176 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/SangomaVG-swaplv1: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@pbx02 ~]#


[root@pbx02 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root SangomaVG -wi-ao---- 7.04g
swaplv1 SangomaVG -wi-ao---- 1.00g
[root@pbx02 ~]#

Thanks


(Enzo) #2

Hi,

I’m not sure why you use lvm over virtual environment, anyway think it was planning as well, the correct should be separate as lv the partition that you think will be grown more and not just root, if you do of this way you might extend the volume on the fly but in this case root is mounted by the system by this you need to unmount first.

I don’t know if in aws is possible but you need the boot with a iso in single user or multi-user mode, it’s depends of your distro version assumes that it based on rhel, then extend this logical volume root to reach the size desired using lvextend tool.

Other option think that can be mount this disk in other server and follow the before steps.

My advice before to start, please do ever a backup.

Good look.


(Dakolta) #3

These are the step I used on my EC2 instance on AWS with it live:

fdisk /dev/xvda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p

Disk /dev/xvdf: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ca471

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 * 2048 4098047 2048000 83 Linux
/dev/xvda2 4098048 20971519 8436736 8e Linux LVM

Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 is deleted

Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (4098048-209715199, default 4098048):
Using default value 4098048
Last sector, +sectors or +size{K,M,G} (4098048-209715199, default 209715199):
Using default value 209715199
Partition 2 of type Linux and of size 98 GiB is set

Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): 8e
Changed type of partition ‘Linux’ to ‘Linux LVM’

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

partprobe

pvdisplay --maps
— Physical volume —
PV Name /dev/xvda2
VG Name SangomaVG
PV Size <8.05 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 2059
Free PE 91
Allocated PE 1968
PV UUID 1LmtJa-KYIp-RQqe-90JF-eysD-4HQx-Mg0x2N

— Physical Segments —
Physical extent 0 to 1711:
Logical volume /dev/SangomaVG/root
Logical extents 0 to 1711
Physical extent 1712 to 1967:
Logical volume /dev/SangomaVG/swaplv1
Logical extents 0 to 255
Physical extent 1968 to 2058:
FREE

pvresize /dev/xvdf2
Physical volume “/dev/xvda2” changed
1 physical volume(s) resized / 0 physical volume(s) not resized

pvdisplay --maps
— Physical volume —
PV Name /dev/xvda2
VG Name SangomaVG
PV Size 98.04 GiB / not usable 2.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 25099
Free PE 23131
Allocated PE 1968
PV UUID 1LmtJa-KYIp-RQqe-90JF-eysD-4HQx-Mg0x2N

— Physical Segments —
Physical extent 0 to 1711:
Logical volume /dev/SangomaVG/root
Logical extents 0 to 1711
Physical extent 1712 to 1967:
Logical volume /dev/SangomaVG/swaplv1
Logical extents 0 to 255
Physical extent 1968 to 25098:
FREE

You will need the Physical extent start and ending for the swap
to get the starting block take the ending block from Physical extent of the free space and subtract 255

pvmove --alloc anywhere /dev/xvda2:1721-1967 /dev/xvda2:24843-25098
/dev/xvdf2: Moved: 0.00%
/dev/xvdf2: Moved: 97.17%
/dev/xvdf2: Moved: 100.00%

vgdisplay
— Volume group —
VG Name SangomaVG
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
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 98.04 GiB
PE Size 4.00 MiB
Total PE 25099
Alloc PE / Size 1968 / <7.69 GiB
Free PE / Size 23131 / <90.36 GiB
VG UUID HPP92b-Wzg7-zBe4-AC4q-ZXxg-DB3u-NldSTv

lvextend -L 90.36G /dev/SangomaVG/root
Rounding size to boundary between physical extents: 90.36 GiB.
Size of logical volume SangomaVG/root changed from <6.69 GiB (1712 extents) to 90.36 GiB (23133 extents).
Logical volume SangomaVG/root successfully resized.

xfs_growfs /dev/SangomaVG/root
meta-data=/dev/mapper/SangomaVG-root isize=512 agcount=4, agsize=438272 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=1753088, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 1753088 to 23688192


PBX Low on space? Apply config and reload fails
(system) closed #4

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.