Chapter 3. Creating a deduplicated and compressed logical volume

You can create an LVM logical volume that uses the VDO feature to deduplicate and compress data.

3.1. LVM-VDO deployment scenarios

You can deploy VDO on LVM (LVM-VDO) in a variety of ways to provide deduplicated storage for:

  • block access
  • file access
  • local storage
  • remote storage

Because LVM-VDO exposes its deduplicated storage as a regular logical volume (LV), you can use it with standard file systems, iSCSI and FC target drivers, or as unified storage.

Note

Deploying Ceph Storage on LVM-VDO is currently not supported.

KVM

You can deploy LVM-VDO on a KVM server configured with Direct Attached Storage.

LVM-VDO deployment with KVM

File systems

You can create file systems on top of a VDO LV and expose them to NFS or CIFS users with the NFS server or Samba.

Deduplicated NAS

iSCSI target

You can export the entirety of the VDO LV as an iSCSI target to remote iSCSI initiators.

Deduplicated block storage target

Encryption

Device Mapper (DM) mechanisms such as DM Crypt are compatible with VDO. Encrypting a VDO LV volumes helps ensure data security, and any file systems above the VDO LV are still deduplicated.

LVM-VDO with encryption
Important

Applying the encryption layer above the VDO LV results in little if any data deduplication. Encryption makes duplicate blocks different before VDO can deduplicate them.

Always place the encryption layer below the VDO LV.

3.2. The physical and logical size of an LVM-VDO volume

This section describes the physical size, available physical size, and logical size that VDO can utilize.

Physical size

This is the same size as the physical extents allocated to the VDO pool LV. VDO uses this storage for:

  • User data, which might be deduplicated and compressed
  • VDO metadata, such as the UDS index
Available physical size

This is the portion of the physical size that VDO is able to use for user data.

It is equivalent to the physical size minus the size of the metadata, minus the remainder after dividing the volume into slabs by the given slab size.

Logical Size

This is the provisioned size that the VDO LV presents to applications. It is usually larger than the available physical size.

If you do not specify the --virtualsize option, VDO provisions the volume to a 1:1 ratio. For example, if you put a VDO LV on top of a 20 GB VDO pool LV, VDO reserves 2.5 GB for the UDS index, if the default index size is used. The remaining 17.5 GB is provided for the VDO metadata and user data. As a result, the available storage to consume is not more than 17.5 GB, and can be less due to metadata that makes up the actual VDO volume.

VDO currently supports any logical size up to 254 times the size of the physical volume with an absolute maximum logical size of 4 PB.

Additional resources

3.4. Slab size in VDO

The physical storage of the VDO volume is divided into a number of slabs. Each slab is a contiguous region of the physical space. All of the slabs for a given volume have the same size, which can be any power of 2 multiple of 128 MB up to 32 GB.

The default slab size is 2 GB in order to facilitate evaluating VDO on smaller test systems. A single VDO volume can have up to 8192 slabs. Therefore, in the default configuration with 2 GB slabs, the maximum allowed physical storage is 16 TB. When using 32 GB slabs, the maximum allowed physical storage is 256 TB. VDO always reserves at least one entire slab for metadata, and therefore, the reserved slab cannot be used for storing user data.

Slab size has no effect on the performance of the VDO volume.

Table 3.1. Recommended VDO slab sizes by physical volume size

Physical volume sizeRecommended slab size

10–99 GB

1 GB

100 GB – 1 TB

2 GB

2–256 TB

32 GB

You can control the slab size by providing the --vdoSlabSize=megabytes option to the vdo create command.

3.5. Installing VDO

This procedure installs software necessary to create, mount, and manage VDO volumes.

Procedure

  • Install the vdo and kmod-kvdo packages:

    # yum install vdo kmod-kvdo

3.6. Creating an LVM-VDO volume

This procedure creates an VDO logical volume (LV) on a VDO pool LV.

Prerequisites

Procedure

  1. Pick a name for your VDO LV, such as vdo1. You must use a different name and device for each VDO LV on the system.

    In all the following steps, replace vdo-name with the name.

  2. Create the VDO LV:

    # lvcreate --type vdo \
               --name vdo-name
               --size physical-size
               --virtualsize logical-size \
               vg-name
    • Replace vg-name with the name of an existing LVM volume group where you want to place the VDO LV.
    • Replace logical-size with the amount of logical storage that the VDO LV will present.
    • If the physical size is larger than 16TiB, add the following option to increase the slab size on the volume to 32GiB:

      --config 'allocation/vdo_slab_size_mb=32768'

      If you use the default slab size of 2GiB on a physical size larger than 16TiB, the lvcreate command fails with the following error:

      ERROR - vdoformat: formatVDO failed on '/dev/device': VDO Status: Exceeds maximum number of slabs supported

    Example 3.1. Creating a VDO LV for container storage

    For example, to create a VDO LV for container storage on a 1TB VDO pool LV, you can use:

    # lvcreate --type vdo \
               --name vdo1
               --size 1T
               --virtualsize 10T \
               vg-name
    Important

    If a failure occurs when creating the VDO volume, remove the volume to clean up.

  3. Create a file system on the VDO LV:

    • For the XFS file system:

      # mkfs.xfs -K /dev/vg-name/vdo-name
    • For the ext4 file system:

      # mkfs.ext4 -E nodiscard /dev/vg-name/vdo-name

Additional resources

  • The lvmvdo(7) man page

3.7. Mounting an LVM-VDO volume

This procedure mounts a file system on an LVM-VDO volume, either manually or persistently.

Prerequisites

Procedure

  • To mount the file system on the LVM-VDO volume manually, use:

    # mount /dev/vg/vdo-name mount-point
  • To configure the file system to mount automatically at boot, add a line to the /etc/fstab file:

    • For the XFS file system:

      /dev/vg/vdo-name mount-point xfs defaults,_netdev,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0
    • For the ext4 file system:

      /dev/vg/vdo-name mount-point ext4 defaults,_netdev,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0