The operations described in this section require superuser
privileges.
Allow Snapshots: Allowing snapshots of a directory to
be created. If the operation completes successfully, the directory becomes
snapshottable.
Command:
hadoop dfsadmin -allowSnapshot $path
Arguments:
path – The path of the snapshottable directory.
See also the corresponding Java API void
allowSnapshot(Path path) in HdfsAdmin.
Disallow Snapshots: Disallowing snapshots of a
directory to be created. All snapshots of the directory must be deleted
before disallowing snapshots.
Command:
hadoop dfsadmin -disallowSnapshot $path
Arguments:
path – The path of the snapshottable directory.
See
also the corresponding Java API void disallowSnapshot(Path
path) in HdfsAdmin.
User Operations
The section describes user operations. Note that HDFS
superuser can perform all the operations without satisfying the permission
requirement in the individual operations.
Create Snapshots: Create a snapshot of a
snapshottable directory. This operation requires owner privilege to the
snapshottable directory.
Command:
hadoop dfs -createSnapshot $path $snapshotName
Arguments:
path
The path of the snapshottable directory.
snapshotName
The snapshot name, which is an optional argument. When it
is omitted, a default name is generated using a timestamp with the
format "'s'yyyyMMdd-HHmmss.SSS", e.g.
"s20130412-151029.033".
See also the corresponding Java API Path
createSnapshot(Path path) and Path createSnapshot(Path path,
String snapshotName) in FileSystem. The snapshot path is
returned in these methods.
Delete Snapshots: Delete a snapshot of from a
snapshottable directory. This operation requires owner privilege of the
snapshottable directory.
Command:
hadoop dfs -deleteSnapshot $path $snapshotName
Arguments:
path
The path of the snapshottable directory.
snapshotName
The snapshot name.
See also the corresponding Java API void
deleteSnapshot(Path path, String snapshotName) in FileSystem.
Rename Snapshots: Rename a snapshot. This operation
requires owner privilege of the snapshottable directory..
See also the corresponding Java API void
renameSnapshot(Path path, String oldName, String newName) in FileSystem.
Get Snapshottable Directory Listing: Get all the
snapshottable directories where the current user has permission to take
snapshots.
Command:
hadoop lsSnapshottableDir $path $snapshotName
Arguments:
path
The path of the snapshottable directory.
snapshotName
The snapshot name.
See also the corresponding Java
API SnapshottableDirectoryStatus[]
getSnapshottableDirectoryListing() in DistributedFileSystem.
Get Snapshots Difference Report: Get the differences
between two snapshots. This operation requires read access privilege for
all files/directories in both snapshots.