Ceph extends full support to snapshots, which are point-in-time, read-only copies of an RBD image. You can preserve the state of a Ceph RBD image by creating snapshots and restoring the snapshot to get the original data.
Let's see how a snapshot works with Ceph.
# echo "Hello Ceph This is snapshot test" > /mnt/ceph-disk1/snapshot_test_file
Syntax: rbd snap create <pool-name>/<image-name>@<snap-name>
# rbd snap create rbd/rbd1@snapshot1 --name client.rbd
Syntax: rbd snap ls <pool-name>/<image-name>
# rbd snap ls rbd/rbd1 --name client.rbd
# rm -f /mnt/ceph-disk1/*
Syntax: rbd snap rollback <pool-name>/<image-name>@<snap-name>
# rbd snap rollback rbd/rbd1@snapshot1 --name client.rbd
# umount /mnt/ceph-disk1 # mount /dev/rbd1 /mnt/ceph-disk1 # ls -l /mnt/ceph-disk1
Syntax: rbd snap rm <pool-name>/<image-name>@<snap-name>
# rbd snap rm rbd/rbd1@snapshot1 --name client.rbd
purge
sub command:
Syntax: rbd snap purge <pool-name>/<image-name>
# rbd snap purge rbd/rbd1 --name client.rbd
3.17.174.0