TL;DR: Hard drive has physical partitions (physical volumes), which can be assigned to logical volume groups, which can be devided to logical volumes, which can be somehow mapped as disk, which can be mounted to linux directories. using an example:
/dev/sda(hard drive) -> /dev/sda2(partition) -> centos(volume group) -> /dev/centos/root -> /dev/mapper/centos-root -> /
and the commands used are:fdisk -l
-> vgdisplay
-> lvdisplay
-> df -h
I’d like to increase the general space of my vmware virtual host. After allocating more space (1GB) to the host by modifying the configuratiton on vmware, I feel confused.
When installing CentOS, I used its default setting. This is the current situation:
1 | [root@cluster01 ~]# df -h |
As can be seen, whatever mapping to “/“ has limited space left.
1 | [root@cluster01 ~]# fdisk -l |
I am honestly dazzled by this info, what I can gather is:
Disk /dev/sda: 32.2 GB
this looks like the size of the physical disk/dev/sda2 2099200 41943039 19921920 8e Linux LVM
this looks like a device using the physical diskDisk /dev/mapper/centos-root: 18.2 GB
whatever it is, this is what’s mapped to “/“ folder
At this point, I naturally want to move space from 1 to 3. After some googling, the following is what I do:
- Create a new primary partition, making it a “linux lvm” type:
1 | [root@cluster01 ~]# fdisk /dev/sda |
What I do here is to create a new partition which takes all the free space, and then change its type to “8e”(code for “linux lv”)
1 | [root@cluster01 ~]# fdisk -l |
- After rebooting, allocating space to volume group
1 | [root@cluster01 ~]# vgdisplay |
- Allocating free space from volume group to logical volume
1 | [root@cluster01 ~]# lvdisplay |
- resize the volume:
1 | [root@cluster01 ~]# df -h |