Exercise #4: Snapshots

In this lab we will use the snapshot feature to create online copies of files.

Objectives:

Requirements:

  1. Complete Exercise 1: Installing the cluster
  2. A File System - Use Exercise 2 to create a file system if you do not already have one.

Step 1: Use a snapshot to backup a file

 

A snapshot is a point in time view of a file system. To see how snapshots operate you will create a file, take a snapshot, delete the file then restore the snapshot from the file.

  1. Create a file for testing in the /gpfs/fileset1 directory.
    echo "hello world:snap1" > /gpfs/fileset1/snapfile1
  2. Create a snapshot image using the mmcrsnapshot command
    # mmcrsnapshot fs1 snap1
    
    Writing dirty data to disk
    Quiescing all file system operations
    Writing dirty data to disk again
    Creating snapshot.
    Resuming operations.
  3. Modify the file for testing in the /gpfs/fileset1 directory.
    echo "hello world:snap2" >> /gpfs/fileset1/snapfile1
  4. Create a seconds snapshot image using the mmcrsnapshot command
    mmcrsnapshot fs1 snap2
  5. View the list of snapshots created using the mmlssnapshot command
    Example:
    # mmlssnapshot fs1
    gpfs1:~ # mmlssnapshot fs1
    Snapshots in file system fs1:
    Directory    SnapId    Status       Created
    snap1        2         Valid        Wed Sep 26 11:03:52 2007
    snap2        3         Valid        Wed Sep 26 11:04:52 2007
  6. Delete the file /gpfs/fileset1/snapfile1 Now that the file is deleted let's see what is in the snapshots:
  7. Take a look at the snapshot images. To view the image change directories to the .snapshot directory
    cd /gpfs/.snapshots

    What directories do you see? _____________________

  8. Compare the snapfile1 stored in each snapshot
    cat snap1/fileset1/snapfile1
    cat snap2/fileset1/snapfile1

    Are the file contents the same? _______________

  9. To restore the file from the snapshot copy the file back into the original location
    cp /gpfs/.snapshots/snap1/fileset1/snapfile1 /gpfs/fileset1/snapfile1
  10. When you are done with a snapshot you can delete the snapshot. Delete both of these snapshots using the mmdelsnapshot command
    mmdelsnapshot fs1 snap1
    mmdelsnapshot fs1 snap2
  11. Verify the snapshots were deleted using the mmlssnapshot command
    mmlssnapshot fs1