允许对/first文件夹使用快照功能
hdfs dfsadmin -allowSnapshot /first
对/first文件夹创建快照,快照名为snapshot0
hdfs dfs -createSnapshot /first snapshot0
查看快照,快照存放在被快照的文件夹的.snapshot文件夹里
hadoop fs -ls /first/.snapshot
递归查看快照
hadoop fs -ls -R /first/.snapshot
比较快照snapshot0和快照snapshot1的差异
hdfs snapshotDiff /first snapshot0 snapshot1
复制快照中的temp1.txt到文件夹/first中
hdfs dfs -cp -ptopax /first/.snapshot/snapshot1/temp1.txt /first
重命名快照snapshot0为snapshot00
hdfs dfs -renameSnapshot /first snapshot0 snapshot00
删除快照snapshot00
hdfs dfs -deleteSnapshot /frist snapshot00
列出可以被快照的文件夹
hdfs lsSnapshottableDir
禁止对文件夹/first使用快照
hdfs dfsadmin -disallowSnapshot /first