Snapshots Reference Guide

ObjectiveFS snapshots provide full point-in-time views of the entire filesystem. These read-only snapshots are fast to take manually and can also be taken automatically based on a schedule.

Snapshots Overview

ObjectiveFS supports two types of snapshots: automatic snapshots and checkpoint snapshots. Automatic snapshots are managed by ObjectiveFS and are taken based on the snapshot schedule while your filesystem is mounted. Checkpoint snapshots can be taken at anytime and the filesystem does not need to be mounted.

Snapshots can be mounted as a read-only filesystem to access your filesystem as it was at that point in time. This is useful to recover accidentally deleted or modified files or as the source for creating a consistent point-in-time backup.

Snapshots are fast to take. The storage used for each snapshot is incremental, only the differences between two snapshots are stored.

If there are multiple mounts of the same filesystem, only one automatic snapshot will be generated at a given scheduled time.

Activating Snapshots

Snapshots are automatically activated upon initial mount of the filesystem, unless the nosnapshots mount option is used.

Legacy filesystems note: For older filesystems created before ObjectiveFS 5.0, snapshots are activated when the filesystem is mounted with ObjectiveFS 5.0 or newer. Upon activation, ObjectiveFS will perform a one-time identification of existing snapshots and activate them if available.

You can use the mount.objectivefs list command to identify filesystems with activated snapshots by checking the SNAP field of the output. If snapshots have been activated on this filesystem, the SNAP column will show on. Otherwise, it will show -.

Checkpoint Snapshots

Team, Corporate and Enterprise Plans Feature

Checkpoint snapshots are manual point-in-time snapshots that can be taken at anytime, even if your filesystem is not mounted. Checkpoint snapshots are useful for creating a snapshot right before making large changes to the filesystem. They can also be useful if you need snapshots at a specific time of the day or for compliance reasons.

There is no limit to the number of checkpoint snapshots you can take. The checkpoint snapshots are kept until they are explicitly removed by the destroy command.

Command to take a checkpoint snapshot::

# mount.objectivefs snapshot <filesystem>

Automatic Snapshots

Automatic snapshots are managed by ObjectiveFS and are taken based on the snapshot schedule while your filesystem is mounted. If your filesystem is not mounted, automatic snapshots will not be taken since there are no changes to the filesystem.

Automatic snapshots are taken and retained based on the snapshot schedule. Older automatic snapshots are automatically removed to maintain the number of snapshots per interval.

Snapshot Schedule Format

The snapshot schedule can be specified as zero or more snapshot intervals, each specifying the number of snapshots at a specific interval, with the following format:

<number of snapshots>@<interval length><interval unit> 

Multiple snapshot intervals can be specified separated by space, with the intervals in increasing order. The number of snapshots and intervals should be positive integers.

The supported snapshot units include minutes, hours, days and weeks. For months, quarters and years, both ‘Simple’ units (4-week based) and ‘Average’ units (365.25-day based) are supported. If a calendar-based schedule is needed (e.g. last day of each month), please see FAQ.

Snapshot Interval Unit Description
  m Minute
  h Hour
  d Day
  w Week
  n Simple month (4 weeks)
  q Simple quarter (12 weeks)
  y Simple year (48 weeks)
  M Average month (365.25 days / 12)
  Q Average quarter (365.25 days / 4)
  Y Average year (365.25 days)

The following table shows some example snapshot schedules.

Snapshot Schedule Description
  24@5m 36@10m 12@30m 48@1h 24 5-minute, 36 10-minute 12 30-minute and 48 hourly
  24@1h 7@1d 5@1w 10@2w 24 hourly, 7 daily, 5 weekly and 10 fortnightly
  365@1d Daily backup for one year
  52@1w Weekly backup with one-year retention


Default Snapshot Schedule

The table below shows the default automatic snapshot schedule. This schedule would be specified as 72@10m 72@1h 32@1d 16@1w.

Snapshot Interval Number of Snapshots
  10-minute 72  
  hourly 72  
  daily 32  
  weekly 16  


Custom Snapshot Schedule

Team, Corporate and Enterprise Plans Feature

You can specify a custom automatic snapshot schedule with ObjectiveFS 7.2 and newer. The custom schedule can be set using the following command:

mount.objectivefs snapshot -s "<schedule>" <filesystem>

A new custom schedule will remove any existing automatic snapshots that do not match the new schedule. If you wish to save some of the automatic snapshots, you can convert them into checkpoint snapshots by mounting the relevant snapshots.

Custom snapshots are compatible with older ObjectiveFS versions and the snapshot schedule can be updated without restarting any mounts. ObjectiveFS 7.2 is only needed to set the custom schedule. Existing mounts will pick up the new custom schedule within a few hours.

Custom snapshots can use any combination of intervals in increasing order, as long as the total number of snapshots does not exceed 900.

Example command to set the snapshot schedule for filesystem myfs to 24 hourly, 7 daily, 8 weekly:

mount.objectivefs snapshot -s "24@1h 7@1d 8@1w" myfs
Old automatic snapshot schedule: 72@10m 72@1h 32@1d 16@1w
New automatic snapshot schedule: 24@1h 7@1d 8@1w
Update snapshot schedule [y/n]? y
Snapshot schedule updated


Useful Snapshot Schedule Commands

1. Show Current Snapshot Schedule

The snapshot -l command shows the current snapshot schedule of the filesystem.

mount.objectivefs snapshot -l <filesystem>

Example:

# mount.objectivefs snapshot -l myfs
24@1h 7@1d 8@1w

2. Check Snapshot Schedules

The snapshot -s <schedule> command without a filesystem lets you check if a snapshot schedule is valid. This is useful when developing a new snapshot schedule prior to deployment.

mount.objectivefs snapshot -s <schedule>

Example:

# mount.objectivefs snapshot -s "5@2h 10@1d 4@3w"
5@2h 10@1d 4@3w

3. Generate a Sample Snapshot Schedule

The snapshot -vs <schedule> command without a filesystem will generate a sample historical snapshot timeline that would have been taken based on this schedule.

mount.objectivefs snapshot -vs <schedule>

Example:

# mount.objectivefs snapshot -vs "5@1h 5@1d 3@1w"
2024-02-08T00:00:00Z
2024-02-15T00:00:00Z
2024-02-21T00:00:00Z
2024-02-22T00:00:00Z
2024-02-23T00:00:00Z
2024-02-24T00:00:00Z
2024-02-25T00:00:00Z
2024-02-25T12:00:00Z
2024-02-25T13:00:00Z
2024-02-25T14:00:00Z
2024-02-25T15:00:00Z
2024-02-25T16:00:00Z
Number of automatic snapshots: 12
Automatic schedule: 5@1h 5@1d 3@1w

The example above shows only 12 automatic snapshots because the snapshot at timestamp 2024-02-21T00:00:00Z is used for both daily (i.e. oldest daily) and weekly (i.e. newest weekly) snapshots.

Disabling Automatic Snapshots

To disable automatic snapshots, you can set the snapshot schedule to an empty string.

mount.objectivefs snapshot -s "" <filesystem>

NOTE: This command will also delete all existing automatic snapshots. Please verify you do not need any existing automatic snapshots prior to running this command. If you wish to save some of the automatic snapshots, you can convert them into checkpoint snapshots by mounting the relevant snapshots.


Listing Snapshots

You can list the snapshots for your filesystem by running the list -sz (snapshot timestamp in UTC format, recommended) or list -s command (snapshot timestamp in local time). The snapshot listing command shows both automatic (auto in the SNAP column) and checkpoint (manual in the SNAP column) snapshots.

Snapshots have the format <filesystem>@<time>. You can list all snapshots for a filesystem or only snapshots matching a specific time prefix (see examples below).

Snapshot listing command format:

mount.objectivefs list -sz [filesystem[@<time>]]

Examples:
A. List the filesystem myfs and all its snapshots
Note: the last line of the output shows the filesystem

# mount.objectivefs list -sz myfs
NAME                             KIND  SNAP    REGION      LOCATION
s3://myfs@2023-11-23T00:00:00Z   ofs   manual  us-east-2   US East (Ohio)
s3://myfs@2023-12-21T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-01-18T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-01-25T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-01T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-08T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-21T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-21T05:27:00Z   ofs   manual  us-east-2   US East (Ohio)
s3://myfs@2024-02-21T12:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-25T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-25T14:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-25T15:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-25T16:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-25T17:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs                        ofs   on      us-east-2   US East (Ohio)

B. List all snapshots for myfs that match 2024-02-21 in UTC

# mount.objectivefs list -sz myfs@2024-02-21
NAME                             KIND  SNAP    REGION      LOCATION
s3://myfs@2024-02-21T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)
s3://myfs@2024-02-21T05:27:00Z   ofs   manual  us-east-2   US East (Ohio)
s3://myfs@2024-02-21T12:00:00Z   ofs   auto    us-east-2   US East (Ohio)

C. List all snapshots for myfs that match 2024-02-21T00 in UTC

# mount.objectivefs list -sz myfs@2024-02-21T00
NAME                             KIND  SNAP    REGION      LOCATION
s3://myfs@2024-02-21T00:00:00Z   ofs   auto    us-east-2   US East (Ohio)

Mounting and Unmounting Snapshots

Snapshots can be mounted to access the filesystem as it was at that point in time. When a snapshot is mounted, it is accessible as a read-only filesystem.

You can mount both automatic and checkpoint snapshots. When an automatic snapshot is mounted, a checkpoint snapshot for the same timestamp will be created to prevent the snapshot from being automatically removed in case its retention schedule expires while it is mounted. These checkpoint snapshots, when created for data recovery purpose only, are also included in all plans.

Snapshots can be mounted using the same keys used for mounting the filesystem. If you choose to use a different key, you only need read permission for mounting checkpoint snapshots, but need read and write permissions for mounting automatic snapshots.

A snapshot mount is a regular mount and will be counted as an ObjectiveFS instance while it is mounted.

Command to mount a snapshot:

# mount.objectivefs [-o <options>] <filesystem>@<time> <dir>
<filesystem>@<time>
The snapshot for the filesystem at a particular time. The time can be specified as local time or UTC (ends with Z) in the ISO8601 format. You can use the list snapshots command to get the list of available snapshots for your filesystem.
<dir>
Directory (full path name) to mount your file system snapshot.
This directory should be an existing empty directory.
<options>
You can also use the same mount options as mounting your filesystem (some of them will have no effect since the snapshot is mounted as a read-only only filesystem).

Example command to mount a filesystem in directory /ofssnap

# mount.objectivefs myfs@2024-02-08T00:30:00Z /ofssnap

Unmount Snapshots

To unmount a snapshot, use the regular unmount command.

# umount <directory>

Destroying Snapshots

To destroy a snapshot, use the regular destroy command with <filesystem>@<time>. Time should be specified in ISO8601 format (e.g. 2024-02-10T10:10:00) and can either be local time or UTC (ends with Z). Both automatic and checkpoint snapshots matching the timestamp will be removed.

Command to destroy a snapshot:

# mount.objectivefs destroy <filesystem>@<time>

Example:

# mount.objectivefs destroy s3://myfs@2024-02-20T02:27:54Z  
*** WARNING ***
The snapshot 's3://myfs@2024-02-20T02:27:54Z' will be destroyed. No other changes will be done to the filesystem.

Continue [y/n]? y
Snapshot 's3://myfs@2024-02-20T02:27:54Z' destroyed.

Snapshots and Backups

Snapshots are not backups since they are part of the same filesystem and are stored in the same bucket. A backup is an independent copy of your data stored in a different location.

Snapshots can be used to create a consistent point-in-time backup. You can mount a recent snapshot and use it as the source for backup, instead of running backup from your live filesystem. This way, your data will not change while the backup is in progress.

For information on how to backup your filesystem using a snapshot, see this document.

Recovering Files from Snapshots

The steps below describe how to recover files from a snapshot.

  1. Identify the snapshot you want to recover from using list snapshots.
# mount.objectivefs list -sz myfs@2024-02-25
  1. Mount the snapshot on an empty directory, e.g. /ofs-snap.
# mount.objectivefs myfs@2024-02-25T11:10:00Z /ofs-snap
  1. Mount your filesystem on another empty directory, e.g. /ofs.
# mount.objectivefs myfs /ofs
  1. Verify it is the right file to restore. Copy the file from the snapshot to your filesystem.
# cp /ofs-snap/<path to file> /ofs/<path to file>

FAQ

  1. How do I convert an automatic snapshot to a checkpoint snapshot?
    You can mount an automatic snapshot and this will create a checkpoint snapshot for the same timestamp.

  2. Does snapshot creation take a long time?
    Snapshots are fast to take and has very low overhead.

  3. How do I create a calendar-based snapshot schedule, e.g. snapshots on the 1st and 15th of every month?
    You can set up a cron job based on your preferred schedule to take checkpoint snapshots. Checkpoint snapshots are kept until they are explicitly removed using the destroy snapshot command.

  4. Can I use disk cache with snapshots?
    Yes, mounting snapshots with the same disk cache as your filesystem is safe. It can also improve performance by getting common data from the disk cache.

References

by ObjectiveFS staff, February 28, 2024
ObjectiveFS is a shared file system for Linux and macOS that automatically scales and gives you scalable cloud storage. If you have questions or article idea suggestions, please email us at support@objectivefs.com