Contents
- Introduction
- The Basics of the Snapshot System
- Useful Snapshot Commands
- More Information about Snapshots
Introduction
Snapshots are a feature of the Network Appliance filer's file system. The filer is a network attached storage device, used to centralize storage of information.
Snapshots are used as the primary system for data backup. They, along with tape backups, for disaster recovery, make up the ICS backup system. A snapshot is a read-only copy of the entire file system, saved at a specific time. The active file system is the current working file system; where you can modify and delete files.
Most importantly, Snapshots are an easy way to recover recently lost data. Any client of a filer may access the snapshot directory to recover older versions of files that may have been accidentally deleted or changed.
The Basics of the Snapshot System
Anyone with a home directory or data directory on the filer has access to snapshots. At the point where the filer is mounted there is a directory called .snapshot (the dot is included in the name). There is also a hidden .snapshot directory at each level below the mount point, but this hidden directory will not show up unless explicitly named. The mount point is the place where the filer's file system is attached, through NFS, to a remote machine's file system.
All of the .snapshot directories are read only. They can be accessed using regular unix commands, (cd, cp, ls... etc). All that is neccesary to recover a lost file is to cd into the .snapshot directory heirarchy and cp the relevant files back to the active file system. You can tell if your current directory is on the filer with the df command.
Useful Snapshot Commands
- man
- The man command can be used to find out information on available unix commands.
- df
- This command can be used to find out if your current directory is on the filer.
- cd
- This command can be used to change to the relevant directory in the .snapshot heirarchy.
- ls
- Using the -lu option in the .snapshot directory can identify the date the Snapshot was taken.
- cp
- The cp command can be used to move the desired file to the active file system.
Example:
(note: the following example uses the tcsh shell)Log in to your Unix account and change directory to where you lost the file. (Note the lost file Must reside on the filer.)
4:25pm user@hostname ~ % cd ImportantDocs
4:25pm user@hostname ~/ImportantDocs %
Now you can use the df command to check if you are on the filer.
4:25pm user@hostname ~/ImportantDocs % df ~/ImportantDocs
/home/user (filer:/vol/vol0/home/user): 5385152 blocks 10345401 filesNote the name filer will be replaced by the name of the ICS filer. (data, or nas)
Next cd to the .snapshot directory.
4:25pm user@hostname ~/ImportantDocs % cd .snapshot
4:25pm user@hostname ~/ImportantDocs/.snapshot %
Using 'ls -lu' here will show the dates the snapshots were taken.
4:25pm user@hostname ~/ImportantDocs/.snapshot % ls -lu
total 160
drwx--x--x 21 user group 4096 Feb 7 00:02 nightly.0
drwx--x--x 21 user group 4096 Feb 6 00:02 nightly.1
drwx--x--x 22 user group 4096 Jan 28 00:00 nightly.10
drwx--x--x 22 user group 4096 Jan 27 00:00 nightly.11
drwx--x--x 22 user group 4096 Jan 26 00:00 nightly.12
drwx--x--x 22 user group 4096 Jan 25 00:00 nightly.13
drwx--x--x 22 user group 4096 Jan 24 00:00 nightly.14
drwx--x--x 22 user group 4096 Jan 23 00:00 nightly.15
drwx--x--x 22 user group 4096 Jan 22 00:00 nightly.16
drwx--x--x 22 user group 4096 Jan 21 00:00 nightly.17
drwx--x--x 22 user group 4096 Jan 20 00:00 nightly.18
drwx--x--x 22 user group 4096 Jan 19 00:00 nightly.19
drwx--x--x 21 user group 4096 Feb 5 00:02 nightly.2
drwx--x--x 21 user group 4096 Feb 4 00:02 nightly.3
drwx--x--x 21 user group 4096 Feb 3 00:02 nightly.4
drwx--x--x 21 user group 4096 Feb 2 00:02 nightly.5
drwx--x--x 21 user group 4096 Feb 1 00:02 nightly.6
drwx--x--x 20 user group 4096 Jan 31 00:02 nightly.7
drwx--x--x 20 user group 4096 Jan 30 00:02 nightly.8
drwx--x--x 22 user group 4096 Jan 29 00:01 nightly.9
Next cd into the directory that has the date the lost file exsited on. Say a lost file exsited February 5th; we would then cd to nightly.2
4:25pm user@hostname ~/ImportantDocs/.snapshot % cd nightly.2
4:25pm user@hostname ~/ImportantDocs/.snapshot/nightly.2 %
Now we are in an instance of the ImportantDocs directory as it existed on February 5th. We can now copy our lost file out to the active file system using the cp command.
4:25pm user@hostname ~/ImportantDocs/.snapshot/nightly.2 % ls
ImportantFile1 JunkFile1 Junkfile2 JunkFile3
4:25pm user@hostname ~/ImportantDocs/.snapshot/nightly.2 % cp ImportantFile1 ~/ImportantDocs/ImportantFile1.restored (this is typed all on one line)
To copy a file out of the .snapshot directory it must have a different name than the original file, also the name snapshot is reserved.
A file or directory can not be named "snapshot".
More Information about Snapshots
The Snapshots are taken on a daily basis. The Snapshots are kept for thirty days. It is ICS policy to keep backup data for One Month only. If your home directory is not on the NetApp you can send a request for a tape restore to helpdesk@ics.uci.edu