-->

DEVOPSZONES

  • Recent blogs

    How to take Snapshot and Restore in LVM

    How to take Snapshot and Restore in LVM


    Have you ever come across the need to backup your data. I'm sure yes. Then lets check it out how to create snapshots and restore when required.

    1.  pvcreate /dev/sdb
    2. New PV has been created
    Allocatable Should be YES 
     linux snapshot



    3. Create a VG (dbvg) with the PV /dev/sdb.
    4. Allocatable should be Yes now.
    5. Create a Logical volume (LV) of 400MB.
    Logical Volume using PE (Default PE size 4 MB, Can be changed using -s flag)
    6. Create a file system on the LV.
    7. Create a mount point and mount the dbdata file system.
    8. Now create a snap volume dbsnapvol.
    9. Mount the snapvol and check that it has same data as of dbdata file system.
    10. Now create three files i.e. ram sita laxman


    11. Now the we have to restore the dbdata file system to its original state when the snapshot has been created, i.e. without ram sita laxman files.
    a. Create a new LV of size of dbdata LV.
    b. Unmount the snapvol LV if it is mounted.
    c. Now run dd commands to restore the data from dbsnapvol to newly created LV (dbdatarestore).
    12. Once data has been copied mount it and check if the data is intact.
    13. Once data is confirmed, mount the restore file system on dbdata mount point.
    14. Now you can remove snapshot LV.












    No comments