Koozali.org: home of the SME Server
Obsolete Releases => SME Server 9.x => Topic started by: HACKERSOFT2011 on February 17, 2021, 09:35:24 AM
-
Hi!
My smeserver main storage running on ESXI is now at around 90% full so I've decided to increase the virtual disk size to 700G.
My question is, how can I safely resize the LVM partition to fully use the available disk space in smeserver 9?
[root@sme1 ~]# fdisk -l
Disk /dev/sda: 834.3 GB, 834297397248 bytes
255 heads, 63 sectors/track, 101430 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00058d80
Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 256000 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 27414 219943936 8e Linux LVM
Disk /dev/mapper/main-root: 221.1 GB, 221060792320 bytes
255 heads, 63 sectors/track, 26875 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/main-swap: 4160 MB, 4160749568 bytes
255 heads, 63 sectors/track, 505 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/md0: 262 MB, 262127616 bytes
2 heads, 4 sectors/track, 63996 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@sme1 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/main-root
212359480 179197592 22367904 89% /
tmpfs 16439996 0 16439996 0% /dev/shm
/dev/md0 243759 78959 152004 35% /boot
[root@sme1 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/main/root
LV Name root
VG Name main
LV UUID gq2kwk-uImZ-q2y3-Qfcb-8Y5f-K6WI-Rdsc3H
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-12-17 15:10:27 +0700
LV Status available
# open 1
LV Size 205.88 GiB
Current LE 52705
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/main/swap
LV Name swap
VG Name main
LV UUID jozvKK-HOpP-OUzz-a3Vn-6Vax-khYC-VbRGBw
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-12-17 15:11:19 +0700
LV Status available
# open 1
LV Size 3.88 GiB
Current LE 992
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@sme1 ~]# vgdisplay
--- Volume group ---
VG Name main
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 209.75 GiB
PE Size 4.00 MiB
Total PE 53697
Alloc PE / Size 53697 / 209.75 GiB
Free PE / Size 0 / 0
VG UUID lSFJF6-9BzE-aB8a-50yM-Jnux-0Uaj-ufIbf0
Thank you in advance for your help!
-
Stacks of howto resize lvm around.
This was my first hit
https://www.rootusers.com/lvm-resize-how-to-increase-an-lvm-partition/
Note IIRC it is usually recommended to run "no lvm/no raid" on virtual machines.
-
I've already tried that prior to posting a question here but it does not see the remaining free space:
[root@sme1 ~]# vgdisplay
--- Volume group ---
VG Name main
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 209.75 GiB
PE Size 4.00 MiB
Total PE 53697
Alloc PE / Size 53697 / 209.75 GiB
Free PE / Size 0 / 0
VG UUID lSFJF6-9BzE-aB8a-50yM-Jnux-0Uaj-ufIbf0
Free PE/Size = 0
But as you can see from below, the drive is now 834.3GB:
[root@sme1 ~]# fdisk -l
Disk /dev/sda: 834.3 GB, 834297397248 bytes
255 heads, 63 sectors/track, 101430 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00058d80
Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 256000 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 27414 219943936 8e Linux LVM
Disk /dev/mapper/main-root: 221.1 GB, 221060792320 bytes
255 heads, 63 sectors/track, 26875 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/main-swap: 4160 MB, 4160749568 bytes
255 heads, 63 sectors/track, 505 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/md0: 262 MB, 262127616 bytes
2 heads, 4 sectors/track, 63996 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
-
lvextend -L + xG /dev/mapper/main-root
xfs_growfs /dev/mapper/main-root
-
I've done this but is still can't resize it to max free:
[root@sme1 ~]# lvextend -l +100%FREE /dev/main/root
[root@sme1 ~]# lvresize -l +100%FREE /dev/main/root
[root@sme1 ~]# resize2fs /dev/main/root
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 53969920 blocks long. Nothing to do!
-
Okay, I ended up downloading gparted live iso and extended it from there, restarted back to smeserver then run the following commands in order:
lvextend -l +100%FREE /dev/mapper/main-root
lvresize -l +100%FREE /dev/mapper/main-root
resize2fs /dev/main/root
and voila!
[root@sme1 ~]# vgdisplay
--- Volume group ---
VG Name main
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 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 776.75 GiB
PE Size 4.00 MiB
Total PE 198849
Alloc PE / Size 198849 / 776.75 GiB
Free PE / Size 0 / 0
VG UUID lSFJF6-9BzE-aB8a-50yM-Jnux-0Uaj-ufIbf0
-
Cool.
I'd take a look at v10 Beta 1 and if you are on a hypervisor lose the LVM. Think it save a bit of overhead, and resize issues ;-)
Remember it isn't like running real hardware where you need to add disks and increase the LVM.
You can just increase the VM size, resize the partition table and expand the file system. It is MUCH easier without LVMs (done it loads of times on my Prox servers)
-
FYI - v10 defaults to a LVM install. You should be able to change that if you use the manual partitioner during install.
We are looking at ways to change/disable it during install like the old no raid/no lvm options, but no guarantees on that yet.
-
Yep, when installing sme10 using the graphic installer you can delete the partition scheme that kickstart has created and created a custom one with no lvm, test vm running with this now, just a basic setup
[root@smenolvm ~]# fdisk -l
Disk /dev/sda: 16.1 GB, 16106127360 bytes, 31457280 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: 0x000e3af4
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 26367999 13182976 83 Linux
/dev/sda2 26368000 29296639 1464320 82 Linux swap / Solaris
[root@smenolvm ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
devtmpfs devtmpfs 2014268 0 2014268 0% /dev
tmpfs tmpfs 2022520 12 2022508 1% /dev/shm
tmpfs tmpfs 2022520 8780 2013740 1% /run
tmpfs tmpfs 2022520 0 2022520 0% /sys/fs/cgroup
/dev/sda1 xfs 13172736 2608240 10564496 20% /
tmpfs tmpfs 404504 0 404504 0% /run/user/0
-
and there are those quicker on the gun than me
just redid mine, ext2 for /boot and ext4 for /
:-)
-
xfs_growfs /dev/mapper/main-root
That would only work on an xfs file system, but v9 is ext4.
CentOS7 defaults to xfs though there is some debate whether we use that or stick with ext4 for v10.
See the bug tracker for details.