Snapshot can be represented by creating pointers (equivalent to hard links ) between special snapshot volume and live data. The snapshot process uses a copy-on-write strategy. As a result the snapshot only stores modified data.
The primary purpose of taking regular backups is to protect your data from data loss or corruption. If a media failure or disaster occurs, then you can restore data from created backups and recover the database. The created backups are just not for recovery it can be a useful way to migrate known datasets between environments. In mongoDB there are different methods for creating backup.
LVM Logical Volume Manager system abstracts disk images from physical devices and gives the number of row disk that can be used for manipulation and snapshot capabilities by system management.
Create a Snapshot:
To create a snapshot with LVM, issue a command as root:
lvcreate --size 100M --snapshot --name snap_db-01 /dev/vg0/mongodb
The above command will creates an LVM snapshot (by using --snapshot option) named snap_db-01 of the mongoDB volume located at /dev/vg0/mongodb.
The new created snapshot is named snap_db-01 and it is located at /dev/vg0/snap_db-01 . The path and location of the system may depend on the LVM configuration of the system. The snapshot created by above command has a cap of at 100 megabytes, as we set the parameter --size 100M.
NOTE: To run the above command your system must have LVM installed to install lvm use the following command using root.
apt-get install lvm2
0 Comment(s)