Thursday, 17 September 2015

Creating and Restore Backup Using LVM snapshot

Lvm Snapshot is ultimate way for creating a backup of that data which is already present into LVM(Logical Volume Management) devices (LV)-Logical volume.
Example: 1. We have a already created LV(logical volume) from any VG
of 5GiB/GB size and have copied lots of data for example 4GB
Important :
When you copy or store data it stores in two maners.
i) Data blocks (original data)
ii) metadata pointers (links and location address)
@@@@@@@@@@@@@@@@@@@@ THe concept of LVM SnapShot @@@@@@@@@
LVM Snapshot make a link to Original LV(Logical volume)
just like soft link of a file or directory which doesn’t required much size.
So if we have 5GB of LV(logical VOlume) then we can have its metadata upto 10-15% (50MB) and We can create LVM snapshot of 50MB
Practical :24 hours
Step 1:
Mount your LV (logical volume) which you have already created then fill some data.
[root@desktop69 rhel6]# mount /dev/vgcheck/lvm1 /mnt/new
step 2:
copy some data here
[root@desktop69 rhel6]# touch /mnt/new/abd{1..67}
[root@desktop69 rhel6]#cp -rvf /usr/ /mnt/new
Step3 :
Now take a snapshot of LVM
[root@desktop69 rhel6]#lvcreate -s –size 20M –name lvmsnapshot1 /dev/vgcheck/lvm1
check by using lvs or lvdisplay command
Note: Now you can mount it to access the stored data

No comments:

Post a Comment