Rechercher

8.7. Tracking and displaying removed thin snapshot volumes

download PDF

This procedure describes how to display and manage deleted historical logical volumes.

Procédure

  1. Ensure that historical logical volumes are retained by setting record_lvs_history=1 in the lvm.conf file. This metadata option is not enabled by default.
  2. Optional: Set the value of the lvs_history_retention_time option in seconds. This is the time interval after which a record about individual historical logical volume is automatically destroyed. The automatic default value is 0 and it disables this feature. If you do not set this option, you can also delete individual historical volumes manually.
  3. To display a thin-provisioned snapshot chain:

    Dans cet exemple :

    • lvol1 is an origin volume, the first volume in the chain.
    • lvol2 is a snapshot of lvol1.
    • lvol3 is a snapshot of lvol2.
    • lvol4 is a snapshot of lvol3.
    • lvol5 is also a snapshot of lvol3.

      # lvs -H -o name,full_ancestors,full_descendants
        LV    FAncestors        FDescendants
        lvol1                   lvol2,lvol3,lvol4,lvol5
        lvol2 lvol1             lvol3,lvol4,lvol5
        lvol3 lvol2,lvol1       lvol4,lvol5
        lvol4 lvol3,lvol2,lvol1
        lvol5 lvol3,lvol2,lvol1
        pool

      Note that, despite using lvs utility with the -H option, no thin snapshot volume is removed and there are no historical logical volumes to display.

  4. Remove logical volume lvol3 from the snapshot chain:

    # lvremove -f vg/lvol3
      Logical volume "lvol3" successfully removed
  5. Run the lvs utility to see the details of historical logical volumes, along with their ancestors and descendants:

    # lvs -H -o name,full_ancestors,full_descendants
      LV     FAncestors         FDescendants
      lvol1                     lvol2,-lvol3,lvol4,lvol5
      lvol2  lvol1              -lvol3,lvol4,lvol5
      -lvol3 lvol2,lvol1        lvol4,lvol5
      lvol4  -lvol3,lvol2,lvol1
      lvol5  -lvol3,lvol2,lvol1
      pool
  6. Additionally, display the removal timestamp of a historical volume:

    # lvs -H -o name,full_ancestors,full_descendants,time_removed
      LV     FAncestors         FDescendants              RTime
      lvol1                     lvol2,-lvol3,lvol4,lvol5
      lvol2  lvol1              -lvol3,lvol4,lvol5
      -lvol3 lvol2,lvol1        lvol4,lvol5               2016-03-14 14:14:32 +0100
      lvol4  -lvol3,lvol2,lvol1
      lvol5  -lvol3,lvol2,lvol1
      pool
  7. You can reference historical logical volumes individually in a display command by specifying the vgname/lvname format:

    # lvs -H vg/-lvol3
      LV     VG   Attr       LSize
      -lvol3 vg   ----h-----    0

    Note that the fifth bit in the lv_attr field is set to h to indicate the volume is a historical one.

  8. LVM does not keep historical logical volumes if the volume has no live descendant. This means that if you remove a logical volume at the end of a snapshot chain, the logical volume is not retained as a historical logical volume.

    # lvremove -f vg/lvol5
      Automatically removing historical logical volume vg/-lvol5.
      Logical volume "lvol5" successfully removed
    # lvs -H -o name,full_ancestors,full_descendants
      LV     FAncestors         FDescendants
      lvol1                     lvol2,-lvol3,lvol4
      lvol2  lvol1              -lvol3,lvol4
      -lvol3 lvol2,lvol1        lvol4
      lvol4  -lvol3,lvol2,lvol1
      pool
  9. Remove the volume lvol1 and lvol2 and to see how the lvs command displays the volumes once they have been removed.

    # lvremove -f vg/lvol1 vg/lvol2
      Logical volume "lvol1" successfully removed
      Logical volume "lvol2" successfully removed
    # lvs -H -o name,full_ancestors,full_descendants
      LV     FAncestors           FDescendants
      -lvol1                      -lvol2,-lvol3,lvol4
      -lvol2 -lvol1               -lvol3,lvol4
      -lvol3 -lvol2,-lvol1        lvol4
      lvol4  -lvol3,-lvol2,-lvol1
      pool
  10. Remove a historical logical volume completely by specifying the name of the historical volume that now includes the hyphen, as in the following example

    # lvremove -f vg/-lvol3
    Historical logical volume "lvol3" successfully removed
    # lvs -H -o name,full_ancestors,full_descendants
      LV     FAncestors    FDescendants
      -lvol1               -lvol2,lvol4
      -lvol2 -lvol1        lvol4
      lvol4  -lvol2,-lvol1
      pool
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.