AdvFS Guide to File System Administration: Appendix B

## Appendix 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.

This appendix includes the following sections:

Converting a /usr File System

- Using a Backup Tape

- Requirements
- Assumptions
- Procedure

- Using an Intermediate File

- Requirements
- Assumptions
- Procedure

- Using a Second Disk

- Requirements
- Assumptions
- Procedure

Converting the Root File System

- Requirements
- Assumptions
- Procedure

Converting a Data File System

- Using a Backup Tape

- Requirements
- Assumptions
- Procedure

- Using a Second System

- Requirements
- Assumptions
- Procedure

Converting from AdvFS to UFS

- Converting the Root to UFS
- Converting a Fileset to UFS

## Converting a `/usr` File System

-

By converting the `/usr` file system to AdvFS, you can reduce the amount of time your system is down after a system failure. During the initial installation of AdvFS, you can install `/usr` on AdvFS. If you do not, you can use one of the following methods:

- Use a backup tape
- Use an intermediate file
- Use a second disk

## 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.

## Requirements

- Root user privilege
- Backup device and media
- Five percent more disk space for the converted file system
- The Advanced File System installed on your system

## Assumptions

- Existing UFS configuration:

  File system `/usr`

  Disk partition `/dev/rz3g`

- New AdvFS configuration:

  File system `/usr`

  Disk partition `/dev/rz3g`

  File domain `usr_domain`

  Fileset `usr`

## Procedure

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/rmt0h`, the default tape drive. Enter the following sequence of commands:

       # 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/rz3g /usr ufs rw 1 2

   2. Replace the previous line with the following entry, which mounts `/usr` as an AdvFS file system:

          usr_domain#usr /usr advfs rw 1 0

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

       # shutdown -h now

5. Reboot the system in single-user mode. See the DIGITAL UNIX Guide to 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 by entering the following sequence of commands:

       # mount -u /

       # mkfdmn /dev/rz3g usr_domain

       # mkfset usr_domain usr

7. Mount the `usr` fileset on the `/usr` directory by entering the following command:

       # mount -t advfs usr_domain#usr /usr

8. While there is no activity on the system, restore the `/usr` file system from tape to the `usr` fileset by entering the `vrestore` command:

       # vrestore -x -D /usr

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

## 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.

## Requirements

- Root user privilege.
- Disk space for an intermediate file. (The file system containing the intermediate file can be on the same disk or a different disk.)
- Five percent more disk space for the converted file system.
- The Advanced File System installed on your system.

## Assumptions

- Existing UFS configuration:

  File system `/usr`

  Disk partition `/dev/rz3g`

  Intermediate file `/tmp/usr_bck`

- New AdvFS configuration:

  File system `/usr`

  Disk partition `/dev/rz3g`

  File domain `usr`_domain

  Fileset `usr`

## Procedure

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. Enter the following sequence of commands:

       # 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/rz3g /usr ufs rw 1 2

   2. Replace the previous line with the following entry, which mounts `/usr` as an AdvFS file system:

          usr_domain#usr /usr advfs rw 1 0

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

       # shutdown -h now

5. Reboot the system in single-user mode. See the DIGITAL UNIX Guide to 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 by entering the following sequence of commands:

       # mount -u /

       # mkfdmn /dev/rz3g usr_domain

       # mkfset usr_domain usr

7. Mount the `usr` fileset on the `/usr` directory by entering the following command:

       # mount -t advfs usr_domain#usr /usr

8. While there is no activity on the system, restore the `/usr` file system from the intermediate file to the `usr` fileset by entering the following command:

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

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

## 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.

## Requirements

- Root user privilege
- A second disk with 5% more disk space for the converted file system
- The Advanced File System installed on your system

## Assumptions

- Existing UFS configuration:

  File system `/usr`

  Disk partition `/dev/rz3g`

- New AdvFS configuration:

  File system `/usr`

  Disk partition `/dev/rz2c`

  Mount directory `/usr.advfs`

  File domain `usr`_`domain`

  Fileset `usr`

## Procedure

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 by entering the following sequence of commands:

       # mkfdmn /dev/rz2c usr_domain

       # mkfset usr_domain usr

3. Create a mount-point directory and mount the new fileset on the directory by entering the following sequence of commands:

       # mkdir /usr.advfs

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

4. Change to the `/usr` directory:

       # cd /usr

5. While there is no activity on the system, copy the contents of the UFS file system to the AdvFS file system by entering the following command:

       # 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/rz3g /usr ufs rw 1 2

   2. Replace the previous line with the following entry, which mounts `/usr` as an AdvFS file system:

          usr_domain#usr /usr advfs rw 1 0

7. Shut down and reboot the system. Once the system prompt returns, the converted `/usr` file system is ready to use.

## Converting the Root File System

- -

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 of DIGITAL UNIX, 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.

## Requirements

- Root user privilege.
- A second bootable disk. (You must use partition `a` or `c`.)
- The Advanced File System installed on your system.

## Assumptions

- Existing UFS configuration:

  File system `root`

  Mount directory /`newroot`

  Disk partition `/dev/rz1a`

- New AdvFS configuration:

  File system `root`

  Mount directory `/newroot`

  Disk partition `/dev/rz2a`

  File domain `root_domain`

  Fileset `root`

## Procedure

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

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

2. Create a file domain and fileset by entering the following commands:

       # mkfdmn -r -t rz26 /dev/rz2a root_domain

       # mkfset root_domain root

3. Create a mount-point directory and mount the new fileset on the directory by entering the following commands:

       # mkdir /newroot

       # mount -t advfs root_domain#root /newroot

4. Restore the UFS root file system to the root fileset by entering the following command:

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

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

       # disklabel -r /dev/rrz2a > /tmp/rz2label

       # disklabel -t advfs -r -R /dev/rrz2a /tmp/rz2label rz26

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 previously mounted root as a UFS file system, such as:

          /dev/rz1a / ufs rw 1 1

   2. Replace the previous line with the following entry, which mounts root as an AdvFS file system:

          root_domain#root / advfs rw 1 0

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

       # 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.

## Converting a Data File System

- -

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.

There are two different methods for converting data file systems from UFS to AdvFS:

- Use a backup tape
- Use a second system

## 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.

## Requirements

- Root user privilege
- Backup device and media
- Five percent more disk space for the converted file system
- The Advanced File System installed on your system

## Assumptions

- Existing UFS configuration:

  File system `/staff2`

  Mount directory `/staff2`

  Disk partition `/dev/rz2c`

- New AdvFS configuration:

  File system `/staff2`

  Disk partition `/dev/rz2c`

  File domain `staff_domain`

  Fileset `staff2`

## Procedure

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/rmt0h`, the default tape drive. Enter the following sequence of commands:

       # mt rewind

       # mount /staff2

       # cd /staff2

       # vdump -0 .

       # unmount /staff2

3. Create a file domain and fileset by entering the following sequence of commands. After creating the file domain, you need to confirm that you want to write over the UFS file system.

       # mkfdmn /dev/rz2c staff_domain

       Partition(s) which overlap /dev/rz2c are marked in use.

       If you continue with the operation you can possibly destroy existing data.

       CONTINUE? [Y/n]y

       # mkfset staff_domain staff2

4. Create a mount-point directory and mount the new fileset on the directory by entering the following sequence of commands:

       # mount -t advfs staff_domain#staff2 /staff2

5. Restore the `/staff2` file system from tape to the `staff2` fileset by entering the following command:

       # vrestore -x -D /staff2

6. Edit the `/etc/fstab` file.

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

          /dev/rz2c /staff2 ufs rw 1 2

   2. Replace the previous line with the following entry, which mounts `/staff2` as an AdvFS file system:

          staff_domain#staff2 /staff2 advfs rw 1 0

The converted `/staff2` file system is ready to use.

## 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.

## Requirements

- Two systems: one system that supports the `tar` utility and one DIGITAL UNIX operating system
- Root user privilege on the target system
- Five percent more disk space for the converted file system
- The Advanced File System installed on the target system

## Assumptions

- Existing UFS configuration:

  File system `/staff4`

- New AdvFS configuration:

  File system `/staff4`

  Disk partition `/dev/rz2c`

  Mount directory `/staff4`

  File domain `staff_domain`

  Fileset `staff4`

## Procedure

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 using the following command:

       # tar c /staff4

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

3. Create a fileset in the `staff_domain` file domain by entering the following command:

       # mkfset staff_domain staff4

4. Create a mount-point directory and mount the new fileset on the directory by entering the following sequence of commands:

       # mkdir /staff4

       # mount -t advfs staff_domain#staff4 /staff4

5. Restore the `/staff4` file system from the default tape drive, `/dev/rmt0h`, by entering the following sequence of commands:

       # mt rewind

       # tar x /staff4

6. Edit the `/etc/fstab` file. Add the following line, which mounts `/staff4` as an AdvFS file system:

       staff_domain#staff4 /staff4 advfs rw

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

## 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.

## Converting the Root to UFS

- -

To convert the root file system, you must mount a UFS disk while your AdvFS root fileset is mounted. 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/rz2a rz26

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

       # mkdir /newroot

       # mount -t ufs /dev/rz2a /newroot

4. Restore the AdvFS root file system to the `/dev/rz2a` UFS file system:

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

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

       # disklabel -r /dev/rrz2a > /tmp/rz21abel

       # disklabel -t ufs -r -R /dev/rrz2a /tmp/rz2label rz26

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 the previous line with the following entry which mounts root as a UFS file system:

          /dev/rz2a / 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.

## Converting a Fileset to UFS

-

Once the root file system is converted to UFS, you can convert your filesets. 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 you perform a full backup on all AdvFS filesets before you start the conversion.

1. Make a backup of the AdvFS fileset to your backup device:

       # vdump -0f /dev/rmt0a /staff2

2. Unmount the fileset:

       # umount /staff2

3. Delete the fileset:

       # rmfset staff_domain staff2

4. Remove the file domain using the `rmfdmn` command:

       # rmfdmn staff_domain

5. Create the UFS file system for the specified disk type:

       # newfs /dev/rz2c rz26

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 the previous line with the following entry, which mounts `/staff2` as a UFS file system:

          /dev/rz2c /staff2 ufs rw 1 2

7. Mount the UFS file system:

       # mount -t ufs /dev/rz2c /staff2

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

       # vrestore -xvf /dev/rmt0a -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.

- - - -

© Copyright Digital Equipment Corporation 1996
All rights reserved