Expanding a Partition
Expanding a Partition
Good day CentOS masters
I currently have a CentOS system that I need to expand a certain Partition on. It is a VM with three (3) VMDKs the second one is a 1.5 TB drive that is sdb
sdb 1.5TB
datavg-pgdata 400GB lvm /opt/data/inv/pgdata-9.6
datavg-inv 4GB lvm /opt/data/jlg/inv
datavg-mdldata 550GB lvm /opt/data/inv/mdl
data-vg-enrolldata 50GB lvm /opt/data/inv/enroll_audio
As you can see the drive itself is 1.5 TB, but according to the lsblk command only 1004GB (1.004TB) is being used which should give me close to 500GB free, I need to expand the datavg-pgdata Logical Volume (lvm) because it is at 93 percent, But I am not seeing where my system actually says I can use that potential "free space". I am not an expert at any Linux based O/S by any stretch of the imagination so I am not even sure if this is the proper way to read it. Can anyone tell me the best way to A. know if I can actually use the potential free space on sdb. Or, how to expand that lvm another way?
the vgs command display
VG #PV #LV #SN Attr VSize VFree
backupvg 1 1 0 wz--n- <500.00g <100.00g
centos 1 3 0 wz--n- <119.00g 4.00m
datavg 1 4 0 wz--n- <1024.00g <20.00g
ENTIRE lsblk command
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 120G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 119G 0 part
├─centos-root 253:0 0 50G 0 lvm /
├─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
└─centos-home 253:2 0 61.1G 0 lvm /home
sdb 8:16 0 1.5T 0 disk
├─datavg-pgdata 253:3 0 400G 0 lvm /opt/data/inv/pgdata-9.6
├─datavg-inv 253:4 0 4G 0 lvm /opt/data/jlg/inv
├─datavg-mdldata 253:5 0 550G 0 lvm /opt/data/inv/mdl
└─datavg-enrolldata 253:6 0 50G 0 lvm /opt/data/inv/enroll_audio
sdc 8:32 0 500G 0 disk
└─backupvg-mdlbackup 253:7 0 400G 0 lvm /backup/mdlbackup
sr0 11:0 1 1024M 0 rom
FDSIK -l for sdb
Disk /dev/sdb: 1649.3 GB, 1649267441664 bytes, 3221225472 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
I currently have a CentOS system that I need to expand a certain Partition on. It is a VM with three (3) VMDKs the second one is a 1.5 TB drive that is sdb
sdb 1.5TB
datavg-pgdata 400GB lvm /opt/data/inv/pgdata-9.6
datavg-inv 4GB lvm /opt/data/jlg/inv
datavg-mdldata 550GB lvm /opt/data/inv/mdl
data-vg-enrolldata 50GB lvm /opt/data/inv/enroll_audio
As you can see the drive itself is 1.5 TB, but according to the lsblk command only 1004GB (1.004TB) is being used which should give me close to 500GB free, I need to expand the datavg-pgdata Logical Volume (lvm) because it is at 93 percent, But I am not seeing where my system actually says I can use that potential "free space". I am not an expert at any Linux based O/S by any stretch of the imagination so I am not even sure if this is the proper way to read it. Can anyone tell me the best way to A. know if I can actually use the potential free space on sdb. Or, how to expand that lvm another way?
the vgs command display
VG #PV #LV #SN Attr VSize VFree
backupvg 1 1 0 wz--n- <500.00g <100.00g
centos 1 3 0 wz--n- <119.00g 4.00m
datavg 1 4 0 wz--n- <1024.00g <20.00g
ENTIRE lsblk command
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 120G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 119G 0 part
├─centos-root 253:0 0 50G 0 lvm /
├─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
└─centos-home 253:2 0 61.1G 0 lvm /home
sdb 8:16 0 1.5T 0 disk
├─datavg-pgdata 253:3 0 400G 0 lvm /opt/data/inv/pgdata-9.6
├─datavg-inv 253:4 0 4G 0 lvm /opt/data/jlg/inv
├─datavg-mdldata 253:5 0 550G 0 lvm /opt/data/inv/mdl
└─datavg-enrolldata 253:6 0 50G 0 lvm /opt/data/inv/enroll_audio
sdc 8:32 0 500G 0 disk
└─backupvg-mdlbackup 253:7 0 400G 0 lvm /backup/mdlbackup
sr0 11:0 1 1024M 0 rom
FDSIK -l for sdb
Disk /dev/sdb: 1649.3 GB, 1649267441664 bytes, 3221225472 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
Re: Expanding a Partition
What happens if you run pvresize /dev/sdb ? Might want to read the man page for pvresize before you run that to find out what it does.
CentOS 8 died a premature death at the end of 2021 - migrate to Rocky/Alma/OEL/Springdale ASAP.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke
Re: Expanding a Partition
Trevor
I havd not done that and after I did run the command (after taking two snapshots of my VM) my PVS command prints
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <119.00g 4.00m
/dev/sdb datavg lvm2 a-- <1.50t <532.00g
/dev/sdc backupvg lvm2 a-- <500.00g <100.00g
And my VGS command does show a change from 1024GB to 1.5TB My free space expanded considrably
VG #PV #LV #SN Attr VSize VFree
backupvg 1 1 0 wz--n- <500.00g <100.00g
centos 1 3 0 wz--n- <119.00g 4.00m
datavg 1 4 0 wz--n- <1.50t <532.00g
[
Thnak you for that, I did not even consider the pvresize, Now I just need to expand the datavg-pgdata lvm, can you give me a push on that portion of it?
sdb 8:16 0 1.5T 0 disk
├─datavg-pgdata 253:3 0 400G 0 lvm /opt/data/inv/pgdata-9.6
├─datavg-inv 253:4 0 4G 0 lvm /opt/data/jlg/inv
├─datavg-mdldata 253:5 0 550G 0 lvm /opt/data/inv/mdl
└─datavg-enrolldata 253:6 0 50G 0 lvm /opt/data/inv/enroll_audio
I havd not done that and after I did run the command (after taking two snapshots of my VM) my PVS command prints
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <119.00g 4.00m
/dev/sdb datavg lvm2 a-- <1.50t <532.00g
/dev/sdc backupvg lvm2 a-- <500.00g <100.00g
And my VGS command does show a change from 1024GB to 1.5TB My free space expanded considrably
VG #PV #LV #SN Attr VSize VFree
backupvg 1 1 0 wz--n- <500.00g <100.00g
centos 1 3 0 wz--n- <119.00g 4.00m
datavg 1 4 0 wz--n- <1.50t <532.00g
[
Thnak you for that, I did not even consider the pvresize, Now I just need to expand the datavg-pgdata lvm, can you give me a push on that portion of it?
sdb 8:16 0 1.5T 0 disk
├─datavg-pgdata 253:3 0 400G 0 lvm /opt/data/inv/pgdata-9.6
├─datavg-inv 253:4 0 4G 0 lvm /opt/data/jlg/inv
├─datavg-mdldata 253:5 0 550G 0 lvm /opt/data/inv/mdl
└─datavg-enrolldata 253:6 0 50G 0 lvm /opt/data/inv/enroll_audio
Re: Expanding a Partition
man lvresize
Probably something like lvresize -L+250G -r datavg/pgdata
adjusting amount to add (the + in the -L+ says add to, if missing it will resize it _down_ to 250GB in my example!)
Probably something like lvresize -L+250G -r datavg/pgdata
adjusting amount to add (the + in the -L+ says add to, if missing it will resize it _down_ to 250GB in my example!)
CentOS 8 died a premature death at the end of 2021 - migrate to Rocky/Alma/OEL/Springdale ASAP.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke
Re: Expanding a Partition
Trevor
Thanks again, It worked perfectly. I had read all that you suggested, But the fact that the drive said one thing but the software said another really confused me and I did not want to do anything unless I was absolutely sure. I appreciate you giving me the reassurance!
Thanks again, It worked perfectly. I had read all that you suggested, But the fact that the drive said one thing but the software said another really confused me and I did not want to do anything unless I was absolutely sure. I appreciate you giving me the reassurance!
Re: Expanding a Partition
The difference could be that some is counted in TB (1E12) and some in TiB (2^40 = 1.0995E12).
Re: Expanding a Partition
I am not familiar with those units of measure for size, can you explain the difference?
Re: Expanding a Partition
Here's an explanation: https://en.wikipedia.org/wiki/Byte#Multiple-byte_units
Re: Expanding a Partition
Those of us old enough to remember know that a computer megabyte was always 1024x1024 bytes then someone from the international standards organisation put their oar in and said that 'mega' was already used and meant 1000x1000 so we all had to tear up our definition of MB and rewrite it as MiB (not Men in Black!). Same for KB, GB and TB which now all have to have an i in them to mean what everyone used to already know.


CentOS 8 died a premature death at the end of 2021 - migrate to Rocky/Alma/OEL/Springdale ASAP.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke
Re: Expanding a Partition
I think it had more to do with hard drive manufacturers wanting people to think there was more space on the hard drives they were selling.TrevorH wrote: ↑2023/04/28 16:56:21Those of us old enough to remember know that a computer megabyte was always 1024x1024 bytes then someone from the international standards organisation put their oar in and said that 'mega' was already used and meant 1000x1000 so we all had to tear up our definition of MB and rewrite it as MiB (not Men in Black!). Same for KB, GB and TB which now all have to have an i in them to mean what everyone used to already know.
![]()