Home > Veritas Storage Foundation™ File System Manual Pages
FSCKPT_INTRO (3) |
Library Functions |
One of the most important properties of a Storage Checkpoint is that they can be created very quickly. This is done by creating a Storage Checkpoint object which consists of all user files mapping the original file system with the exception that their data is shared, not copied. A unique relationship is therefore established between the Storage Checkpoint object and the file system. The image of a Storage Checkpoint is preserved by using copy-on-write semantics. After a Storage Checkpoint is taken, files can continue to be created, removed or updated without affecting the logical image of the Storage Checkpoint. A Storage Checkpoint therefore, preserves not only the name space (directory hierarchy) of the file system, but also the user data as it was at the moment of its creation.
The file system in this context is also known as the primary image or fileset. In fact, the primary fileset does not need to be structurally much different than a checkpoint fileset, the exception being that the primary fileset will always contain a full copy of its image.
Since Storage Checkpoint filesets are updated on demand by using copy-on-write semantics, a map of all changed blocks is maintained by the Storage Checkpoint object. These changed blocks can be extremely valuable for backup applications and replication solutions since only the changed data may be retrieved. Access to this information may provide incredible advantages to these solutions by minimizing data movement many times. This information may additionally lead to higher availability and data integrity since the frequency of these backup/replication solutions may increase many times as well.
The VERITAS File System Checkpointing API allows applications to completely manage all Storage Checkpoints in the file system. Additionally, the API provides all the necessary functions to view a Storage Checkpointed name space and retrieve all blocks changed. Finally, a set of functions is provided to gather information and statistics from Storage Checkpointed filesets and files to properly manage and tune these file systems.
There are a couple of interesting situations that may arise due to the existence of Storage Checkpoints in file systems where the disk space becomes scarce. These are:
The following procedure is used in this example:
or
full(mountpoint) char *mountpoint; { void *chp, *ch[2]; void *fhp; struct c_extent ce; off_t off; char *buf; int error; if (error = fsckpt_fsopen(mountpoint, FSCKPT_VERSION, &chp)) { return error; } ch[0] = chp; ch[1] = NULL; fsckpt_create(&ch[0], "full", 0); fsckpt_setcontext(chp, "full"); chdir(mountpoint); for (each file) { fd = open(file, O_RDONLY); fsckpt_fopen(chp, NULL, file, &fhp); for (off = 0; off < file.size; off += ce.ce_len) { fsckpt_fbmap(fhp, off, &ce); /* * Skip holes in sparse files */ if (ce.ce_flags & CE_HOLE) { continue; } lseek(fd, off, SEEK_SET); buf = malloc(ce.ce_len); read(fd, *buf, ce.ce_len); backup(file, off, ce.ce_len, buf); free(buf); } fsckpt_fclose(fhp); close(fd); } fsckpt_clearcontext(chp); /* * If an incremental will be needed then */ if (incremental needed) { fsckpt_rename(chp, "full", "incr1"); fsckpt_cntl(chp, "incr1", CC_SET, CC_NODATA); } else { fsckpt_remove(chp, "full", 0); } fsckpt_fclose(chp); }
-Obtain blocks changed from
incr1
-Read stable name space and changed data from
tmp.
-Remove
incr1
-Rename
tmp
to
incr2
-Convert
incr2
to nodata (optional)
-Remove
tmp
-Rename
incr1
to
incr2
inc_bi(mountpoint) char *mountpoint; { void *chp, *ch[2]; void *fhp; struct c_extent ce; struct c_info cinfo; off_t off; int error; char *buf; if (error = fsckpt_fsopen(mountpoint, FSCKPT_VERSION, &chp)) { return error; } /* * Make sure "incr1" still exists and is valid */ if (error = fsckpt_info(chp, "incr1", 0, &cinfo)) { return error; } ch[0] = chp; ch[1] = NULL; fsckpt_create(&ch, "tmp", 0); fsckpt_setcontext(chp, "tmp"); chdir(mountpoint); for (each changed file) { fd = open(file, O_RDONLY); fsckpt_fopen(chp, "incr1", file, &fhp); for (off = 0; off < file.size; off += ce.ce_len) { fsckpt_fbmap(fhp, off, &ce); /* * If this file section has not changed or is * a hole in a sparse file, then skip */ if (!(ce.ce_flags & CE_CHANGED) || ce.ce_flags & CE_HOLE) { continue; } lseek(fd, off, SEEK_SET); buf = malloc(ce.ce_len); read(fd, *buf, ce.ce_len); backup(file, off, ce.ce_len, buf); free(buf); } fsckpt_fclose(fhp); close(fd); } fsckpt_clearcontext(chp); /* * leave Storage Checkpoints setup for next incremental * * at this point we may want the next block level incremental * to be another differential or a cumulative incremental. */ if (cumulative) { fsckpt_remove(chp, "tmp", 0); fsckpt_rename(chp, "incr1", "incr2"); } else { fsckpt_remove(chp, "incr1", 0); fsckpt_rename(chp, "tmp", "incr2"); fsckpt_cntl(chp, "incr2", CC_SET, CC_NODATA); } fsckpt_fclose(chp); }
list(mountpoint) char *mountpoint; { void *chp; struct c_info cinfo; int error, index; if (error = fsckpt_fsopen(argv[1], FSCKPT_VERSION, &chp)) { return error; } for (index = 1; ; index++) { if (error = fsckpt_info(chp, "primary", index, &cinfo)) { break; } print_cinfo(&cinfo); } if (error == ENOENT) { error = 0; } (void) fsckpt_fsclose(chp); return error;
Last updated: 01 April 2006
Copyright ©2009 Symantec Corporation
All rights reserved.