2

we have some red-hat servers with the following details ( when OS disk size is 230G )

# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 230G 0 disk ├─sda1 8:1 0 1G 0 part /boot/efi ├─sda2 8:2 0 1G 0 part /boot └─sda3 8:3 0 228G 0 part ├─VG100-lv_root 253:0 0 20G 0 lvm / ├─VG100-lv_swap 253:1 0 16G 0 lvm [SWAP] └─VG100-lv_var 253:2 0 30G 0 lvm /var fdisk -l Disk /dev/sda: 193.3 GB, 193273528320 bytes, 377487360 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: 0x00000000 Device Boot Start End Blocks Id System /dev/sda1 1 209715199 104857599+ ee GPT 

the Goal is to increase the /var and root filesystem based on that disk size is 230G when current /var is 30G and root filesystem is 20G

so, we start with the following procedure that should gives us enough PFREE or enough “Physical Free” space.

parted /dev/sda resizepart 3 100% Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)? parted: invalid token: 3 Fix/Ignore/Cancel? sgdisk -e /dev/sda 

note - sgdisk: The simplest way to fix the backup GPT table is by using the sgdisk command with the -e option, which moves the backup GPT data structures to the end of the disk

parted /dev/sda resizepart 3 100% Information: You may need to update /etc/fstab. partprobe /dev/sda pvresize /dev/sda Failed to find physical volume "/dev/sda". 0 physical volume(s) resized or updated / 0 physical volume(s) not resized 

but from pvs Pfree is still 0

# pvs PV VG Fmt Attr PSize PFree /dev/sda3 VG100 lvm2 a-- 66.00g 0 

any idea about other approach that able to increase the /var and root filesystem partitions?

more info

# vgs VG #PV #LV #SN Attr VSize VFree VG100 1 3 0 wz--n- <228.00g <162.00g 

we also try this ( for example )

lvextend -l +100%FREE -r /dev/mapper/VG100-lv_root Size of logical volume VG100/lv_root unchanged from 20.00 GiB (5120 extents). Logical volume VG100/lv_root successfully resized. xfs_growfs /dev/mapper/VG100-lv_root 

but the size of root filesystem is the same

df -h | grep VG100-lv_root /dev/mapper/VG100-lv_root 20G 3.8G 17G 19% / pvs PV VG Fmt Attr PSize PFree /dev/sda3 VG100 lvm2 a-- 66.00g 0 
2
  • What is the result of command vgs? Commented Aug 6, 2024 at 4:18
  • 1
    see the vgs output ( i Update the post ) Commented Aug 6, 2024 at 4:46

2 Answers 2

1

With the commands above you try to extend the partitions. And your partitions already allocate entire disks. Seems like you want to extend the logical volume which is mounted as root (/). To do this you need to execute the command:

lvextend -l +100%FREE -r /dev/mapper/VG100-lv_root 

This will extend VG100-lv_root volume to use the entire free space from VG. Also -r will extend the filesystem.

But my strong recommendation is to be more moderate and add for example 20-30GB to the volume and keep the rest of the space unused. And only in case of need extend the volumes. As this command (above) can be run on mounted filesystem and will work on the fly you do not need to care about downtime. From other side if you want to shrink / you need to boot from live CD, shrink filesystem and then shrink volume (so you have downtime). And some filesystems can't be shrinked (like XFS for example).

8
  • I try it but the same results please take look on my post Commented Aug 6, 2024 at 6:06
  • @KingDavid, as you can see the LV do not extend: "Size of logical volume VG100/lv_root unchanged" And last pvs command give strange result, 66.00g, compared to 228G and from fdisk: "Disk /dev/sda: 193.3 GB". For me something is messed with the partitions. The most simple way is to backup and start from scratch. Commented Aug 6, 2024 at 6:19
  • @KingDavid, and as LVM see 66GB (already allocated) it can't extend the volume Commented Aug 6, 2024 at 6:24
  • so you means that Psize should be the max like the disk as - 228G? Commented Aug 6, 2024 at 6:40
  • @KingDavid, correct, the size of PV should be the size of the partition Commented Aug 6, 2024 at 6:58
0

Since your disk is partitioned, and the LVM PV is sda3, you must use that device in your pvresize command instead of just sda:

pvresize /dev/sda3 

Your pvresize /dev/sda told you it failed to achieve anything:

pvresize /dev/sda Failed to find physical volume "/dev/sda". 0 physical volume(s) resized or updated / 0 physical volume(s) not resized 

This is because the whole-disk device sda is not a LVM PV, and cannot possibly be made as such, as the disk needs to be a UEFI-bootable system disk.

After a successful pvresize, the pvs command should show a non-zero PFree value, and then the lvextend commands can succeed.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.