Snapshots and Clones
With snapshots and clones, you can leverage fast and thin point-in-time snapshots/clones of Lightbits volumes. A snapshot can be taken from a volume, and a volume can be created from a snapshot (aka a clone).
Snapshots cannot be accessed as a volume; only clones of that snapshot can be accessed.
Snapshots and clones will be created on the same nodes. There is no limit on the per-volume number of snapshots and clones, and no limit on the node level number of snapshots and clones.
Snapshots can be taken on demand or scheduled, and multiple schedules can exist for the same volume..
- With regards to Management APIs, snapshots are separate entities and clones are the same as volumes. Clones can be deleted by using the delete volume API. To delete a snapshot, you will need to call the delete snapshot API.
- Lightbits STS in AWS also has backup and restore capabilities to and from S3. See Backup and Restore for additional information.
Snapshots and Clone Commands
List the existing volumes: lbcli -J $JWT list volumes:
$ lbcli -J <JWT> list volumes --project-name <project name>
$ lbcli -J $LIGHTOS_JWT list volumes --project-name a
Name UUID State Protection State NSID Size Replicas Compression ACL Rebuild Progress
vol1 a7f67ad0-1f3d-49cb-9650-b82042378014 Available FullyProtected 1 4.0 GiB 3 true values:"acl1" None
Create a snapshot from the volume:
lbcli -J <JWT> create snapshot --name=<snapshot name> --project-name=<project name> --source-volume-name=<source volume name>
$ lbcli -J $LIGHTOS_JWT create snapshot --name=vol1_snapshot --project-name=default --source-volume-name=vol1
Name UUID Source volume UUID State
vol1_snapshot bd52d3d8-65a5-49fe-a934-b7d8b07ef040 a7f67ad0-1f3d-49cb-9650-b82042378014 Creating
Check that the snapshot was created:
lbcli -J <JWT> list snapshots --project-name=<project name>
$ lbcli -J $LIGHTOS_JWT list snapshots --project-name=default
or
$ lbcli -J $LIGHTOS_JWT get snapshot --name=vol1_snapshot --project-name=default
Name UUID Source volume UUID State
vol1_snapshot bd52d3d8-65a5-49fe-a934-b7d8b07ef040 a7f67ad0-1f3d-49cb-9650-b82042378014 Available
Get snapshot info:
lbcli -J <JWT> get snapshot --project-name=<project-name> --uuid=<snapshot uuid> -o json
$ lbcli -J $LIGHTOS_JWT get snapshot --project-name=default --uuid=bd52d3d8-65a5-49fe-a934-b7d8b07ef040 -o json
{
"state": "Available",
"UUID": "bd52d3d8-65a5-49fe-a934-b7d8b07ef040",
"name": "vol1_snapshot",
"description": "",
"creationTime": "2021-03-05T23:11:30.445377399Z",
"retentionTime": null,
"sourceVolumeUUID": "a7f67ad0-1f3d-49cb-9650-b82042378014",
"sourceVolumeName": "vol1",
"replicaCount": 3,
"nodeList": [
"40365551-f7e0-50b2-b415-ac238d150e16"
"9a625dbf-de1b-4211-b9d3-0bdf70faa5f5"
"9f1a3a85-5be5-4f98-a44e-4271fbdbe7cc" ],
"nsid": 1,
"acl": null,
"compression": true,
"size": "4294967296",
"IPAcl": null,
"sectorSize": 4096,
"statistics": {
"physicalCapacity": "0",
"physicalOwnedCapacity": "0",
"physicalOwnedMemory": "0",
"physicalMemory": "0",
"userWritten": "0"
},
"ETag": "3",
"projectName": "default"
}
Create a volume from snapshot (clone):
lbcli -J <JWT> create volume --project-name=<project name> --name=<clone name> --source-snapshot-uuid=<snapshot uuid> --acl=<acl> --size=<size> --compression=<true/false> --replica-count=3
--name can also be used with snapshot name instead of UUID
lbcli -J $LIGHTOS_JWT create volume --project-name=default --name=copy_vol1 --source-snapshot-uuid=bd52d3d8-65a5-49fe-a934-b7d8b07ef040 --acl=acl2 --size="4 Gib" --compression=true --replica-count=3
Create a snapshot-policy:
lbcli create snapshots-policy -J <JWT> --project-name=<project name> --name=<policy name> --volume-uuid=<volume uuid> --description="<description>" --hours-in-cycle=<hours> --start-time=<time> --retention-time=<hours>
$ lbcli -J $LIGHTOS_JWT create snapshots-policy --project-name=default --name=policy1 --volume-uuid=a7f67ad0-1f3d-49cb-9650-b82042378014 --description="my policy" --hours-in-cycle=2 --start-hour=22 --retention-time=4h
Name UUID Volume Name State Type
policy1 3c03b2bf-e102-4c6c-8c6d-173224148f31 vol1 Creating Hourly
List snapshot-policies:
lbcli list snapshots-policies -J <JWT> --project-name=<project name> --volume-uuid=<volume uuid>
$ lbcli -J $LIGHTOS_JWT list snapshots-policies --project-name=default --volume-uuid=a7f67ad0-1f3d-49cb-9650-b82042378014
Name UUID Volume Name State Type
policy1 3c03b2bf-e102-4c6c-8c6d-173224148f31 vol1 Active Hourly
Get snapshot-policies:
lbcli get snapshots-policy -J <JWT> --project-name=<project name> --volume-uuid=<volume uuid> -o json
$ lbcli -J $LIGHTOS_JWT get snapshots-policy --project-name=default --uuid=3c03b2bf-e102-4c6c-8c6d-173224148f31 -o json
{
"UUID": "3c03b2bf-e102-4c6c-8c6d-173224148f31",
"name": "policy1",
"resourceUUID": "a7f67ad0-1f3d-49cb-9650-b82042378014",
"resourceName": "vol1",
"projectName": "default",
"schedulePolicy": {
"snapshotSchedulePolicy": {
"hourlySchedule": {
"startTime": "2021-03-08T22:16:21Z",
"hoursInCycle": 2
}
},
"retentionTime": "14400s"
},
"description": "my policy",
"state": "Active"
}
Delete snapshot/snapshot-policy:
Snapshot: lbcli delete snapshot -J <JWT> --project-name=<project-name> --uuid=<snapshot uuid>
lbcli -J $LIGHTOS_JWT delete snapshot --project-name=default --uuid=bd52d3d8-65a5-49fe-a934-b7d8b07ef040
Snapshot-policy: lbcli delete snapshots-policy -J $JWT --project-name=<project-name> --uuid=<snapshot-policy uuid>
lbcli -J $LIGHTOS_JWT delete snapshots-policy --project-name=default --uuid=3c03b2bf-e102-4c6c-8c6d-173224148f31
Rollback
The Rollback operation takes a volume and restores it back to a previous snapshot (data + md), or the point in time when the snapshot was taken. This is a harmful process and all data since the last snapshot will be lost. Therefore if needed, it is recommended to take a snapshot before doing the rollback, so that if needed you can return to the last taken snapshot.
Before doing a rollback, it is recommended to remove active mounts, detach the volume, or flush caches before performing this operation.
The process should be as follows:
- Stop process/es that use the volume.
- Unmount FS create on top of the volume; e.g., for mount point:
/mnt/volume_to_rollback
. a. Unmount/mnt/volume_to_rollback.
- Take a snapshot via lbcli.
- Perform a rollback via lbcli.
- Re-mount the volume:
mount /mnt/rolled_back_volume
Rollback Volume
lbcli rollback volume -J <JWT> --project-name=<project-name> --uuid=<volume-uuid> --src-snapshot-uuid=<snapshot-uuid>
$ lbcli -J $LIGHTOS_JWT rollback volume --project-name=default --src-snapshot-uuid=bd52d3d8-65a5-49fe-a934-b7d8b07ef040 --uuid=05f49718-4897-4ff5-adb9-5d7ccd6fc138