When accessing storage via NFS, ABS provides a snapshot feature for files, allowing users to create snapshots and roll back from them.
Procedure
Run the following command on any node in the cluster to create a snapshot with the specified name for files under a specified directory:
zbs-nfs snapshot create <export_name> <file_path> <snapshot_name>
| Parameter | Description |
|---|---|
export_name | The name of the NFS Export. |
file_path | The file path. |
snapshot_name | The snapshot name. |
Output example
------------ -----------------------------
Snap Name test1_snap
Size 1024.00 MiB
Diff Size 256.00 MiB
Volume Id 4
Creation Time 2016-01-30 01:43:49.439047235
Description
------------ -----------------------------Procedure
zbs-nfs snapshot list <export_name> [--path <PATH>]
| Parameter | Description |
|---|---|
export_name | The NFS Export to which the NFS file belongs. |
--path <PATH> | The NFS file path. |
zbs-nfs snapshot show_by_id <snapshot_id>
Output example
ID Snap Name Size Unique Size Shared Size Diff Size Volume Id Creation Time Description
------------------------------------ ---------------------------------------------------------------- ------ ------------- ------------- ----------- ------------------------------------ ----------------------------- -------------
015638eb-e0f7-49b6-a223-c256e4cd9cf6 ddd-214627-2016-11-25-10-40 0.00 B 0.00 B 0.00 B 0.00 B 9bbe6391-4d4e-487c-a56d-82b8aa9dea1b 2016-11-25 18:40:36.730107938 test
0159b0c1-1d6e-4606-ac57-031f28324fc5 ddd-e7e9e134-dd70-473b-bef3-4ba95aa27af8-214627-2016-11-21-18-57 0.00 B 0.00 B 0.00 B 0.00 B 321e3929-c2bf-47a3-8307-76439eb31f0c 2016-11-22 02:57:22.932895298 testUsers can use the command line to update the snapshot description and configure whether data should be evenly distributed.
Procedure
Run the following command on any node in the cluster to update the snapshot of an NFS file under the specified path:
zbs-nfs snapshot update <export_name> <file_path> <snapshot_name> <new_snapshot_name> [--new_desc <NEW_DESC>] [--new_alloc_even <NEW_ALLOC_EVEN>]
Run the following command on any node in the cluster to update the snapshot of an NFS file with the specified ID:
zbs-nfs snapshot update_by_id <snapshot_id> <new_snapshot_name> [--new_desc <NEW_DESC>] [--new_alloc_even <NEW_ALLOC_EVEN>]
| Parameter | Description |
|---|---|
--new_desc <NEW_DESC> | Updates the description of the corresponding snapshot. |
--new_alloc_even <NEW_ALLOC_EVEN> | Whether to evenly distribute snapshot replicas. Valid values: true or false. |
Output note
If the command succeeds, no output is displayed.
Procedure
Run the following command on any node in the cluster to roll back the NFS files from the snapshot with the specified name:
zbs-nfs snapshot rollback <export_name> <file_path> <snapshot_name>
Run the following command on any node in the cluster to roll back the NFS files from the snapshot with the specified ID:
zbs-nfs snapshot rollback_by_id <export_name> <file_path> <snapshot_id>
Output note
If the command succeeds, no output is displayed.
Procedure
Run the following command on any node in the cluster to delete the snapshot with the specified name:
zbs-nfs snapshot delete <export_name> <file_path> <snapshot_name>
Run the following command on any node in the cluster to delete the snapshot with the specified ID:
zbs-nfs snapshot delete_by_id <snapshot_id>
Output example
ID Snap Name Size Unique Size Shared Size Diff Size Volume Id Creation Time Description
------------------------------------ ---------------------------------------------------------------- ------ ------------- ------------- ----------- ------------------------------------ ----------------------------- -------------
015638eb-e0f7-49b6-a223-c256e4cd9cf6 ddd-214627-2016-11-25-10-40 0.00 B 0.00 B 0.00 B 0.00 B 9bbe6391-4d4e-487c-a56d-82b8aa9dea1b 2016-11-25 18:40:36.730107938 test
[root@localhost test]# zbs-nfs snapshot delete arcfra test1 ddd-214627-2016-11-25-10-40
[root@localhost test]# zbs-nfs snapshot list arcfra test1
No snapshot found