The following pseudocode provides an example of using the volume APIs.
To shrink or grow a volume within a file system
vxresize
command to grow the physical volume.
vxfs_vol_resize
() call to shrink or grow the file system, create codes similar to the following:
/* stat volume "vol-03" to get the size information */
vxfs_vol_stat(fd, "vol-03", infop);
/* resize (shrink/grow) accordingly. This example shrinks
vxfs_vol_resize(fd, "vol-03", infop->dev_size / 2);
To encapsulate a raw volume as a file
vol-03
as a file named encapsulate_name
in the file system /mnt
, create code similar to the following:
/* Take the raw volume vol-03 and encapsulate it. The
volume's contents will be accessible through the given
vxfs_vol_encapsulate("/mnt/encapsulate_name", "vol-03",
/* Access to the volume is through writes and reads of file
encap_fd = open("/mnt/encapsulate_name");
To de-encapsulate a raw volume
vol-03
named encapsulate_name
in the file system /mnt
, create code similar to the following:
/* Use de-ecapsulate to remove raw volume. After
de-encapsulation, vol-03 is still part of volset, but is
not an active part of the file system. */
vxfs_vol_deencapsulate("/mnt/encapsulate_name");