I have cent-os 7 installed on an ssd with capacity 160GB. The Cent-os partitions only consume 20GB in total, such that when I run fdisk -l
this is my output:
Disk /dev/sda: 171.8 GB, 171798691840 bytes, 335544320 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: 0x000a2b1e
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 41943039 20458496 8e Linux LVM
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 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/centos-root: 18.8 GB, 18798870528 bytes, 36716544 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
When I try to run pvs
I get the following:
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 19.51g 0
What steps do I need to take in order to get CentOS to recognise the full 160GB physical volume, and then be able to either extend centos-root directly or first create another logical partition (of size 140GB), remove it and then allow centos-root to expand into the that space?
Apologies if my terminology is incorrect, I'm not a Linux expert.
Your physical volume is 19.51g with no free space (pvs results). So you first have to resize the physical volume.
Then you need to resize the logical volume centos-root to fill all the free space.
Now its time for the filesystem. Its not obvious what filesystem you are using but i bet that its either ext4 or xfs.
In the first case:
In the second case:
man lvm
andlvm --help
. And of course google "resize lvm".The physical partition
/dev/sda2
holds all the space, 171.8 GB, but you've only listed two volumes totaling about 21 GB. You should be able to resize/dev/mapper/centos-root
to hold all of the available space. If this is a default centos 7 install, the bulk of the space was assigned to/dev/mapper/centos-home
and mounted as/home
. Butfdisk -l
does not show this so maybe you did a custom install? There's LVM commands to list and manipulate the Physical volumes, Volume Groups and Logical Volumes.This may be as simple as a lvm extend volume command. If you do go that route, be sure you use the switch to expand the filesystem too. It'll save you some heartache.
Here's an excellent tutorial on how to create PV, VG and LV on CentOS/RHEL7. Read through that and then google how to resize a volume.