A snapshot is a read-only image of a volume at a specific point in time. On clusters with an M5 or higher license, you can create a snapshot manually or automate the process with a schedule. Snapshots are useful any time you need to be able to roll back to a known good data set at a specific point in time. For example, before performing a risky operation on a volume, you can create a snapshot to enable rollback capability for the entire volume. A snapshot takes no time to create, and initially uses no disk space, because it stores only the incremental changes needed to roll the volume back to the state at the time the snapshot was created. The storage used by a volume's snapshots does not count against the volume's quota. When you view the list of volumes on your cluster in the MapR Control System, the value of the Snap Size column is the disk space used by all of the snapshots for that volume.
The following sections describe procedures associated with snapshots:
- To view the contents of a snapshot, see Viewing the Contents of a Snapshot
- To create a snapshot, see Creating a Volume Snapshot (requires M5 or higher license)
- To view a list of snapshots, see Viewing a List of Snapshots
- To remove a snapshot, see Removing a Volume Snapshot
Viewing the Contents of a Snapshot
At the top level of each volume is a directory called .snapshot containing all the snapshots for the volume. You can view the directory with hadoop fs commands or by mounting the cluster with NFS. To prevent recursion problems, ls and hadoop fs -ls do not show the .snapshot directory when the top-level volume directory contents are listed. You must navigate explicitly to the .snapshot directory to view and list the snapshots for the volume.
Example:
root@node41:/opt/mapr/bin# hadoop fs -ls /myvol/.snapshot Found 1 items drwxrwxrwx - root root 1 2011-06-01 09:57 /myvol/.snapshot/2011-06-01.09-57-49
Creating a Volume Snapshot
You can create a snapshot manually or use a schedule to automate snapshot creation. Each snapshot has an expiration date that determines how long the snapshot will be retained:
- When you create the snapshot manually, specify an expiration date.
- When you schedule snapshots, the expiration date is determined by the Retain parameter of the schedule.
For more information about scheduling snapshots, see Scheduling a Snapshot.
Creating a Snapshot Manually
You can create a snapshot using the volume snapshot create command, or use the following procedure to create a snapshot using the MapR Control System.
To create a snapshot using the MapR Control System:
- In the Navigation pane, expand the MapR-FS group and click the Volumes view.
- Select the checkbox beside the name of each volume for which you want a snapshot, then click the New Snapshot button to display the Snapshot Name dialog.
- Type a name for the new snapshot in the Name... field.
- Click OK to create the snapshot.
Scheduling a Snapshot
You schedule a snapshot by associating an existing schedule with a normal (non-mirror) volume. You cannot schedule snapshots on mirror volumes; in fact, since mirrors are read-only, creating a snapshot of a mirror would provide no benefit. You can schedule a snapshot by passing the ID of a schedule to the volume modify command, or you can use the following procedure to choose a schedule for a volume using the MapR Control System.
To schedule a snapshot using the MapR Control System:
- In the Navigation pane, expand the MapR-FS group and click the Volumes view.
- Display the Volume Properties dialog by clicking the volume name, or by selecting the checkbox beside the name of the volume then clicking the Properties button.
- In the Replication and Snapshot Scheduling section, choose a schedule from the Snapshot Schedule dropdown menu.
- Click Modify Volume to save changes to the volume.
For information about creating a schedule, see Schedules.
Viewing a List of Snapshots
Viewing all Snapshots
You can view snapshots for a volume with the volume snapshot list command or using the MapR Control System.
To view snapshots using the MapR Control System:
- In the Navigation pane, expand the MapR-FS group and click the Snapshots view.
Viewing Snapshots for a Volume
You can view snapshots for a volume by passing the volume to the volume snapshot list command or using the MapR Control System.
To view snapshots using the MapR Control System:
- In the Navigation pane, expand the MapR-FS group and click the Volumes view.
- Click the Snapshots button to display the Snapshots for Volume dialog.
Removing a Volume Snapshot
Each snapshot has an expiration date and time, when it is deleted automatically. You can remove a snapshot manually before its expiration, or you can preserve a snapshot to prevent it from expiring.
Removing a Volume Snapshot Manually
You can remove a snapshot using the volume snapshot remove command, or use the following procedure to remove a snapshot using the MapR Control System.
To remove a snapshot using the MapR Control System:
- In the Navigation pane, expand the MapR-FS group and click the Snapshots view.
- Select the checkbox beside each snapshot you wish to remove.
- Click Remove Snapshot to display the Remove Snapshots dialog.
- Click Yes to remove the snapshot or snapshots.
To remove a snapshot from a specific volume using the MapR Control System:
- In the Navigation pane, expand the MapR-FS group and click the Volumes view.
- Select the checkbox beside the volume name.
- Click Snapshots to display the Snapshots for Volume dialog.
- Select the checkbox beside each snapshot you wish to remove.
- Click Remove to display the Remove Snapshots dialog.
- Click Yes to remove the snapshot or snapshots.
Preserving a Volume Snapshot
You can preserve a snapshot using the volume snapshot preserve command, or use the following procedure to create a volume using the MapR Control System.
To remove a snapshot using the MapR Control System:
- In the Navigation pane, expand the MapR-FS group and click the Snapshots view.
- Select the checkbox beside each snapshot you wish to preserve.
- Click Preserve Snapshot to preserve the snapshot or snapshots.
To remove a snapshot from a specific volume using the MapR Control System:
- In the Navigation pane, expand the MapR-FS group and click the Volumes view.
- Select the checkbox beside the volume name.
- Click Snapshots to display the Snapshots for Volume dialog.
- Select the checkbox beside each snapshot you wish to preserve.
- Click Preserve to preserve the snapshot or snapshots.