Create snapshots on a directory
You can create snapshots on a specified directory and protect your important data.
You must have enabled snapshot creation.
Only a user with either of the following privileges can perform this task:
- The owner privilege to the directory on which to create the snapshots
- The superuser privilege
Run the
hdfs dfs
command with the
-createSnapshot
option and specify the path to the
directory on which you want to create snapshots.
The following example shows how you can create a snapshot
snap1
on the directory
/data/dir1
:hdfs dfs -createSnapshot /data/dir1 snap1
If
snapshot creation is successfully enabled on the specified directory, a
confirmation message
appears.
Created snapshot /data/dir1/.snapshot/snap2
Note | |
---|---|
You
can also run the command without mentioning the snapshot name. In such a
situation, the new snapshot has the time stamp of creation as its name.
See the following
example:
|