Using vxfsconvert to migrate a UFS file system to VxFS

The vxfsconvert utility converts a UFS file system to a Veritas File System (VxFS). Conversions of all UFS filesystem block sizes are supported and must be performed on a Solaris system. After a file system is converted to VxFS, its block size is the value of the fragment size before conversion. The vxfsconvert utility also converts any previous VxFS disk layout versions to Version 5 disklayouts.

The vxfsconvert utility requires sufficient disk space to convert existing metadata to VxFS metadata. Space is acquired from free space within the filesystem or from the space available immediately after the end of the file system. In either case, space must be available on the same device or volume on which the file system resides. Free space required by vxfsconvert is approximately 12%-15% of the total file system size, depending on the number of directories, size of directories, files, and the number of allocated inodes.

Prerequisites

Before we start we need to confirm that the Veritas Storage Foundation Suite is installed.

  • Confirm that the VRTSvxfs package is installed, without it the vxfsconvert utility will not exist.
    # pkginfo -l VRTSvxfs | grep VERSION
    VERSION: 6.0.100.000,REV=GA
  • Locate the vxfsconvert binary
    # find /opt -type f -name vxfsconvert -print
    /opt/VRTS/bin/vxfsconvert

Migration procedure

For the example in this article, we will convert our UFS file system migfs1 to VxFS. I also assume that volume is under veritas control (/dev/vx/rdsk/datadg/migfs1).

  1. Check the current filesystem type, mount options, and /etc/vfstab entries:
    # fstyp /dev/vx/rdsk/datadg/migfs1
    ufs
    # df -k /migfs1
    Filesystem            kbytes    used   avail capacity  Mounted on
    /dev/vx/dsk/datadg/migfs1
                         30239382 18617928 11319061    63%    /migfs1
    
    # grep -i migfs1 /etc/vfstab
    /dev/vx/dsk/datadg/migfs1  /dev/vx/rdsk/datadg/migfs1 /migfs1    ufs     3       yes     logging
    
  2. Confirm no one is using the file system, and unmount it:
    # fuser -cu /migfs1
    # fuser -ck /migfs1
    
    # umount /migfs1
  3. Run fsck to ensure file system integrity:
    # fsck -F ufs -y -o full /dev/vx/rdsk/datadg/migfs1
    ** /dev/vx/rdsk/datadg/migfs1
    ** Last Mounted on /migfs1
    ** Phase 1 – Check Blocks and Sizes
    ** Phase 2 – Check Pathnames
    ** Phase 3a – Check Connectivity
    ** Phase 3b – Verify Shadows/ACLs
    ** Phase 4 – Check Reference Counts
    ** Phase 5 – Check Cylinder Groups
    379981 files, 18587920 used, 11621454 free (451366 frags, 1396261 blocks, 1.5% fragmentation)
  4. Using the -e flag with vxfsconvert, we can estimate the space required to complete the conversion:
    # /opt/VRTS/bin/vxfsconvert -e /dev/vx/rdsk/datadg/migfs1
    UX:vxfs vxfsconvert: INFO: V-3-21783: Total of 1021331K bytes required to complete the conversion
    Note: -e generally overestimates the free space because it considers the worst-case scenario for allocating blocks.
    If we have space available, then we can continue.
  5. Perform UFS to VxFS conversion:
    # /opt/VRTS/bin/vxfsconvert /dev/vx/rdsk/datadg/migfs1
    UX:vxfs vxfsconvert: INFO: V-3-21842: Do you wish to commit to conversion? (ynq) y for yes, n for no, q for quit (ynq) y
    UX:vxfs vxfsconvert: INFO: V-3-21852:  CONVERSION WAS SUCCESSFUL
  6. Run fsck on the converted file system before the mount operation to confirm file system integrity:
    # fsck -F vxfs -y -o full /dev/vx/rdsk/datadg/migfs1
    super-block indicates that intent logging was disabled
    cannot perform log replay
    pass0 – checking structural files
    pass1 – checking inode sanity and blocks
    pass2 – checking directory linkage
    pass3 – checking reference counts
    pass4 – checking resource maps
    fileset 1 au 0 imap incorrect – fix (ynq)y
    fileset 1 au 0 iemap incorrect – fix (ynq)y
    fileset 999 au 0 imap incorrect – fix (ynq)y
    fileset 999 au 0 iemap incorrect – fix (ynq)y
    fileset 999 au 1 imap incorrect – fix (ynq)y
    fileset 999 au 1 iemap incorrect – fix (ynq)y
    fileset 999 au 2 imap incorrect – fix (ynq)y
    fileset 999 au 2 iemap incorrect – fix (ynq)y
    fileset 999 au 3 imap incorrect – fix (ynq)y
    fileset 999 au 3 iemap incorrect – fix (ynq)y
    fileset 999 au 4 imap incorrect – fix (ynq)y
    fileset 999 au 4 iemap incorrect – fix (ynq)y
    no CUT entry for fileset 1, fix? (ynq)y
    no CUT entry for fileset 999, fix? (ynq)y
    au 0 emap incorrect – fix? (ynq)y
    au 0 summary incorrect – fix? (ynq)y
    au 1 state file incorrect – fix? (ynq)y
    au 1 emap incorrect – fix? (ynq)y
    au 1 summary incorrect – fix? (ynq)y
    au 1 state file incorrect – fix? (ynq)y
    au 2 state file incorrect – fix? (ynq)y
    au 2 emap incorrect – fix? (ynq)y
    au 2 summary incorrect – fix? (ynq)y
    au 2 state file incorrect – fix? (ynq)y
    au 3 emap incorrect – fix? (ynq)y
    au 3 summary incorrect – fix? (ynq)y
    au 4 emap incorrect – fix? (ynq)y
    au 4 summary incorrect – fix? (ynq)y
    fileset 1 iau 0 summary incorrect – fix? (ynq)y
    fileset 999 iau 0 summary incorrect – fix? (ynq)y
    fileset 999 iau 1 summary incorrect – fix? (ynq)y
    fileset 999 iau 2 summary incorrect – fix? (ynq)y
    fileset 999 iau 3 summary incorrect – fix? (ynq)y
    fileset 999 iau 4 summary incorrect – fix? (ynq)y
    free block count incorrect 0 expected 11232275 fix? (ynq)y
    free extent vector incorrect fix? (ynq)y
    OK to clear log? (ynq)y
    flush fileset headers? (ynq)y
    set state to CLEAN? (ynq)y
    
    NOTE: During pass 4, fsck displays several error messages that require a yes. vxfsconvert does not create all metadata files.
  7. Rerun fsck to complete the process:
    # fsck -F vxfs -y -o full /dev/vx/rdsk/datadg/migfs1
    log replay in progress
    pass0 – checking structural files
    pass1 – checking inode sanity and blocks
    pass2 – checking directory linkage
    pass3 – checking reference counts
    pass4 – checking resource maps
    OK to clear log? (ynq)y
    flush fileset headers? (ynq)y
    set state to CLEAN? (ynq)y

Post Migration Tasks

  1. Confirm the file system type:
    # fstyp /dev/vx/rdsk/datadg/migfs1
    vxfs
  2. Mount the newly formed VxFS file system:
    # mount -F vxfs /dev/vx/dsk/datadg/migfs1 /migfs1
  3. (optional) review the file system (ls, dh, etc....)
  4. Update /etc/vfstab...
    From:
    /dev/vx/dsk/datadg/migfs1  /dev/vx/rdsk/datadg/migfs1 /migfs1    ufs     3       yes     logging
    To:
    /dev/vx/dsk/datadg/migfs1  /dev/vx/rdsk/datadg/migfs1 /migfs1    vxfs     3       yes     –
    NOTE: DO NOT put logging in mount option, as there is no logging option available on the VxFS file system type.

Troubleshooting

If during mounting the newly converted VxFS file system, you get the following:

# mount -F vxfs /dev/vx/dsk/datadg/migfs1 /migfs1
UX:vxfs mount: ERROR: V-3-22168: Cannot open portal device: No such file or directory
grn
UX:vxfs mount: ERROR: V-3-25255: mount: You don’t have a license to run this program

Perform the following steps to resolve the issue:

# pkginfo -l VRTSvxfs | grep -i status
    STATUS:  completely installed
# ls -lrt /devices/pseudo/vxportal
    /devices/pseudo/vxportal: No such file or directory
# devfsadm -v -i vxportal
    devfsadm[15793]: verbose: mknod /devices/pseudo/vxportal@0:0 0l/3l/20640
# ls -lrt /devices/pseudo/fdd
    /devices/pseudo/fdd: No such file or directory
# devfsadm -v -i fdd
    devfsadm[15825]: verbose: mknod /devices/pseudo/fdd@0:0 0l/3l/20600

Mount the FS again and check the data usage and filesystem type:

# mount -F vxfs /dev/vx/dsk/datadg/migfs1 /migfs1
# /opt/VRTS/bin/fsadm -ed /migfs1

The above resolution was found on the Symantec support site TECH47217