Rechercher

9.5. Enabling dm-writecache caching for a logical volume

download PDF

This procedure enables caching of write I/O operations to a logical volume using the dm-writecache method.

Conditions préalables

  • A slow logical volume that you want to speed up using dm-writecache exists on your system.
  • The volume group that contains the slow logical volume also contains an unused physical volume on a fast block device.
  • If the slow logical volume is active, deactivate it.

Procédure

  1. If the slow logical volume is active, deactivate it:

    # lvchange --activate n <vg>/<main-lv>

    Replace the following values:

    vg
    The volume group name
    main-lv
    The name of the slow logical volume
  2. Create a deactivated cachevol volume on the fast device:

    # lvcreate --activate n --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.5. Creating a deactivated cachevol volume

    # lvcreate --activate n --size 5G --name fastvol vg /dev/sdf
    WARNING: Logical volume vg/fastvol not zeroed.
    Logical volume "fastvol" created.
  3. Attach the cachevol volume to the main logical volume to begin caching:

    # lvconvert --type writecache --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.6. Attaching the cachevol volume to the main LV

    # lvconvert --type writecache --cachevol fastvol vg/main-lv
    Erase all existing data on vg/fastvol? [y/n]?: y
    Using writecache block size 4096 for unknown file system block size, logical block size 512, physical block size 512.
    WARNING: unable to detect a file system block size on vg/main-lv
    WARNING: using a writecache block size larger than the file system block size may corrupt the file system.
    Use writecache block size 4096? [y/n]: y
    Logical volume vg/main-lv now has writecache.
  4. Activate the resulting logical volume:

    # lvchange --activate y <vg/main-lv>

    Replace the following values:

    vg
    The volume group name
    main-lv
    The name of the slow logical volume

Verification steps

  • Examine the newly created devices:

    # lvs --all --options +devices vg
    
    LV                VG Attr       LSize   Pool           Origin           Data%  Meta%  Move Log Cpy%Sync Convert Devices
     main-lv          vg Cwi-a-C--- 500.00m [fastvol_cvol] [main-lv_wcorig] 0.00                                    main-lv_wcorig(0)
     [fastvol_cvol]   vg Cwi-aoC--- 252.00m                                                                         /dev/sdc1(0)
     [main-lv_wcorig] vg owi-aoC--- 500.00m                                                                         /dev/sdb1(0)

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.