3

I want to remove one partition from LVM. df -h reports a 46GB of free space:

Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   58G   13G   46G  23% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  9.1M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1               1014M  261M  754M  26% /boot
VBoxShared               466G  278G  189G  60% /media/sf_VBoxShared
tmpfs                    379M  4.0K  379M   1% /run/user/42
tmpfs                    379M   48K  379M   1% /run/user/1000

However for some reason all LVM thinks that I have no free space - here is output from pvs -o+pv_used:

  PV         VG     Fmt  Attr PSize   PFree Used   
  /dev/sda2  centos lvm2 a--   <9.00g    0   <9.00g
  /dev/sda3  centos lvm2 a--  <20.00g    0  <20.00g
  /dev/sda5  centos lvm2 a--  <30.00g    0  <30.00g

Because of this pvmove /dev/sda5 fails with error "No extents available for allocation.". What happened with my system and how to fix this?

For reference, here is output of fdisk -l (I have resized physical volume in VirtualBox by adding extra 20GB there):

Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 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: 0x000c178c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    20971519     9436160   8e  Linux LVM
/dev/sda3        20971520    62914559    20971520   8e  Linux LVM
/dev/sda4        62914560   125829119    31457280    5  Extended
/dev/sda5        62916608   125829119    31456256   8e  Linux LVM

Disk /dev/mapper/centos-root: 62.3 GB, 62264442880 bytes, 121610240 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-swap: 1073 MB, 1073741824 bytes, 2097152 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 have CentOS 7.5.

0

You are confusing the physical volume and the logical volume.

You create a volume group, made of physical volumes (disks/partitions), which can be made into one or more logical volumes (mountable "disks").

You are out of extents. This is saying your PV is fully allocated. Which based off what you said, is correct. When you run df, you can see the LV consumption level, whuch gas some usage and some soare space.

Things are working the way it should.

0

If I understand what you are saying correctly, /dev/sda originally was around 66GB in size. You then added 20GB to /dev/sda to now make it around 86GB, yes?

If so, did you grow any of the partitions, or create a new partition? Your physical volumes are partitions on /dev/sda. Adding space to /dev/sda, but not increasing a partition or creating a new partition to add to the centos volume group means LVM will not see the extra space.

I recommend either resizing /dev/sda5 so it sees the extra space, or create a new partition, /dev/sda6, and adding that to the volume group.

If you resize, you will need to do a pvscan for LVM to see the extra space.

If you add, you will need to do a vgextend to add the new physical volume.

1
  • He didn't add space, but if he did, he must have grown the partition b/c it shows up in df -h.
    – dllahr
    Dec 10 '20 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.