Volume Encapsulation
Multi-volume support enables the ability to encapsulate an existing raw volume and make the volume contents appear as a file in the file system. There are two steps required to achieve this:
- Add the volume to an existing volume set.
- Add the volume to the file system using fsvoladm.
As an example, assume that the following volume set and new volume exist:
# vxvset list myvset
VOLUME INDEX LENGTH STATE CONTEXT
vol1 0 102400 ACTIVE -
vol2 1 102400 ACTIVE -
The volume set has two volumes. Create a third volume as part of the passwd file and write it to the volume. This is to demonstrate how the volume can be accessed as a file as shown later:
# vxassist make dbvol 100m
# dd if=/etc/passwd of=/dev/vx/rdsk/rootdg/dbvol count=1
1+0 records in
1+0 records out
Create a file system on the volume set and mount it. The new volume is added to the volume set:
# mkfs –F vxfs /dev/vx/rdsk/rootdg/myvset
version 6 layout
204800 sectors, 102400 blocks of size 1024, log size 1024 blocks
largefiles not supported
# mount –F vxfs /dev/vx/dsk/rootdg/myvset /mnt1
# vxvset addvol myvset dbvol
The final step is to call fsvoladm to perform the encapsulation:
# fsvoladm encapsulate /mnt1/dbfile dbvol 100m
# ls -l /mnt1/dbfile
-rw------- 1 root other 104857600 May 22 11:30 /mnt1/dbfile
# head -2 /mnt1/dbfile
root:x:0:1:Super-User:/:/sbin/sh
daemon:x:1:1::/:
Note that 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, for example, 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.
|