--- Extend Logical Volume ---
XFS - FS
Grow-XFS-root-xfs.html
Two similar ways to do this: [ONE] | [TWO] |
ONE - DEV not in Mapper TOP
Don't forget about the prod to dev machine relationship.
## Look at the physical device that was extended on VM
fdisk /dev/sda
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
## What does the partition table look like?
Command (m for help): p
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 7268CB07-6FD1-4B5B-8774-86ACE4CEF06D
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2101247 2097152 1G Linux filesystem
/dev/sda3 2101248 209713151 207611904 99G Linux filesystem
## How much free space
Command (m for help): F
Unpartitioned space /dev/sda: 100 GiB, 107375214080 bytes, 209717215 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
Start End Sectors Size
209713152 419430366 209717215 100G
## Make a new partition
Command (m for help): n
Partition number (4-128, default 4):
First sector (209713152-419430366, default 209713152):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (209713152-419430366, default 419430366):
Created a new partition 4 of type 'Linux filesystem' and of size 100 GiB.
## Write it out
Command (m for help): w
The partition table has been altered.
Syncing disks.
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 7268CB07-6FD1-4B5B-8774-86ACE4CEF06D
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2101247 2097152 1G Linux filesystem
/dev/sda3 2101248 209713151 207611904 99G Linux filesystem
/dev/sda4 209713152 419430366 209717215 100G Linux filesystem
## Extend the Volume Group with the new Partition
vgextend ubuntu-vg /dev/sda4
Physical volume "/dev/sda4" successfully created.
Volume group "ubuntu-vg" successfully extended
## Extend the the size of the Logical Volume that needs the space
lvextend --size 189G /dev/ubuntu-vg/ubuntu-lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from 95.00 GiB (24320 extents) to 189.00 GiB (48384 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
## Resize the filesysstem of the Logical Volume that was extended
resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks = 12, new_desc_blocks = 24
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 49545216 (4k) blocks long.
## Confirm that it worked.
df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv 186G 11G 167G 7% /
TWO - in Mapper [TOP]
https://www.thegeekdiary.com/how-to-grow-extend-xfs-filesytem-in-centos-rhel-using-xfs_growfs-command/
Once the partiton is ID'd that needs to be extended do ls -l /dev/mapper to get the LV name.
To extend the LUN: pvresize /dev/mapper/<cdLETTER>
Then find and caclulate the spare that can be used...
pvscan
lvscan
lvextend --size <Full Size to Extend To>G /dev/mapper/<Volumegroup-Logical Volumename>
resize2fs /dev/mapper/<Volumegroup-Logical Volumename>
For example...
lvextend --size 550G /dev/mapper/VolGroup01-u02
resize2fs /dev/mapper/VolGroup01-u02
if XFS
lvextend --size <Full Size to Extend To>G /dev/mapper/<Volumegroup-Logical Volumename>
/usr/sbin/xfs_growfs /<mount point>
For example...
lvextend --size 550G /dev/mapper/VolGroup01-u02
/usr/sbin/xfs_growfs /u02
Example of and Extend, Move, Reduce, Remove and Resize.
VG name : data
LV names: /dev/data/l05
/dev/data/l03
pvcreate /dev/mapper/cdd
vgextend data /dev/mapper/cdd
vgdisplay
pvmove -b /dev/mapper/cdc /dev/mapper/cdd
vgreduce data /dev/mapper/cdc
vgdisplay
lvextend --size 500G /dev/data/l05
resize2fs /dev/data/l05
lvextend --size 1500G /dev/data/l03
resize2fs /dev/data/l03
pvremove /dev/mapper/cdc
OLD
lvextend --size G /dev/mapper/
resize2fs /dev/mapper/
For example...
lvextend --size 550G /dev/mapper/VolGroup01-u02
resize2fs /dev/mapper/VolGroup01-u02
if XFS
/usr/sbin/xfs_growfs /
resize2fs /dev/mapper/
For example...
/usr/sbin/xfs_growfs /u02
resize2fs /dev/mapper/VolGroup01-u02
