1. Private region at the beginning
Block zero of a sliced disk is used to hold the VTOC of the physical device. Nothing
should attempt to write to offset zero on any such disk, or it will place the contents
of the VTOC in jeopardy. File systems and boot blocks all offset at least one sector
when writing to a slice for exactly this reason. Private regions for VxVM also do this
to preserve the VTOC contents on that block.
A private region is placed at the beginning of a disk by default when that disk is
initialized. Block zero is protected by the fact that the data layout for a private
region does not place anything in location zero. The private region can also be
placed at the beginning of a disk during its encapsulation. The circumstances which
permit this are exceedingly rare, and typically only arise from careful manipulation
of the data ahead of time.
2. Private region at the end
A private region can be placed at the end of the disk if it is initialized with the '-e'
option to vxdisksetup. In so doing, no protection is granted to the critical VTOC
in block 0 so all subdisk offsets on this disk must be computed at N+1. It works, but
it is kind of a hack and can be confusing when you are trying to map to slices later.
An encapsulated disk is a disk with existing data to be preserved, such as the boot
disk, that is brought under Volume Manager control. In the case when a disk is
encapsulated, yet does not map all of its disk space to slices, the private regions are
often placed at the end of the disk. If free space exists at the end, that is where the
private region will be placed during the encapsulation process. Block zero is
'protected' in such cases by mapping a single-block subdisk at offset zero. That
subdisk is marked in such a way that it is not movable using conventional means.
VxVM Private Regions: Mechanics & Internals of the VxVM Configuration Database 11
3. Private region somewhere in the middle
The private region of a VxVM may even be at some arbitrary location within the
address space of the disk. This is the case when a disk is encapsulated, and the only
‘free’ space in which to place the private region is in the center of the disk. The most
common example of this is a boot disk encapsulation.
When a boot device is encapsulated, space for the private region is very typically
“stolen” from the last few cylinders of the swap space. Swap is shortened by the
required amount, and the private region slice is mapped into the now-available
diskspace. Since swap is almost never at the end of a disk, this places the new
private region somewhere in the middle of the disk.
This causes a number of problems. The most difficult is how to represent a single
private and a single public region on the disk. Recall that each region must be a slice,
and that slices are defined in terms of a starting point and offset. In the geometry of
our private-region-in-the-middle disk, we have some amount of data/public space, a
private region, then more data/public space. The private region is easy to map to a
slice. But what about the public region? It is non-contiguous; the private region
separates the two public data spaces. One way to solve this problem is to overlap the
two regions.
The public region is mapped to the entire disk, just as the backup slice (s2) is. The
private region is mapped to a slice as normal. This means that the private region lies
within the address space of both the public and private region's partitions. In order
to prevent a data volume from being created out of the space occupied by the
private region, VxVM must mask off that space in some way. It does this by creating
a subdisk within the public region which corresponds to the private region’s
location.These placement methods are necessary for dealing with encapsulated disks
in general and specifically with the boot disk. In most systems, VxVM manages the
boot device by encapsulating it. That disk has typically just been installed with the
Solaris operating system, and every bit of available space on the device has been
devoted to one file system or another in the standard OS install (or swap). Prior to
release of the Solaris 8 Operating Environment, this almost always meant two
things: the root file system begins at cylinder zero on the disk and the primary swap
partition is somewhere in the middle of the disk. These two conditions gave rise to
two special subdisks in rootdg: rootdisk-B0 and rootdiskPriv.
rootdisk-B0
The root file system beginning on cylinder zero will include the critical VTOC
block at offset 0 of the disk. UFS file systems and boot blocks are engineered
to skip over this critical information, so the VTOC data is protected by the
nature of the data on the slice. For a volume, this may or may not be the case.
Suppose that the encapsulated boot disk is recycled: rootvol and any other
subdisks, volumes or plexes on the disk are relocated to other disks, then new
12 VxVM Private Regions: Mechanics & Internals of the VxVM Configuration Database • July 2000
volumes are created from the now-vacant space formally occupied by the root
file system. There is no inherent protection for block zero, it is now at risk of
being over-written.
VxVM resolves this problem by creating a special subdisk which maps block
zero on the root disk, ‘rootdisk-B0’. This subdisk is configured in such a
way that it may not be moved or deleted without specific user intervention.
With rootdisk-B0 now guarding block zero of the disk, any new volumes
created here cannot overlap that space. rootdisk-B0 serves no other
purpose than to guard the VTOC.
rootdiskPriv
Because our boot device was full before encapsulation, VxVM took a small
amount of space from the swap device to create the private region. This very
likely placed the private region in the middle of the disk, which caused the
public and private regions to overlap on this device as was discussed earlier
in this section.
VxVM must find some way to ensure that as this disk is re-used as the system
ages, no volume is created in that part of the public region which corresponds
to the private region’s location. It does this by creating an unattached subdisk
in this space. The ‘rootdiskPriv’ subdisk guards the space in which the
private region resides.