Managing file spaces
Because file spaces are important to the operation of the system, a separate set of calls is used to register, update, and delete file space identifiers. Before you can store any objects that are associated with a file space on the system, you must first register the file space with IBM® Storage Protect.
Use the dsmRegisterFS call to accomplish this task. For more information about object names and IDs, see Object names and IDs.
The file space identifier is the top-level qualifier in a three-part name hierarchy. Grouping related data together within a file space makes management of that data much easier. For example, either the application client or the IBM Storage Protect server administrator can delete a file space and all the objects within that file space.
| Type | Definition |
|---|---|
| fstype | The file space type. This field is a character string that the application client sets. |
| fsAttr[platform].fsInfo | A client information field that is used for client-specific data. |
| capacity | The total amount of space in the file space. |
| occupancy | The amount of space that is currently occupied in the file space. |
| backStartDate | The time stamp when the latest backup started (set by sending a dsmUpdateFS call). |
| backCompleteDate | The time stamp when the latest backup completed (set by sending a dsmUpdateFS call). |
Using capacity and occupancy depends on the application client. Some applications might not need information about the size of the file space, in which case these fields can default to 0. For more information about querying file spaces, see Querying the IBM Storage Protect system.
After a file space is registered with the system, you can back up or archive objects at any time. To update the occupancy and the capacity fields of the file space after a backup or archive operation, call dsmUpdateFS. This call ensures that the values for the occupancy and capacity of the file system are current. You can also update the fsinfo, backupstart, and backupcomplete fields.
If you want to monitor your last backup dates, enter a dsmUpdateFS call before you start the backup. Set the update action to DSM_FSUPD_BACKSTARTDATE. This forces the server to set the backStartDate field of the file space to the current time. After the backup is complete for that file space, enter a dsmUpdateFS call with the update action that is set to DSM_FSUPD_BACKCOMPLETEDATE. This call creates a time stamp on the end of the backup.
If a file space is no longer needed, you can delete it with the dsmDeleteFS command. On a UNIX or Linux® operating system, only the root user or authorized users can delete file spaces.
/* Register the file space if it has not already been done. */
dsInt16 rc;
regFSData fsData;
char fsName[DSM_MAX_FSNAME_LENGTH];
char smpAPI[] = "Sample-API";
strcpy(fsName,"/home/tallan/text");
memset(&fsData,0x00,sizeof(fsData));
fsData.stVersion = regFSDataVersion;
fsData.fsName = fsName;
fsData.fsType = smpAPI;
strcpy(fsData.fsAttr.unixFSAttr.fsInfo,"Sample API FS Info");
fsData.fsAttr.unixFSAttr.fsInfoLength =
strlen(fsData.fsAttr.unixFSAttr.fsInfo) + 1;
fsData.occupancy.hi=0;
fsData.occupancy.lo=100;
fsData.capacity.hi=0;
fsData.capacity.lo=300;
rc = dsmRegisterFS(dsmHandle,fsData);
if (rc == DSM_RC_FS_ALREADY_REGED) rc = DSM_RC_OK; /* already done */
if (rc)
{
printf("Filespace registration failed: ");
rcApiOut(dsmHandle, rc);
free(bkup_buff);
return (RC_SESSION_FAILED);
}
/* Update the file space. */
dsmFSUpd updFilespace; /* for update FS */
updFilespace.stVersion = dsmFSUpdVersion;
updFilespace.fsType = 0; /* no change */
updFilespace.occupancy.hi = 0;
updFilespace.occupancy.lo = 50;
updFilespace.capacity.hi = 0;
updFilespace.capacity.lo = 200;
strcpy(updFilespace.fsAttr.unixFSAttr.fsInfo,
"My update for filespace") ;
updFilespace.fsAttr.unixFSAttr.fsInfoLength =
strlen(updFilespace.fsAttr.unixFSAttr.fsInfo);
updAction = DSM_FSUPD_FSINFO |
DSM_FSUPD_OCCUPANCY |
DSM_FSUPD_CAPACITY;
rc = dsmUpdateFS (handle,fsName,&updFilespace,updAction);
printf("dsmUpdateFS rc=%d\n", rc);
/* Delete the file space. */
printf("\nDeleting file space
rc = dsmDeleteFS (dsmHandle,fsName,DSM_REPOS_ALL);
if (rc)
{
printf(" FAILED!!! ");
rcApiOut(dsmHandle, rc);
}
else printf(" OK!\n");