1、开启特定目录的创建快照
hdfs dfsadmin -allowSnapshot /aaa
[root@node01 opt]# hdfs dfsadmin -allowSnapshot /aaa
Allowing snaphot on /aaa succeeded
2、创建快照
hdfs dfs -createSnapshot /aaa
[root@node01 opt]# hdfs dfs -createSnapshot /aaa
Created snapshot /aaa/.snapshot/s20191108-013226.787
[root@node01 opt]# hdfs dfs -createSnapshot /aaa aaa001
Created snapshot /aaa/.snapshot/aaa001
3、删除快照
hdfs dfs -deleteSnapshot /bbb /bbb001
4、关闭特定目录的创建快照
hdfs dfsadmin -disallowSnapshot /aaa
hdfs dfsadmin -disallowSnapshot /bbb
[root@node01 opt]# hdfs dfsadmin -disallowSnapshot /aaa
Disallowing snaphot on /aaa succeeded
[root@node01 opt]# hdfs dfsadmin -disallowSnapshot /bbb
Disallowing snaphot on /bbb succeeded