Jaime Frutos Morales's blog

27/01/2010

How to backup a logical volume (snapshots) using LVM

Filed under: Linux, SysAdmin — acidborg @ 11:19

Description: a snapshot is a copy of the state of a logical volume at a particular point. It’s created almost immediately, so it’s very useful to backup large logical volumes. In this example, I’m going to create a snapshot of a logical volume called logical_volume1 beloging to the volume group volume_group1.

Steps:

  1. Check the size of the logical volume (LV Size): lvdisplay /dev/volume_group1/logical_volume1
    --- Logical volume ---
    LV Name /dev/volume_group1/logical_volume1
    VG Name volume_group1
    LV UUID AxihqP-Yt8l-5scY-bXNG-Bn5D-K3ms-X7v1Ys
    LV Write Access read/write
    LV Status available
    # open 1
    LV Size 200,00 GB
    Current LE 6400
    Segments 2
    Allocation inherit
    Read ahead sectors auto
    - currently set to 256
    Block device 253:5

    Usually, snapshots are smaller than the original logical volume, but I recommend to use at least the same space.

  2. Create the snapshot: lvcreate -L200G -s -n backup_logical_volume1 /dev/volume_group1/logical_volume1
  3. The -s param tells lvcreate to create a snapshot instead of a normal logical volume.

Advertisements

Create a free website or blog at WordPress.com.

%d bloggers like this: