0

I am installing lvmvdo con Debian 11.2 to store Proxmox vm disk, doing the following :

1) apt install -y build-essential libdevmapper-dev libz-dev uuid-dev git sudo libblkid-dev man vim dwarves dkms lvm2

2)export PATH=$PATH:/usr/sbin

3) git clone https://github.com/dm-vdo/kvdo.git cd kvdo/ make -C /usr/src/linux-eaders-`uname -r` M=`pwd`
cp vdo/kvdo.ko /lib/modules/$(uname -r) && cp uds/uds.ko /lib/modules/$(uname -r)

4)git clone https://github.com/dm-vdo/vdo.git cd vdo/ && make && make install

5)depmod -a update-initramfs -u

6)echo uds >>/etc/modules && echo kvdo >> /etc/modules

7)reboot

8) modprobe kvdo && modprobe uds

9) lsmod |grep vdo
kvdo                  540672  1
uds                   270336  1 kvdo
dm_mod                163840  12 kvdo,dm_thin_pool,dm_bufio

10) pvcreate /dev/sda
vgcreate vgdo /dev/sda
lvcreate --type vdo --name vdolv --size 7G --virtualsize 8G vgdo
mkfs.ext4 -E nodiscard /dev/vgdo/vdolv

11)mount /dev/vgdo/vdolv /mnt/vdo/
df -h
S.ficheros             Tamaño Usados  Disp Uso% Montado en
/dev/mapper/vgdo-vdolv   7,8G    24K  7,4G   1% /mnt/vdo

12)cp /tmp/rhel-8.5-x86_64-kvm.qcow2 /mnt/vdo/ &&df -h
S.ficheros             Tamaño Usados  Disp Uso% Montado en
/dev/mapper/vgdo-vdolv   7,8G   744M  6,7G  10% /mnt/vdo

13)cp /tmp/rhel-8.5-x86_64-kvm.qcow2 /mnt/vdo/rhel-8.5-x86_64-kvm2.qcow2
S.ficheros             Tamaño Usados  Disp Uso% Montado en
/dev/mapper/vgdo-vdolv   7,8G   1,5G  6,0G  20% /mnt/vdo

14)lvs -o+vdo_compression,vdo_deduplication
LV     VG   Attr       LSize Pool   Origin Data%  Meta%  Move Log Cpy%Sync Convert VDOCompression VDODeduplication
vdolv  vgdo vwi-XXv-X- 8,00g vpool0                                                       enabled          enabled

As you can see on step 12 and 13, I'm cloning a qcow2 image, and my data still growing without any deduplication process, same behavior happens with .iso .mkv and other testing files.

I don't know what I'm doing wrong, please can anybody help me.

My final goal is using a fresh install of Debian with working VDOs to install proxmox over that.

1 Answer 1

3

You can't use df to check how much data is saved by deduplication and compression with VDO. From the filesystem point of view (so also from df perspective) the device is 8 GiB (in your case) big and there is no deduplication or compression involved so two ~750 MiB files will use 1.5 GiB of space. All savings happen on the block layer -- that's why you specify two sizes when creating the LVM VDO -- smaller "real" physical size and bigger virtual size. With the virtual size you are saying "I assume that with the deduplication and compression enabled I will fit up to X times more data here". You are telling the filesystem it has 8 GiB of space and the block layer will take care of storing the data in a more effective way without telling the filesystem. (This is similar to thin provisioning where you tell the filesystem it has more space available than you actually have in the pool.)

If you want to check how much space is actually used, you should check the Data% column of both the VDO logical volume and the pool or use the vdostats command.

So for example with a 1.9 GiB ISO you'll get:

# cp ~/Downloads/Fedora-Workstation-Live-x86_64-35-1.2.iso /mnt/vdo
# df -h /mnt/vdo
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/vdo-VDOLV   49G  1.9G   45G   5% /mnt/vdo
# vdostats --all | grep "data blocks used"
  data blocks used                    : 485743

(blocks are 1K so this is about 474 MiB). And after copying the ISO for the second time:

# cp ~/Fedora-Workstation-Live-x86_64-35-1.2.iso /mnt/vdo/Fedora-Workstation-Live-x86_64-35-1.2.iso.2 
# df -h /mnt/vdo
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/vdo-VDOLV   49G  3.8G   43G   9% /mnt/vdo
# vdostats --all | grep "data blocks used"
  data blocks used                    : 485770

you can see the df output now shows double used space but the actual data usage grew just by a couple of blocks.

Two more notes for you:

  • 8 GiB virtual size with 7 GiB physical size is small, you would usually set the virtual size to 5 to 10 times the physical size.
  • 7 GiB is a very small VDO volume. VDO uses a lot of space for metadata and the metadata size doesn't scale down to sizes like this, for volumes smaller than 1 TiB it will be 2 to 4 GiB so it really isn't useful for few GiBs worth of data.

(Both is OK if you are just testing LVM VDO and making sure everything works.)

1
  • Thank you so much!!! I can see the space saving just using " vdostats --human-readable" Jan 18 at 15:01

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.