Encapsulating a volume

The following example illustrates how to encapsulate a volume.

To encapsulate a volume

  1. List the volumes:
      # vxvset -g dg1 list myvset
    VOLUME    INDEX  LENGTH       KSTATE      CONTEXT
    vol3       0     104857600    ENABLED       -
    vol2       1     104857600    ENABLED       -
    

    The volume set has two volumes.

  2. Create a third volume and copy the passwd file to the third volume:
      # vxassist -g dg1 make dbvol 100m
      # dd if=/etc/passwd of=/dev/vx/rdsk/dg1/dbvol count=1
      1+0 records in
      1+0 records out

    The third volume will be used to demonstrate how the volume can be accessed as a file, as shown later.

  3. Create a file system on the volume set:
    # /opt/VRTS/bin/mkfs /dev/vx/rdsk/dg1/myvset
      version 10 layout
      134217728 sectors, 67108864 blocks of size 1024, log size 65536 blocks
      rcq size 4096 blocks
      largefiles supported
      maxlink  supported 
    
  4. Mount the volume set:
      # /opt/VRTS/bin/mount /dev/vx/dsk/dg1/myvset /mnt1
  5. Add the new volume to the volume set:
      # vxvset -g dg1 addvol myvset dbvol
  6. Encapsulate dbvol:
      # fsvoladm encapsulate /mnt1/dbfile dbvol 100m
      # ls -l /mnt1/dbfile
      -rw------- 1 root other 104857600 May 22 11:30 /mnt1/dbfile
  7. Examine the contents of dbfile to see that it can be accessed as a file:
      # head -2 /mnt1/dbfile
      root:x:0:1:Super-User:/:/sbin/sh
      daemon:x:1:1::/:

    The passwd file that was written to the raw volume is now visible in the new file.

    Note:

    If the encapsulated file is changed in any way, such as if the file is extended, truncated, or moved with an allocation policy or resized volume, or the volume is encapsulated with a bias, the file cannot be de-encapsulated.