3    Encapsulating Existing Data to LSM Volumes

After the LSM software is set up, as described in Chapter 2, you may want to migrate, or encapsulate, existing file systems or data into LSM volumes. If you do not want to do this, see Chapter 5 for information on how to configure new disks for use with the LSM software and how to create LSM volumes.

LSM provides commands that you use to configure existing file systems and data into LSM volumes, without physically moving the data. This process is called encapsulation. LSM supports data encapsulation of:

During the encapsulation process, the LSM software transforms disks, partitions, or AdvFS file domains into LSM volumes. You supply a device name, a device's partition, or an AdvFS domain name that the LSM software uses to identify how the device is used, and LSM creates an LSM volume to cover those areas on the disk.

This chapter describes how to encapsulate disks, partitions, and AdvFS file domains. See Chapter 4 for information on encapsulating the boot disk.

3.1    Encapsulation Requirements

The following conditions must be met before you can encapsulate data:

3.2    Encapsulating Disks and Disk Partitions

The encapsulation process changes disks and disk partitions into LSM disks.

The partitions on a disk are mapped by a partition table using the disklabel command. The partition and disk label have the following characteristics:

Each available partition has a special device file in the /dev directory. Users and applications access storage through these special device files.

The LSM encapsulation process uses information in the disk label and the /etc/fstab file to find out if a partition is in use, for example if it contains a UFS file system. If the partition does not have information in a disk label or /etc/fstab file, the encapsulation process uses the partition name.

Follow these steps to encapsulate a disk or disk partitions:

  1. Create the LSM script that contain the LSM commands that creates LSM volumes for a disk or disk partitions by entering the following command:

    # volencap {disk_name | partition_name}

    For example, to create an encapsulation script for a disk called dsk3, enter:

    # volencap dsk3

    To create an encapsulation script for partitions called dsk4g and dsk5h, enter:

    # volencap dsk4g dsk5h

  2. Complete the encapsulation process by entering the following command:

    # volreconfig

    If any partition or disk that was encapsulated is still in use, the volreconfig command prompts you to reboot the system.

After the encapsulation, LSM converts each disk or partition to a nopriv LSM disk. LSM then creates a subdisk that maps the entire disk or partition. LSM uses the subdisk to create a plex and, in turn, uses the plex to create an LSM volume. Entries in the /etc/fstab file or in the /etc/sysconfigtab file are changed to use the LSM volume name instead of the block device name of the disk or disk partition.

3.3    Encapsulating AdvFS Domains

If an AdvFS domain consists of one disk partition, you can encapsulate it for use with the LSM software using the procedure described in Section 3.2. If the AdvFS domain consists of multiple disk partitions, it may be more convenient to encapsulate the AdvFS domain instead of the individual disk partitions. When encapsulating the AdvFS domain, each physical device in the domain is encapsulated into an LSM volume by changing the links in the domain tree to point to the LSM volumes.

LSM volumes encapsulated from domain physical devices must reflect the exact data at the exact Logical Block Number (LBN) location as the physical device. The entire LBN range of the LSM nopriv disk is defined as one LSM subdisk. A plex is created with this subdisk and an LSM volume is created with the plex.

No mount point changes are necessary during encapsulation, because the mounted filesets are abstractions to the domain. The domain can be activated normally after the encapsulation process completes. Once the domain is activated, the filesets remain unchanged and the encapsulation is transparent to AdvFS domain users.

Follow these steps to encapsulate an AdvFS domain:

  1. Make sure that the AdvFS domain is not in use and all filesets are unmounted.

  2. Create the LSM script that contain the LSM commands that creates LSM volumes for an AdvFS domain by entering the following command:

    # volencap domain_name

    For example, to create an encapsulation script for an AdvFS domain called dom1, enter:

    # volencap dom1

  3. Complete the encapsulation process by entering the following command:

    # volreconfig

    If the AdvFS file domain is mounted, the volreconfig command prompts you to reboot the system.

The /etc/fdmns directory is updated on successful creation of LSM volumes.

3.4    Preserving Block 0

Block 0 on a disk device contains the disk label and is read-only by default. UFS, AdvFS, and swap do not use block 0 when putting data on device partitions. To preserve the Logical Block Number (LBN) mapping for a disk partition that includes block 0 on the disk, the LSM nopriv disk must also start at LBN block 0. As long as this disk is used for UFS, AdvFS, and swap volumes, this does not present a problem.

However, if the LSM nopriv disk is later reused for applications that write to block 0, then a write failure occurs. To help avoid such failures, you should remove this nopriv disk from the LSM disk group and readd the disk as a sliced disk if the volume is no longer needed.

The voldiskadd and voldisksetup commands automatically map out block 0 when adding sliced or simple disks for use with the LSM software. It is recommended that you use these commands to add disks to LSM. See Chapter 5 for more information on adding disk for use with the LSM software.

3.5    Unencapsulating LSM Volumes

When you unencapsulate an LSM volume, the LSM nopriv disk is removed, and the disk label's fstype filed is marked unused. A disk label type of unused does not check for overlaps and can cause a user to inadvertently overwrite the disk without warning. Use the disklabel command to set the fstype field to the appropriate file system type. For example, a disk partition used for AdvFS should be labeled AdvFS. A disk partition used for used for UFS should be labeled 4.2BSD. See the disklabel(8) reference page for information on setting the fstype field.

3.5.1    Unencapsulating UNIX Partitions

Follow these steps to unencapsulate LSM volumes and return to using disk partitions:

  1. Disable the volume by entering the following command:

    # volume [-g disk_group] stop volume_name

    For example, to disable a volume called vol-dsk4g in the staffdg disk group, enter:

    # volume -g staffdg stop vol-dsk4g

  2. Remove the volume recursively by deleting the volume, plexes, and subdisks by entering the following command:

    # voledit [-g disk_group] -rf rm volume_name

    For example, to recursively remove a volume called vol-dsk4g from the staffdg disk group enter:

    # voledit -g staffdg -rf rm vol-dsk4g

  3. Remove the disk media records from LSM control by entering the following command:

    # voldg rmdisk disk_name

    For example, to remove the disk media record for a disk called dsk4g, enter:

    # voldg rmdisk dsk4g

  4. Remove the disk access records from LSM control by entering the following command:

    # voldg rm disk_name

    For example, to remove the disk access record for a disk called dsk4g, enter:

    # voldisk rm dsk4g

  5. Use the disklabel command to set the fstype field to the appropriate file system type. See the disklabel(8) reference page for information on setting the fstype field.

  6. Edit the /etc/fstab file to mount the file system that is on the partition.

3.5.2    Unencapsulating AdvFS Domains

Follow these steps to unencapsulate LSM volumes and return to using AdvFS domains. The following example moves the volume called vol-dsk4e, in the staffdg disk group on the dsk4e partition to the AdvFS domain called dom1.

  1. Make sure that the volume is not mounted or in use, then disable the volume by entering the following command:

    # volume [-g disk_group] stop volume_name

    For example, to disable a volume called vol-dsk4e in the staffdg disk group, enter:

    # volume -g staffdg stop vol-dsk4e

  2. Remove the volume recursively by deleting the volume, plexes, and subdisks by entering the following command:

    # voledit [-g disk_group] -rf rm volume_name

    For example, to recursively remove a volume called vol-dsk4e from the staffdg disk group enter:

    # voledit -g staffdg -rf rm vol-dsk4e

  3. Remove the disk media records from LSM control by entering the following command:

    # voldg rmdisk disk_name

    For example, to remove the disk media record for a disk called dsk4e, enter:

    # voldg rmdisk dsk4e

  4. Remove the disk access records from LSM control by entering the following command:

    # voldg rm disk_name

    For example, to remove the disk access record for a disk called dsk4e, enter:

    # voldisk rm dsk4e

  5. Change the domain disk link by entering the following commands:

    # cd /etc/fdmns/domain_name
    # rm volume_name
    # ln -s /dev/disk/disk_name disk_name
    

  6. Use the disklabel command to set the fstype field to the appropriate file system type. See the disklabel(8) reference page for information on setting the fstype field.