1

I have Linux Mint 17.2 codename Rafaela running as a virtual machine with a disk size of 30GB. I used the default LVM installation. I would like now to create a physical volume /dev/drbd0 to use it in a DRBD setup, but I did not understand how exactly I could do that. Also, I wouldn't like to destroy the file system, since this is the second time I install Linux and I'm a little short on time. Also, I would like to understand why the mint-vg volume group displays a free size of only 52 MiB when pvdisplay is issued but shows 21GB are available as output for df -h?

pvdisplay output:

--- Physical volume ---
  PV Name               /dev/mapper/sda5_crypt
  VG Name               mint-vg
  PV Size               29,76 GiB / not usable 4,00 MiB
  Allocatable           yes 
  PE Size               4,00 MiB
  Total PE              7617
  Free PE               13
  Allocated PE          7604
  PV UUID               lMa6qR-lcub-lDGA-vnas-SXKi-lUE8-1eavVm

vgdisplay output:

--- Volume group ---
  VG Name               mint-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               29,75 GiB
  PE Size               4,00 MiB
  Total PE              7617
  Alloc PE / Size       7604 / 29,70 GiB
  Free  PE / Size       13 / 52,00 MiB
  VG UUID               Gr7p0B-BeP0-Lb2e-s7dR-V1ae-h2xB-gKWBLC

lvdisplay output:

 --- Logical volume ---
  LV Path                /dev/mint-vg/root
  LV Name                root
  VG Name                mint-vg
  LV UUID                SVOWmO-mmr0-3Pdq-iy9g-QzTq-VklU-2PguqG
  LV Write Access        read/write
  LV Creation host, time mint, 2015-07-18 11:49:16 +0300
  LV Status              available
  # open                 1
  LV Size                27,71 GiB
  Current LE             7093
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

  --- Logical volume ---
  LV Path                /dev/mint-vg/swap_1
  LV Name                swap_1
  VG Name                mint-vg
  LV UUID                giclko-1k7X-KE1R-2Cre-8UTs-xGvx-qmp6AP
  LV Write Access        read/write
  LV Creation host, time mint, 2015-07-18 11:49:18 +0300
  LV Status              available
  # open                 0
  LV Size                2,00 GiB
  Current LE             511
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:3

df -h output:

 Filesystem                 Size  Used Avail Use% Mounted on
    /dev/mapper/mint--vg-root   28G  4,9G   21G  19% /
    none                       4,0K     0  4,0K   0% /sys/fs/cgroup
    udev                       996M  4,0K  996M   1% /dev
    tmpfs                      202M  1,7M  201M   1% /run
    none                       5,0M     0  5,0M   0% /run/lock
    none                      1010M  1,1M 1009M   1% /run/shm
    none                       100M   16K  100M   1% /run/user
    /dev/sda1                  236M   82M  143M  37% /boot
    /home/nicolae/.Private      28G  4,9G   21G  19% /home/user
2

To play with DRBD, you'd be better off adding a new virtual disk to your VM and using that (alongside your existing disk) rather than trying to carve up the virtual disk you already have.

As to your questions regarding LVM, the free space you're seeing displayed by the various tools is measured with different frames of reference. PVs are physical devices (full disks or partitions typically, a virtual disk in your case), grouped together into VGs (volume groups); so a VG has a total size equal to the sum of the underlying PVs' sizes. To use space in a VG you create LVs (logical volumes); you have two of these, one for swap and one for your files. Your VG has a total size of 29.75GB, your LVs use 29.71GB in total, which leaves 52MB unallocated in your VG (as indicated by vgdisplay). The last step is the LVs themselves; your root LV is formatted and contains 4.9GB of files, leaving 21GB free inside the filesystem (as indicated by df).

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.