Monday 18 November 2013

How to remove LVM Snapshot

When backup has finished you can now unmount the volume and remove it from the system. you should remove snapshot volume when you have finished with them because then take a copy of all data written to the original volume and this can hurt performance,

# vgdisplay
  --- Volume group ---
  VG Name               vg-ctechz
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.04 GB
  PE Size               4.00 MB
  Total PE              266
 Alloc PE / Size       250 / 1000.00 MB
  Free  PE / Size       16 / 64.00 MB
  VG UUID         ui4JTr-JOwC-VCvG-5Evc-poOD-3Klr-hM3feq

# vgs
  VG        #PV #LV #SN Attr   VSize VFree
  vg-ctechz   2   2   1 wz--n- 1.04G 64.00M


# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              25G  4.9G   19G  21% /
tmpfs                 593M     0  593M   0% /dev/shm
/dev/mapper/vg--ctechz-lvm--ctechz
                      591M  542M   20M  97% /lvm-ctechz
/dev/mapper/vg--ctechz-lvm--ctechz--spapshot1
                      591M  542M   20M  97% /snapshot

# umount /snapshot/

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              25G  4.9G   19G  21% /
tmpfs                 593M     0  593M   0% /dev/shm
/dev/mapper/vg--ctechz-lvm--ctechz
                      591M  542M   20M  97% /lvm-ctechz

# ls /dev/vg-ctechz/
lvm-ctechz  lvm-ctechz-spapshot1

# lvremove /dev/vg-ctechz/lvm-ctechz-spapshot1
Do you really want to remove active logical volume lvm-ctechz-spapshot1? [y/n]: y
Logical volume "lvm-ctechz-spapshot1" successfully removed

# vgs
  VG        #PV #LV #SN Attr   VSize VFree
  vg-ctechz   2   1   0 wz--n- 1.04G 464.00M

We got our 400MB back in Volume Group


No comments:

Post a Comment