Considerations for working with HDFS snapshots
You can create snapshots only for directories that allow the creation of snapshots. If a directory already contains snapshots, you cannot delete or rename the directory unless you remove all the snapshots.
You must consider the following when working with HDFS snapshots:
- You must enable snapshot creation on a particular directory before creating snapshots on that directory. Such a directory is termed as a snapshottable directory. However, you cannot create snapshots on a directory if its corresponding child or parent directory is already enabled for snapshot creation.
- You cannot delete or rename a directory that contains snapshots. You must first remove all the snapshots before attempting the delete or rename operation.
- For a snapshottable directory, its path component
.snapshot
can be used to access the snapshots.For example, consider the directory
/foo
that is enabled for snapshot creation. For the directory/foo
with a snapshotsnap1
, the path/foo/.snapshot/snap1
refers to the snapshot of/foo
. - You can enable or disable snapshot creation on a particular directory only if you have the superuser privilege.
- On a snapshottable directory; you can create, delete, or rename snapshots. These operations require either the superuser privilege or the owner access to the directory. In addition, you can list directories that have snapshot creation enabled or view differences between contents of snapshots.
- You cannot rename a snapshot outside the snapshottable directory.