B    Converting File Systems

This appendix contains procedures to convert a /usr file system, the root file system, and a data file system to AdvFS. Also included are instructions for converting your entire system from AdvFS to UFS.

The methods provided here are guidelines; that is, they are suggestions that illustrate the process of conversion. Specific file names, tape drives, and disk partitions depend on your system.

The vdump and vrestore file formats are compatible for Version 4 and Version 5.0 operating systems. If you upgrade to Version 5.0, recreate the file domains, and restore the data from backup (see Chapter 4), your AdvFS filesets and file domains will have the updated structure (see Section 2.3.3).

B.1    Converting a /usr File System to AdvFS

During the initial installation of AdvFS, you can install /usr on AdvFS. Converting the /usr (UFS) file system to AdvFS reduces the amount of time your system is down after a system failure. If you have not installed /usr on AdvFS, you can do so with:

B.1.1    Using a Backup Tape

You can convert the /usr (UFS) file system to an equivalent AdvFS file system by backing up the existing file system to tape and restoring it to an AdvFS environment.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guide for converting the file system:

  1. Log in as root on the system containing the /usr file system.

  2. Use the AdvFS vdump command to back up the /usr file system to /dev/tape/tape0:

    # mt rewind
    # cd /usr
    # vdump -0 .
    

  3. Edit the /etc/fstab file.

    1. Search for the entry that mounts /usr as a UFS file system, such as:

      /dev/disk/dsk3g /usr ufs rw 1 2
      

    2. Replace it with one that mounts /usr as an AdvFS file system:

      usr_domain#usr /usr advfs rw 1 0
      

  4. Shut down the system:

    # shutdown -h now
    

  5. Reboot the system in single-user mode. See System Administration for instructions on invoking single-user mode.

  6. In single-user mode, mount the root file system as rw. Create the usr_domain file domain, and create the usr fileset. Use the -F option with the mkfdmn command to force the partition label to change from UFS to AdvFS and to avoid a warning message.

    # mount -u /
    # mkfdmn -F /dev/disk/dsk3g usr_domain
    # mkfset usr_domain usr
    

  7. Mount the usr fileset on the /usr directory:

    # mount -t advfs usr_domain#usr /usr
    

  8. Restore the /usr file system from tape to the usr fileset:

    # vrestore -x -D /usr
    

  9. Boot the system to multiuser mode. When the system prompt returns, the converted /usr file system is ready to use.

B.1.2    Using an Intermediate File

You can convert the /usr (UFS) file system to the equivalent AdvFS file system by backing up the existing file system to a file and restoring it to an AdvFS environment.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guide for converting the /usr file system:

  1. Log in as root on the system containing the /usr file system.

  2. Use the AdvFS vdump command to back up the /usr file system to /tmp/usr_bck, the intermediate file:

    # cd /usr
    # vdump -0f /tmp/usr_bck /usr
    

  3. Edit the /etc/fstab file.

    1. Search for the entry that mounts /usr as a UFS file system:

      /dev/disk/dsk3g /usr ufs rw 1 2
      

    2. Replace it with one that mounts /usr as an AdvFS file system:

      usr_domain#usr /usr advfs rw 1 0
      

  4. Shut down the system:

    # shutdown -h now
    

  5. Reboot the system in single-user mode. See System Administration for instructions on invoking single-user mode.

  6. In single-user mode, mount the root file system as rw, create the usr_domain file domain, and create the usr fileset. Use the -F option with the mkfdmn command to force the partition label to change from UFS to AdvFS and to avoid a warning message.

    # mount -u /
    # mkfdmn -F /dev/disk/dsk3g usr_domain
    # mkfset usr_domain usr
    

  7. Mount the usr fileset on the /usr directory:

    # mount -t advfs usr_domain#usr /usr
    

  8. Restore the /usr file system from the intermediate file to the usr fileset:

    # vrestore -xf /tmp/usr_bck -D /usr
    

  9. Boot the system to multiuser mode. When the system prompt returns, the converted /usr file system is ready to use.

B.1.3    Using a Second Disk

You can convert the /usr (UFS) file system on one disk to the equivalent /usr (AdvFS) file system on a different target disk.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guide for converting the /usr file system:

  1. Log in as root on the system containing the /usr file system.

  2. Create a file domain and fileset:

    # mkfdmn /dev/disk/dsk2c usr_domain
    # mkfset usr_domain usr
    

  3. Create a mount-point directory and mount the new fileset on the directory:

    # mkdir /usr.advfs
    # mount -t advfs usr_domain#usr /usr.advfs
    

  4. Change to the /usr directory:

    
    # cd /usr
    

  5. Be certain there is no activity on the system. (You can do this by bringing the system to single-user mode.) Copy the contents of the UFS file system to the AdvFS file system:

    # vdump -0f - -D . | vrestore -xf - -D /usr.advfs
    

  6. Edit the /etc/fstab file.

    1. Search for the entry that mounts /usr as a UFS file system, such as:

      /dev/disk/dsk3g /usr ufs rw 1 2
      

    2. Replace it with one that mounts /usr as an AdvFS file system:

      usr_domain#usr /usr advfs rw 1 0
      

  7. Remove the temporary directory.

    # umount /usr.advfs
    # rmdir /usr.advfs
    

  8. Shut down and reboot the system. When the system prompt returns, the converted /usr file system is ready to use.

B.2    Converting the root File System to AdvFS

By converting the root file system to AdvFS, you can boot your system from an AdvFS file domain and use AdvFS as the root (/) file system. The AdvFS root file domain must reside on a single disk. During initial installation you can install root on AdvFS. If you do not, you can use the following method.

Note

Before you begin the conversion, check the size of the existing UFS root partition. The target AdvFS root file domain can contain only one volume and must be large enough to accommodate the converted root file system.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guide for converting the root file system. This example assumes an rz28 disk.

  1. Log in as root on the system containing the root file system.

  2. Create a file domain and fileset:

    
    # mkfdmn -r -t rz28 /dev/disk/dsk2a root_domain
    # mkfset root_domain root
    

  3. Create a mount-point directory and mount the new fileset on the directory:

    # mkdir /newroot
    # mount -t advfs root_domain#root /newroot
    

  4. Be certain there is no activity on the system. (You can do this by bringing the system to single-user mode.) Restore the UFS root file system to the root fileset:

    # vdump 0f - / | (cd /newroot; vrestore -xf -)
    

  5. Make the disk with the root file domain a bootable disk:

    # disklabel -r /dev/rdisk/dsk2a > /tmp/dsk2label
    # disklabel -t advfs -r -R /dev/rdisk/dsk2a /tmp/dsk2label rz28
    

  6. Edit the /etc/fstab file on the AdvFS root fileset to indicate the new root entry.

    1. Search /newroot/etc/fstab for the entry that mounts root as a UFS file system, such as:

      /dev/disk/dsk1a / ufs rw 1 1
      

    2. Replace it with one that mounts root as an AdvFS file system:

      root_domain#root / advfs rw 1 0
      

  7. After editing is complete, shut down the system:

    # shutdown -h now
    

  8. Reset the boot default device, BOOTDEF_DEV, to point to the disk with the new root file domain. This procedure is hardware-specific. Refer to your hardware manual for instructions.

  9. Reboot the system to enable the AdvFS root file system.

The converted root file system is ready to use.

Because the AdvFS root file domain is limited to one disk, you cannot use the addvol command to extend the root file domain.

B.3    Converting a Data File System to AdvFS

By converting your data file systems to AdvFS, you can eliminate lengthy reboots. Moreover, you can easily modify your file system configurations to meet changing system requirements.

You can convert data file systems from UFS to AdvFS with:

B.3.1    Using a Backup Tape

You can convert a data (UFS) file system to the equivalent data (AdvFS) file system by backing up the existing file system to tape with the vdump command and restoring it with the vrestore command to an AdvFS environment.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guide for converting the /staff2 file system:

  1. Log in as root on the system containing the /staff2 file system.

  2. Use the AdvFS vdump command to back up the /staff2 file system to /dev/tape/tape0, the default tape drive:

    # mt rewind
    # mount /staff2
    # vdump -0f /dev/tape/tape0 /staff2
    # umount /staff2
    

  3. Create the staff_domain file domain and the staff2 fileset. Use the -F option with the mkfdmn command to force the partition label to change from UFS to AdvFS and to avoid a warning message.

    # mkfdmn -F /dev/disk/dsk2c staff_domain
    # mkfset staff_domain staff2
    

  4. Mount the new fileset on the directory:

    # mount -t advfs staff_domain#staff2 /staff2
    

  5. Restore the /staff2 file system from tape to the staff2 fileset:

    # vrestore -xvf /dev/tape/tape0 -D /staff2
    

  6. Edit the /etc/fstab file.

    1. Search for the entry that mounted /staff2 as a UFS file system:

      /dev/disk/dsk2c /staff2 ufs rw 1 2
      

    2. Replace it with one that mounts /staff2 as an AdvFS file system:

      staff_domain#staff2 /staff2 advfs rw 1 0
      

The converted /staff2 file system is ready to use.

B.3.2    Using an Intermediate File

You can convert a data (UFS) file system to the equivalent data (AdvFS) file system by backing up the existing file system to a file and restoring it to an AdvFS environment.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guide for converting the /staff2 file system:

  1. Log in as root on the system containing the /usr file system.

  2. Use the AdvFS vdump command to back up the /staff2 file system to /tmp/staff_bck, the intermediate file:

    # vdump -0f /tmp/staff_bck /staff2
    

  3. Create the staff_domain file domain and the staff2 fileset. Use the -F option with the mkfdmn command to force the partition label to change from UFS to AdvFS and to avoid a warning message.

    # mkfdmn -F /dev/disk/dsk3g staff_domain
    # mkfset staff2
    

  4. Edit the /etc/fstab file:

    1. Search for the entry that mounts /staff2 as a UFS file system:

      /dev/disk/dsk3g /staff2 ufs rw 1 2
      

    2. Replace it with one that mounts /staff2 as an AdvFS file system:

      /staff_domain#staff2 /staff2 advfs rw 1 0
      

  5. Mount the staff2 fileset on the /staff2 directory by entering the following command:

    # mount -t advfs staff_domain#staff2 /staff2
    

  6. Restore the /staff2 file system from the intermediate file to the staff2 fileset:

    # vrestore -xf /tmp/staff_bck -D /staff2
    

The converted /staff2 file system is ready to use.

B.3.3    Using a Second Disk

You can convert a data (UFS) file system on one disk to the equivalent data (AdvFS) file system on a different target disk.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guide for converting the /staff2 file system:

  1. Log in as root on the system containing the /staff2 file system.

  2. Create the staff_domain file domain and staff2 fileset:

    # mkfdmn /dev/disk/dsk2c staff_domain
    # mkfset staff_domain staff2
    

  3. Create a mount-point directory and mount the new fileset on the directory:

    # mkdir /new_staff2
    # mount -t advfs staff_domain#staff2 /new_staff2
    

  4. Be certain there is no activity on the system. Copy the contents of the UFS file system to the AdvFS file system:

    # vdump -0f - -D /staff2 | vrestore -xf - -D /new_staff2
    

  5. Edit the /etc/fstab file:

    1. Search for the entry that mounts /staff2 as a UFS file system, such as:

      /dev/disk/dsk3g /staff2 ufs rw 1 2
      

    2. Replace it with one that mounts /staff2 as an AdvFS file system:

      staff_domain#staff2 /staff2 advfs rw 1 0
      

  6. Unmount /new_staff2:

    # umount /new_staff2
    

  7. Unmount /staff2:

    # umount /staff2
    

  8. Remove the old directory:

    # rmdir /staff2
    

  9. Mount the new fileset.

    # mount /staff2
    

B.3.4    Using a Second System

You can transfer an existing data file system to a new system, then you can convert the file system to AdvFS.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guide for converting the staff4 file system:

  1. Log in to the system containing the /staff4 file system and back up the file system to tape:

    # tar c /staff4
    

  2. Log in as root user on the target system.

  3. Create the staff_domain file domain and the staff4 fileset:

    # mkfdmn /dev/disk/dsk2c staff_domain
    # mkfset staff_domain staff4
    

  4. Create a mount-point directory and mount the new fileset on the directory:

    # mkdir /staff4
    # mount -t advfs staff_domain#staff4 /staff4
    

  5. Restore the /staff4 file system from the default tape drive, /dev/tape/tape0:

    # mt rewind
    # tar x /staff4
    

  6. Edit the /etc/fstab file to add an entry that mounts /staff4 as a UFS file system:

    staff_domain#staff4 /staff4 advfs rw 1 0
    

The staff_domain file domain now includes the staff4 fileset, which is ready to use.

B.4    Converting from AdvFS to UFS

Converting your entire system from AdvFS to UFS is a multistep process. You first convert the AdvFS root file system to UFS. Then you convert each AdvFS fileset to a UFS file system.

B.4.1    Converting the root File System to UFS

To convert the root file system, you must mount a UFS disk while your AdvFS root fileset is mounted.

The following are required:

Assumed system configurations are as follows:

Use the following procedure as a guideline for converting your file system:

  1. Log in as root user.

  2. Create a UFS file system:

    # newfs /dev/disk/dsk2a rz28
    

  3. Create a mount-point directory and mount the UFS file system:

    # mkdir /newroot
    # mount -t ufs /dev/disk/dsk2a /newroot
    

  4. Restore the AdvFS root file system to the /dev/disk/dsk2a UFS file system:

    # vdump -0f - / | (cd /newroot; vrestore -xf -)
    

  5. Make the disk containing the UFS file system a bootable disk:

    # disklabel -r /dev/rdisk/dsk2a > /tmp/dsk21abel
    # disklabel -t ufs -r -R /dev/rdisk/dsk2a /tmp/dsk2label rz28
    

  6. Edit the /etc/fstab file on the UFS file system to refer to the new root entry.

    1. Search /newroot/etc/fstab for the entry previously mounted as root for the AdvFS file system:

      root_domain#root / advfs rw 1 0
      

    2. Replace with one that mounts root as a UFS file system:

      /dev/disk/dsk2a / ufs rw 1 1
      

  7. Shut down the system by entering the following command:

    # shutdown -h now
    

  8. Reset the boot default device, BOOTDEF_DEV, to the new root disk. (Refer to your hardware manual for specific information.)

  9. Reboot the system to enable the UFS root file system.

B.4.2    Converting a Fileset to UFS

Once the root file system is converted to UFS, you can convert your filesets.

The following are required:

Assumed system configurations are as follows:

The following example assumes your AdvFS file domain contains one volume and only one fileset. If the AdvFS file domain contains multiple filesets, then you must create a separate UFS file system for each fileset.

Caution

Be sure to perform a full backup on all AdvFS filesets before you start the conversion.

  1. Make a backup of the AdvFS fileset:

    # vdump -0f /dev/tape/tape0 /staff2
    

  2. Unmount the fileset:

    # umount /staff2
    

  3. Delete the fileset:

    # rmfset staff_domain staff2
    

  4. Remove the file domain:

    # rmfdmn staff_domain
    

  5. Create the UFS file system for the specified disk type. (If the partition you are creating is currently labeled AdvFS, you will get a warning message. Respond yes to override the AdvFS designation.)

    # newfs /dev/disk/dsk2c rz28
    

  6. Edit your /etc/fstab file.

    1. Search for the entry that mounts /staff2 as an AdvFS fileset, such as:

      staff_domain#staff2 /staff2 advfs rw 1 0
      

    2. Replace it with one that mounts /staff2 as a UFS file system:

      /dev/disk/dsk2c /staff2 ufs rw 1 2
      

  7. Mount the UFS file system:

    # mount -t ufs /dev/disk/dsk2c /staff2
    

  8. Use the vrestore command to load the files from the backup into the UFS file system:

    # vrestore -xvf /dev/tape/tape0 -D /staff2
    

If your file domain contains multiple volumes, you must verify that the disk space allocated to a fileset will not exceed the limit of the UFS file system disk partition. You may need to create multiple UFS file systems to hold the filesets in the file domain.