Rechercher

9.3. Enabling dm-cache caching for a logical volume

download PDF

This procedure enables caching of commonly used data on a logical volume using the dm-cache method.

Conditions préalables

  • A slow logical volume that you want to speed up using dm-cache exists on your system.
  • The volume group that contains the slow logical volume also contains an unused physical volume on a fast block device.

Procédure

  1. Create a cachevol volume on the fast device:

    # lvcreate --size cachevol-size --name <fastvol> <vg> </dev/fast-pv>

    Replace the following values:

    cachevol-size
    The size of the cachevol volume, such as 5G
    fastvol
    A name for the cachevol volume
    vg
    The volume group name
    /dev/fast-pv

    The path to the fast block device, such as /dev/sdf

    Exemple 9.1. Creating a cachevol volume

    # lvcreate --size 5G --name fastvol vg /dev/sdf
    Logical volume "fastvol" created.
  2. Attach the cachevol volume to the main logical volume to begin caching:

    # lvconvert --type cache --cachevol <fastvol> <vg/main-lv>

    Replace the following values:

    fastvol
    The name of the cachevol volume
    vg
    The volume group name
    main-lv

    The name of the slow logical volume

    Exemple 9.2. Attaching the cachevol volume to the main LV

    # lvconvert --type cache --cachevol fastvol vg/main-lv
    Erase all existing data on vg/fastvol? [y/n]: y
    Logical volume vg/main-lv is now cached.

Verification steps

  • Verify if the newly created logical volume has dm-cache enabled:

    # lvs --all --options +devices <vg>
    
    LV              Pool           Type   Devices
    main-lv         [fastvol_cvol] cache  main-lv_corig(0)
    [fastvol_cvol]                 linear /dev/fast-pv
    [main-lv_corig]                linear /dev/slow-pv

Ressources supplémentaires

  • lvmcache(7) man page
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.