3

LVM

Hey. First of all I want to say excuse me for my bad English. I a problem after installing CentOS 7 with LVM. Some space lost after problem with LVM configuration.

I tried to add some logical volume and to map it to folder /vdi. It had some error and I skipped, to do it after installation.

Now I have Logical Volume without LV Path and I have no idea what to do with it. The computer has 2 same disks, 250 GB.

PVDisplay :


 --- Physical volume ---

  PV Name               /dev/sda2
  VG Name               centos
  PV Size               136.48 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              34939
  Free PE               0
  Allocated PE          34939
  PV UUID               vsobHT-PuGe-0rvc-yvum-t9nz-LvIm-5dEHP8

  --- Physical volume ---

  PV Name               /dev/sdb1
  VG Name               centos
  PV Size               138.44 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              35439
  Free PE               0
  Allocated PE          35439
  PV UUID               8Wh85T-4JLh-Mx4n-d4u3-xZ9s-H4wn-9rI1OT

VGDisplay


  --- Volume group ---

  VG Name               centos
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  16
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                7
  Open LV               5
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               274.91 GiB
  PE Size               4.00 MiB
  Total PE              70378
  Alloc PE / Size       70378 / 274.91 GiB
  Free  PE / Size       0 / 0
  VG UUID               NVtlTj-8tx1-0rph-g8VA-TXXH-lFV2-k0zfdO

LVDisplay


  --- Logical volume ---

  LV Name                vdi
  VG Name                centos
  LV UUID                mwPyhU-r32l-J5Mj-EAIY-fLjL-dfXU-1vf1jc
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2015-12-18 19:41:58 +0200
  LV Pool metadata       vdi_tmeta
  LV Pool data           vdi_tdata
  LV Status              available
  # open                 5
  LV Size                251.46 GiB
  Allocated pool data    4.14%
  Allocated metadata     2.43%
  Current LE             64373
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

df

Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root ext4       55G   76M   52G   1% /
devtmpfs                devtmpfs  3.8G     0  3.8G   0% /dev
tmpfs                   tmpfs     3.8G     0  3.8G   0% /dev/shm
tmpfs                   tmpfs     3.8G  8.6M  3.8G   1% /run
tmpfs                   tmpfs     3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/mapper/centos-usr  ext4       92G  1.3G   86G   2% /usr
/dev/sda1               ext4      1.9G  147M  1.7G   9% /boot
/dev/mapper/centos-home ext4       92G  4.1G   83G   5% /home
/dev/mapper/centos-var  ext4      9.1G  136M  8.5G   2% /var
tmpfs                   tmpfs     773M     0  773M   0% /run/user/0}

I hope this information gives you an overview of the problem and somebody knows the solution. Thanks in advance.

5
  • 1
    Do you mean that you forgot to create a filesystem called /vdi using your volume group "centos"? If so, that is just lvcreate --name vdi --size nG centos n being the size in GB. Then format /dev/mapper/centos-vdi, create a mount point and mount it. After you verify it is good, add to /etc/fstab.
    – Aaron
    Dec 22, 2015 at 21:12
  • 1
    Perhaps pvs, vgs, and lvs would be more informative in this case to point out what do you consider missing space.
    – chexum
    Dec 22, 2015 at 21:20
  • Please run fdisk -l and show the output
    – Alaa Chatti
    Dec 23, 2015 at 9:35
  • Your info does not seem consistent. I see two ~138 GiB disks, sda and sdb, for a total of ~275 GiB on VG "centos", but I also see a LV called vdi with ~250 Gib and a df with ~275 GiB with no mention of the LV vdi. Please provide the output of pvs, vgs, lvs, you will probably find those easier to read.
    – Law29
    Dec 23, 2015 at 9:35
  • 1
    Jeka, you were correct to create an Answer with your solution. Please undelete that and remove your answer from this question. You can then accept your answer so we know the problem has been solved. Dec 29, 2015 at 23:16

3 Answers 3

1

Thanks for help , the lost space has found . I run fdisk -l and found that i need to create new partition on 2 disks , i created new partitions , after that i created 2 phisical volumes and added it to VG . And now i can use the space . One problem doesn't solved . I still see Logical Volume VDI but i can't do nothing with it .

Wed Dec 30 05:52:28 root@oldpc:/dev/centos#lvdisplay centos/vdi
  --- Logical volume ---
  LV Name                vdi
  VG Name                centos
  LV UUID                mwPyhU-r32l-J5Mj-EAIY-fLjL-dfXU-1vf1jc
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2015-12-18 19:41:58 +0200
  LV Pool metadata       vdi_tmeta
  LV Pool data           vdi_tdata
  LV Status              available
  # open                 5
  LV Size                251.46 GiB
  Allocated pool data    4.14%
  Allocated metadata     2.43%
  Current LE             64373
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

****

Wed Dec 30 06:00:35 root@oldpc:/dev/centos#ls -l
total 0
lrwxrwxrwx. 1 root root 7 Dec 24 06:14 home -> ../dm-7
lrwxrwxrwx. 1 root root 7 Dec 24 06:14 newone -> ../dm-9
lrwxrwxrwx. 1 root root 7 Dec 24 06:14 root -> ../dm-4
lrwxrwxrwx. 1 root root 7 Dec 24 06:14 swap -> ../dm-0
lrwxrwxrwx. 1 root root 7 Dec 24 06:14 usr -> ../dm-5
lrwxrwxrwx. 1 root root 7 Dec 24 06:14 var -> ../dm-8

Wed Dec 30 06:25:08 root@oldpc:/dev/centos#lvs
  LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home   centos Vwi-aotz--  93.13g vdi         6.02
  newone centos -wi-a-----  15.75g
  root   centos Vwi-aotz--  65.88g vdi         1.63
  swap   centos -wi-ao----   7.45g
  usr    centos Vwi-aotz--  93.13g vdi         3.25
  var    centos Vwi-aotz--   9.31g vdi         7.43
  vdi    centos twi-aotz-- 251.46g             4.14   2.43
0
0

Because you already have your vdi logical partition created (or seems to), you should mount it and give format (I added the steps).

But your information doesn't look consistent and there is something wrong. You cannot have an vdi of 250GB inside a VG (centos) of 270GB and also 4 other more Logical Volumes inside of centos of 55 + 92 + 92 + 9.1 = 248.1GB. Your vdi could be as much as 30GB. But, this should be the theorical steps.

Firstly, give format to it:

sudo mkfs.ext4 /dev/centos/vdi

Then, mount it:

sudo mkdir /mnt/vdi
sudo mount /dev/centos/vdi /mnt/vdi

If you want it permanently after booting, modify /etc/fstab

echo '/dev/centos/vdi /mnt/vdi ext4 defaults 0 0' >> sudo tee -a /etc/fstab
0

Your deleted self-answer had this lvs output:

LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
home   centos Vwi-aotz--  93.13g vdi         6.02
newone centos -wi-a-----  15.75g
root   centos Vwi-aotz--  65.88g vdi         1.63
swap   centos -wi-ao----   7.45g
usr    centos Vwi-aotz--  93.13g vdi         3.25
var    centos Vwi-aotz--   9.31g vdi         7.43
vdi    centos twi-aotz-- 251.46g             4.14   2.43

The Attr field is an important clue: the vdi LV is not an ordinary LV, but is used as a thin volume pool, as indicated by the t as the first character in the Attr field. Only the swap and newone LVs are classic (thick-provisioned) LVs. All the rest are thin volumes as indicated by the upper-case V as the first letter in the Attr field.

So, the home, root, usr and var LVs all live within the vdi.

man lvcreate says:

Thin pools (for thin provisioning) and cache pools (for caching) are represented by special LVs with types thin-pool and cache-pool (see lvmthin(7) and lvmcache(7)). The pool LVs are not usable as standard block devices, but the LV names act as references to the pools.

Thin LVs are thinly provisioned from a thin pool, and are created with a virtual size rather than a physical size.

This thin provisioning mechanism allows for efficient snapshotting, and also allows the virtual sizes of the thin volumes to exceed the actual size of the thin volume pool LV, as long as the total amount of actually used disk space on the thin LVs is below the actual size of the thin volume pool LV.

Since the thin LVs get their actual storage space allocated incrementally, the flip-side is that the thin LVs can become fragmented at the LVM level.

The command to create new thin LVs would be:

lvcreate -n <name> -V <size> --thinpool vdi centos

As soon as the sum of the virtual sizes of the thin LVs within the vdi thin-pool becomes larger than the actual size of the thin-pool, you will be over-committing disk space.

If something suddenly causes the actual usage to surge so that there will be not enough space in the thin-pool (i.e. the Data% value for the vdi thin-pool in the lvs output reaches 100%), you'll have data space exhaustion. What happens then depends on configuration; according to the lvmthin(7) man page, the default is that the write operations will be queued for up to 60 seconds (adjustable), in the expectation that something is set up to automatically extend the thin-pool. If this extension does not actually happen, LVM will report a write failure to the filesystem; at this point, the filesystem may lose unsynced user data, and if the filesystem is non-journaled, it may become corrupt.

So, you very much don't want that. If you plan to over-commit, then at the very least you should set up monitoring to alert someone to add a new disk and extend the thin-pool LV well before it becomes 100% full.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .