File System Fundamentals

61
File System Fundamentals Lesson Overview This lesson describes installation prerequisites, procedures for installing VERITAS File System (VxFS) software, and procedures for upgrading VxFS from a previous version. Importance When you install any VERITAS software, you should verify operating system version compatibility, read software version release notes, and check licensing requirements. By verifying the installation prerequisites and following the installation procedures presented in this lesson, you can ensure a successful installation of VERITAS File System software. Outline of Topics Topics covered in this lesson are: VxFS Installation Prerequisites VERITAS File System Packages Adding License Keys Installing VERITAS File System Verifying VxFS Installation Upgrading to a New VxFS Version Objectives After completing this lesson, you will be able to: Identify VERITAS File System installation prerequisites. Identify VERITAS File System software packages. Add license keys by using the vxlicense command. Install a VERITAS File System by using the pkgadd command. Verify installation by using the pkginfo command. Upgrade to a new VERITAS File System version. VxFS Installation Prerequisites OS Version Compatibility Before performing installation procedures, you should ensure that the version of VxFS that you are installing is compatible with the version of the Solaris operating system that you are running. VERITAS File System release 3.4 operates on Solaris 8 in 32-bit and 64-bit mode. VERITAS recommends upgrading any previously installed VERITAS File System to VxFS 3.4. The following table shows the compatibility of VxFS versions with Solaris versions: VxFS Solaris 1

description

VM FS Funda

Transcript of File System Fundamentals

Page 1: File System Fundamentals

File System

Fundamentals

Lesson Overview

This lesson describes installation prerequisites, procedures for installing VERITAS File System (VxFS)software, and procedures for upgrading VxFS from a previous version.

Importance

When you install any VERITAS software, you should verify operating system version compatibility, readsoftware version release notes, and check licensing requirements. By verifying the installationprerequisites and following the installation procedures presented in this lesson, you can ensure asuccessful installation of VERITAS File System software.

Outline of Topics

Topics covered in this lesson are:

VxFS Installation Prerequisites• VERITAS File System Packages• Adding License Keys• Installing VERITAS File System• Verifying VxFS Installation• Upgrading to a New VxFS Version•

Objectives

After completing this lesson, you will be able to:

Identify VERITAS File System installation prerequisites.• Identify VERITAS File System software packages.• Add license keys by using the vxlicense command.• Install a VERITAS File System by using the pkgadd command.• Verify installation by using the pkginfo command.• Upgrade to a new VERITAS File System version.•

VxFS Installation Prerequisites

OS Version Compatibility

Before performing installation procedures, you should ensure that the version of VxFS that you areinstalling is compatible with the version of the Solaris operating system that you are running.

VERITAS File System release 3.4 operates on Solaris 8 in 32−bit and 64−bit mode. VERITASrecommends upgrading any previously installed VERITAS File System to VxFS 3.4. The following tableshows the compatibility of VxFS versions with Solaris versions:

VxFS Solaris

1

Page 2: File System Fundamentals

3.2.5 2.5.1 and 2.63.2.6 2.5.1 and 2.63.3.1 2.5.1 and 2.63.3.2 2.5.1, 2.6, and 73.3.3 2.5.1, 2.6, 7, and 83.4 2.6, 7, and 8

Compatibility with Other VERITAS Products

Many people use VERITAS File System in conjunction with other VERITAS products. If you useoptional features such as VERITAS Quick I/O or VERITAS QuickLog, then you should also verify thecompatibility of those features with the Solaris version.

The following table shows Solaris version compatibility with recent releases of optional features, suchas VERITAS Quick I/O and VERITAS QuickLog, and other VERITAS products, such as VERITASStorage Migrator (formerly VERITAS HSM), and NetBackup (NBU).

Note: Quick I/O and QuickLog are built into VxFS 3.4, but require separate licenses to use theirfeatures.

VxFS

Solaris Quick I/O QuickLogHSM

(Migrator) NBU

Confirming Free Space

Confirm that your system has enough free disk space to install VxFS. The following table displays diskspace usage by directory for the VxFS packages:

Directory Size Contents/ 1.5 MB Binaries/usr 2.25 MB Libraries/opt 2.5 MB Manual pages in /opt/VRTS/man

Version Release Differences

With each new release of the VxFS software, changes are made that may affect the installation oroperation of VxFS in your environment. By reading version release notes and installationdocumentation that are included with the product, you can stay informed of any changes.

For more information about specific releases of VERITAS File System, visit the VERITAS VsupportWeb site at http://support.veritas.com. This site contains lists of frequently asked questions, asearchable knowledge base of technical notes, access to product−specific news groups and e−mailnotification services, and other information about contacting technical support staff.

2

Page 3: File System Fundamentals

The following section summarizes some of the release notes for recent VxFS versions:

Version Notes

VxFS 3.4 does not operate on Solaris 2.5.1. VxFS 3.3.3 is the last release to support Solaris2.5.1.

Versions of VxFS earlier than 3.2.5 are no longer supported.• VxFS versions 3.0 and 3.1 are specific to HP−UX.• VxFS 3.3.2 introduced a patch process that results in fewer product releases and that simplifiesrelease management. The patch process is similar to the standard Sun patch process.

Version Differences History

The major differences between VxFS 2.3.x and VxFS 3.2.x include:

Support for files up to 2 terabytes in size• Support for access control lists• Version 4 file system layout•

The major differences between VxFS 3.2.x and VxFS 3.3.x include:

Support for storage checkpoints and rollback• Support for Block−Level Incremental Backup• Support for Cached Quick I/O• Support for Solaris 2.7• Discontinued support for the volcopy and labelit Solaris utilities•

The major differences between VxFS 3.3.x and VxFS 3.4 include:

Support for forced unmounts• Support for file access time disabling• Support for parallel log replay• Support for the optionally licensable feature, Cluster File System•

Kernel Issues

VxFS often requires more than the default 8K kernel stack size, so during the installation ofVxFS 3.2.x and higher, entries are added to the /etc/system file. This increases the kernelthread stack size of the system to 16K.

There was a Solaris kernel patch issued by Sun for Solaris 2.6 and 7 to address a kernel mapfragmentation issue with VxFS 3.3.1. This fix has been built into VxFS 3.3.2 and higher.

3

Page 4: File System Fundamentals

VxFS is a kernel−loadable driver, which means that it may load ahead of or behind other driverswhen the system reboots. To avoid the possibility of problems in a failover scenario, you should:

Maintain the same VxFS product version on all systems.♦ Maintain the same product version of each VxFS add−on product.♦ Ensure that forceload:fs/vxfs is in the /etc/system file on all systems♦

VxFS Software Packages

VERITAS File System consists of these standard packages:

VRTSvxfs VERITAS File System software and manual pages

VRTSfsdoc

VERITAS File System documentation

During installation, you can install the PostScript, PDF, or both versionsof the documents. If you do not want these documents online, then donot install this package.

VRTSlic

VERITAS product licensing facility

This package must be installed to activate all VxFS licensable features.This package contains the vxlicense command and manual page.

Note: In prior distributions of the VxFS software, the licensing facility wasincluded in the VRTSvxfs package.

Before installing any of the packages, confirm that your system has enough free disk space toaccommodate the installation.

VxFS Optional Features

The VRTSvxfs package also contains optionally licensable features:

VERITAS QuickLog• VERITAS Quick I/O for Databases• VERITAS Cluster File System•

VERITAS QuickLog

VERITAS QuickLog is an optionally licensable feature that enhances file system performance. AlthoughQuickLog can improve file system performance, VxFS does not require QuickLog to operate effectively.

4

Page 5: File System Fundamentals

VERITAS QuickLog is part of the VRTSvxfs package, but requires a separate license to use.

VERITAS Quick I/O for Databases

VERITAS Quick I/O for Databases (referred to as Quick I/O) enables applications to accesspreallocated VxFS files as raw character devices. This provides the administrative benefits of runningdatabases on file systems without the performance degradation usually associated with databasescreated on file systems. Quick I/O is a separately licensable feature available from VERITAS as part ofVERITAS Editions products.

Note: In previous VxFS distributions, the QuickLog and Quick I/O features were supplied in separatepackages (VRTSqlog and VRTSqio, respectively).

VERITAS Cluster File System

VERITAS Cluster File System (CFS) is a shared file system that enables multiple hosts to mount andperform file operations concurrently on the same file. CFS is a separately licensable feature of theVERITAS File System (VxFS), but requires an integrated set of VERITAS products to function.

To configure a cluster and to provide failover support, CFS requires:

VERITAS Cluster Server (VCS): VCS supplies two major components integral to CFS: the LowLatency Transport (LLT) package and the Group Membership and Atomic Broadcast (GAB)package.

LLT provides node−to−node communications and monitors network communications.♦ GAB provides cluster state, configuration, and membership service, and monitors theheartbeat links between systems to ensure that they are active.

VERITAS Volume Manager (VxVM): CFS requires the Cluster Volume Manager (CVM) featureof VxVM to create the cluster volumes necessary for mounting cluster file systems.

Foundation Product Suites

VERITAS File System is included in the product suites:

VERITAS Foundation Suite: This suite of products enables you to create a high−performancefoundation, and includes:

VERITAS Volume Manager♦ VERITAS File System♦

SANPoint Foundation Suite HA: This suite of products supports transparent data sharing in aSAN environment, and includes:

5

Page 6: File System Fundamentals

VERITAS Cluster Server♦ VERITAS Volume Manager♦ Cluster Volume Manager♦ VERITAS File System♦ Cluster File System♦

Using SANPoint Foundation Suite HA, multiple servers can access shared storage and filestransparently to the applications and concurrently with each other. SANPoint Foundation Suite HAincorporates VERITAS Cluster Server to provide cluster failover capabilities as well as internodecommunications across the servers.

For suites, follow the suite installation guides to install component products.

Edition Products

As one of the foundation components for other value−added technologies, VERITAS File System isalso included in the following Edition products:

VERITAS Database Edition for Oracle• VERITAS Database Edition/HA for Oracle• VERITAS File Server Edition (formerly VERITAS Edition for NFS)• VERITAS File Server Edition/HA• VERITAS Database Edition for Sybase• VERITAS Database Edition/HA for Sybase• VERITAS Storage Edition for Oracle• VERITAS Web Edition• VERITAS Web Edition/HA•

Note: HA=High Availability

When you install an Edition product using the installation script described in the product installationguide, the VERITAS File System packages are installed automatically. The Edition installation scriptensures package compatibility and proper license installation and is the recommended method forinstallation

License Keys

VERITAS File System is a licensed product that requires a license key for installation. The license keyis based on the machine class and hostid of the system.

6

Page 7: File System Fundamentals

You should have your license key before you begin installation. During installation, you are prompted toenter the license key. When you purchase VERITAS File System or any of the products that includeVERITAS File System, you receive the appropriate license keys. To request a new license key, contactVERITAS Customer Support.

Record your license key somewhere other than the computer on which it is installed. You need toreenter your license key number if the system becomes unbootable or requires reinstallation.

License keys valid for VxFS 2.3.x and other 3.x file systems are also valid for VERITAS 3.4 FileSystem. The optional VERITAS Quick I/O, VERITAS QuickLog, and Cluster File System featuresrequire separate license keys. If you already have an evaluation license key for the product, you needto obtain a permanent license key when you purchase the product.

Foundation Suite Users: You can also install VERITAS File System license keys while running theVolume Manager vxinstall utility.

Edition Users: When you purchase any of the Edition products, you also receive license keys.Running the Edition installation script ensures proper license installation and compatibility for allinstalled packages.

Viewing Installed License Key Information

If you are not sure whether license keys have been installed, you can view installed license keyinformation by using the vxlicense command.

At the command line, type: vxlicense −p1. Information about installed license keys is displayed.2.

For example:

# vxlicense −p

vrts:vxlicense: INFO: Feature name: VXFS [80]vrts:vxlicense: INFO: Number of licenses: 1 (non−floating)vrts:vxlicense: INFO: Expiration date: Sun Jul 01 01:00:00 2001 (68.5 days from now)vrts:vxlicense: INFO: Release Level: 22vrts:vxlicense: INFO: Machine Class: All. . .

Adding a License Key After Installation

A license key file must exist before you use VERITAS File System. If you do not enter a license keyduring installation, you can add a license key after installation using the vxlicense command.

At the command line, type: vxlicense −c1. When prompted, type your license key number.2. After you enter a valid key, the system displays license key information and describes thelocation of the license key installation.

3.

To license optional features, reenter the vxlicense −c command and enter a valid license keyfor each additional feature set.

4.

For example:

7

Page 8: File System Fundamentals

# vxlicense −c

Please enter your key: 1234512345123451234512345vrts:vxlicense: INFO: Feature name: VXFS [80]vrts:vxlicense: INFO: Number of licenses: 1 (non−floating)vrts:vxlicense: INFO: Expiration date: No expiration datevrts:vxlicense: INFO: Release Level: 22vrts:vxlicense: INFO: Machine Class: 258193729vxfs:vxlicense: INFO: Key successfully installed in /etc/vx/elm/80

Installing VERITAS File System

The pkgadd Command

You can install the VERITAS File System packages by using the pkgadd command.

The VRTSvxfs package contains binaries for Solaris 2.6, 7, and 8. Procedures built into this packagedetermine the current OS version and install the appropriate VxFS binaries during the pkgadd process.On Solaris 7 and Solaris 8 systems, both the 32−bit and 64−bit VxFS drivers are installed.

Steps to Install VERITAS File System

Log on as superuser.1.

Only a user with superuser privileges can install and remove VERITAS products.

Mount the VERITAS CD−ROM.2. If Solaris volume management software is running on your system, then the CD isautomatically mounted as /cdrom/CD_name.

If Solaris volume management software is not available, mount the CD manually usingthe mount command.

Install the packages from the CD−ROM using the pkgadd command.•

Specify pkgadd −d followed by the path name of the CD−ROM and the names of the productpackages:

pkgadd −d path_name product_packages

During the installation, you receive a series of installation questions. To continue the installation,respond to the questions by typing y.

4.

When prompted, type your license key.5. After the installation is complete, reboot the system.6.

Modifications to /etc/system

The installation procedure modifies the /etc/system file by adding the following lines:

8

Page 9: File System Fundamentals

The original /etc/system file is copied to /etc/fs/vxfs/system.preinstall. The modifications are removedduring a pkgrm.

Installation Failure

VERITAS File System 3.4 runs on Solaris 2.6, 7, and 8. If you try to install it on any other Solarisversion, the pkgadd procedure fails, and you receive an Incompatible OS version error message.

Example: Installing VxFS and Documentation

Assume that you are logged on as superuser and Solaris volume management software is running. Toinstall the VERITAS File System licensing facility, software, and documentation packages, you type:

# pkgadd −d /cdrom/CD_name/pkgs VRTSlic VRTSvxfs VRTSfsdoc

You must specify the VRTSlic package before the other packages on the command line. Thedocumentation package, VRTSfsdoc, is optional.

Example: Installing VxFS After Manually Mounting the CD

Assume that you are logged on as superuser and do not have Solaris volume management software.To manually mount the CD at the CD−ROM address c0t6d0s2, you type:

# mount −F hsfs −o ro /dev/dsk/c0t6d0s2 /mnt

To install the VxFS licensing facility, software, and documentation packages, you type:

# pkgadd −d /mnt/pkgs VRTSlic VRTSvxfs VRTSfsdoc

Verifying VxFS Installation

The pkginfo Command

If you are not sure if VERITAS File System is installed, or if you want to verify the installation of thesoftware, you can use the pkginfo command to view information about installed packages.

Listing Installed Packages

To list all installed packages on the system:

# pkginfo

9

Page 10: File System Fundamentals

To restrict the list to all installed VERITAS packages:

# pkginfo | grep VRTS

For example:

# pkginfo | grep VRTS

Listing Detailed Information About a Package

To display detailed information about a package, you type pkginfo −l followed by the name of thepackage.

For example:

Accessing VxFS Manual Pages

Manual pages containing details about VERITAS File System commands and syntax are loaded whenyou install the VRTSvxfs software package. You can use these manual pages to display informationabout VxFS−specific versions of standard UNIX file system commands.

Online manual pages for VxFS commands are installed in the /opt/VRTS/man directory. Add thisdirectory to your MANPATH environment variable.

To display VxFS−specific manual pages, you use the syntax:

man command_vxfs

For example, to display the VxFS−specific manual page for the mount command, you type:

10

Page 11: File System Fundamentals

Upgrading the VxFS Version

If you are already running a previous version of VxFS, you can upgrade to the current version.Depending on the version of Solaris and VxFS that you are running, you may need to upgrade:

VxFS only• VxFS and Solaris• Solaris only•

Before You Upgrade

You must uninstall any previous version of the VRTSvxfs package before installing a new version. Youdo not need to remove existing VERITAS file systems, but all of them must remain unmountedthroughout the upgrade process.

Before upgrading, ensure that the new version of VxFS is compatible with the Solaris version you arerunning. If the Solaris version needs upgrading, refer to your Solaris installation guide for instructionson upgrading the operating system. If the VxFS version to which you want to upgrade is compatiblewith your Solaris version, then you can update VxFS without updating Solaris.

Note: The procedure for upgrading to a new VxFS version assumes that the file system layout is thesame. To upgrade to a new file system layout, for example, from a Version 2 layout to a Version 4layout, you use the vxupgrade command.

Upgrading VxFS Only

Unmount any mounted VERITAS file system. You cannot remove the VRTSvxfs package if anyVERITAS file system remains mounted.

1.

Remove all VxFS packages using the pkgrm command. To use the pkgrm command, you typepkgrm followed by the packages to be removed. You specify the optional packages before theVRTSvxfs package on the command line.

2.

For example, to remove the Quick I/O, QuickLog, documentation, and VERITAS File System softwarepackages, you type:

# pkgrm VRTSqio VRTSqlog VRTSfsdoc VRTSvxfs

After removing the packages, you should reboot the system to flush the kernel of current VxFS hooks.This is especially important if you are performing a major upgrade.

11

Page 12: File System Fundamentals

Install the new version of VxFS using the pkgadd command and following standard installationprocedures.

3.

Load and mount the VERITAS CD−ROM. If the CD is mounted automatically, its path is/cdrom/CD_name. If the CD is mounted manually, the path is /mnt.

a.

Add the VxFS packages of the new version using the pkgadd command:b.

# pkgadd −d /cdrom/CD_name/OS_version/pkgs VRTSlic VRTSvxfs VRTSfsdoc

If you are installing the optional packages VRTSqio or VRTSqlog, you list them after the VRTSvxfspackage on the command line.

Enter new license keys if necessary. You do not need to enter new license keys if youare upgrading from VxFS 3.2.x to 3.4.x.

c.

When the package installation is complete, reboot the system.d. Remount the VERITAS file systems.4.

Upgrading VxFS and Solaris

Note: Always read product release notes and follow the installation documentation when performingany upgrade.

To upgrade VxFS and Solaris, follow this sequence of steps.

Unmount all mounted VxFS file systems.1. Remove the VxFS packages, starting with the optional package:2.

# pkgrm VRTSfsdoc VRTSvxfs

If you have VxFS file systems specified in the /etc/vfstab file, comment them out, and thenreboot to flush VxFS kernel hooks still in RAM to avoid possible system panics.

3.

Upgrade the operating system to Solaris 2.6, 7, or 8. Refer to your Solaris installationdocumentation for instructions on how to upgrade Solaris.

4.

Mount the VxFS software CD−ROM and add the VxFS packages:5.

# pkgadd −d /cdrom/CD_name/pkgs VRTSlic VRTSvxfs VRTSfsdoc

Undo the changes to /etc/vfstab that you made in step 3.6. Reboot the system to mount any VxFS file systems.7.

Upgrading Solaris Only

If you are upgrading Solaris only and VxFS 3.4 is already installed, you must deinstall and reinstall theVxFS 3.4 packages. Refer to your Solaris installation documentation for instructions on how to upgradeSolaris

Lesson Summary

This lesson described preinstallation considerations, procedures for installing VERITAS File System(VxFS) software, and procedures for upgrading VxFS from a previous version.

Next Steps

12

Page 13: File System Fundamentals

After installing VxFS software, you are ready to begin creating and mounting a VERITAS file system.The next lesson covers basic administrative commands used in setting up a VERITAS file system.

Additional Resources

VERITAS File System Installation Guide•

This document describes how to install and upgrade the VERITAS File System product.

VERITAS File System Release Notes•

This document provides information on the current release of VERITAS File System

Lesson Overview

This lesson describes the different types of file systems and provides general guidelines for using filesystem commands. This lesson describes how to use common file system commands to create, set up,and monitor a file system.

Importance

Before you can take advantage of the online administration features of VERITAS File System, you needto know how to set up a file system in a way that meets the needs of your environment. This lessondescribes how to create a VERITAS file system and identifies some of the options that you can set atthe time of creation.

Outline of Topics

File System Types• Using VERITAS File System Commands• Creating a New File System• Setting File System Properties• Mounting a File System• Mounting a File System Automatically• Unmounting a File System• Identifying File System Type• Identifying Free Space• Maintaining File System Consistency•

Objectives

After completing this lesson, you will be able to:

Describe file system types.• List guidelines for issuing file system commands.• Create a file system using the mkfs command.• Set file system properties using mkfs command options.• Mount a file system using the mount command.• Mount a file system at boot time by editing the vfstab file.• Unmount a file system by using the umount command.• Identify file system type by using the fstyp command.• Identify free disk space by using the df command.•

13

Page 14: File System Fundamentals

Maintain file system consistency by using the fsck command•

Types of File Systems

VERITAS File System is one of many different types of file systems that are available for providing filesystem services. When you use file system administrative commands, you specify the type of filesystem in the command. This enables you to access VERITAS File System−specific versions ofstandard file system commands. Different types of file systems coexist in a layered structure within acomputer system.

Type−Independent File Systems

A type−independent file system is a file system that provides a common interface for interacting withdifferent types of file systems. In Solaris, the type−independent file system is called Virtual File System(VFS).

Type−Dependent File Systems

A type−dependent file system is a file system that has a specific association with a particular storagemedia device, network, or memory space. Examples of type−dependent file systems include:

UNIX File System (UFS): UFS is the default disk−based file system for Solaris.• VERITAS File System (VxFS): VxFS is a disk−based file system designed to provide highperformance, availability, data integrity, and integrated online administration.

High Sierra File System (HSFS): HSFS was designed as the first CD−ROM file system and isan example of a read−only file system.

Network File System (NFS): NFS is the default distributed file system for Solaris, which meansthat it resides on one system and can be shared and accessed by other systems across anetwork.

Process File System (PROCFS): PROCFS provides an access point or simple reference toprocesses and resides in system memory.

Data Flow Through File Systems

When an application makes a call to the Solaris operating system, the call first passes through thetype−independent file system, VFS, where it is converted into a vnode that identifies which file blockneeds to be retrieved. The vnode is then passed to the appropriate type−dependent file system. Thetype−dependent file system handles the I/O request by locating and retrieving the requested file from itsown memory space or from the underlying storage system. The file is then sent back through VFS to bereturned to the calling application

14

Page 15: File System Fundamentals

Using VxFS As an Alternate to UFS

You can generally use a VERITAS file system as an alternative to UFS, except for the root and /usrdirectories. Root and /usr are mounted read−only in the boot process, before the VxFS driver is loaded,and must be UFS−based file systems. Also, the VxFS driver requires dynamic libraries available from/usr.

Location of VxFS Commands

You can administer a VERITAS file system from the command line by using VxFS−specific commands.VxFS−specific commands are stored in:

/opt/VRTSvxfs/sbin• /usr/lib/fs/vxfs• /etc/fs/vxfs•

You must specify all three directories in the PATH environment variable in order to access all of thecommands.

Note: Prior to VxFS 3.4, commands were stored in /usr/lib/fs/vxfs and/etc/fs/vxfs. To conform with Sun Microsystems Architectural Review Committee (ARC) standards,VERITAS−specific commands are now installed in the /opt/VRTSvxfs/sbin directory. There are nowsymbolic links from the old directories to the new directories, but the links will be removed in anupcoming release.

General File System Command Syntax

VERITAS File System uses standard file system management command syntax:

command [−F type] [generic_options] [−o specific_options][special | mount_point]

In the syntax, you first specify the standard command, such as mkfs, mount, umount, or fstyp.• To access VxFS−specific versions or wrappers, of standard commands, you use the VFSswitchout mechanism −F followed by the file system type, vxfs. The −F vxfs option directs thesystem to search /opt/VRTSvxfs/sbin, /etc/fs/vxfs, and then /usr/lib/fs/vxfs for VxFS−specificversions of commands.

Generic options are options that are common to most file system types. You accessVxFS−specific command options using −o followed by specific options.

To complete the command, you specify the mount point or special device file to identify the filesystem.

Using VxFS Commands by Default

If you do not use the switchout mechanism −F vxfs, then the file system type is taken from the defaultspecified in the /etc/default/fs file. If you want VERITAS File System to be your default file system type,then you change the /etc/default/fs file to contain vxfs.

VxFS Commands

The following table lists all of the VxFS command line interface commands. Online manual pages forthese commands are installed in /opt/VRTS/man in the appropriate directories. Many of these

15

Page 16: File System Fundamentals

commands are covered in detail throughout this training.

Notes

The qio− commands have functionality that is only available with the VERITAS Quick I/O forDatabases feature.

The qlog− commands have functionality that is only available with the VERITAS QuickLogfeature.

The fsclustadm and glmconfig commands have functionality that is only available with theVERITAS Cluster File System feature.

Administering a File System Through VMSA

You can also administer VERITAS File System commands through the Volume Manager StorageAdministrator (VMSA) graphical user interface. Options in the VMSA interface enable you to performmany file system administration tasks, including creating, mounting, and setting properties for aVERITAS file system.

Creating a New File System

The mkfs Command

To create a VERITAS file system, you use the standard file system command mkfs. The mkfscommand creates a file system by writing to a special character device file. The special characterdevice can be a raw disk device or a VxVM volume. The mkfs command builds a file system with a rootdirectory and a lost+found directory.

The syntax for using the mkfs command is:

16

Page 17: File System Fundamentals

# mkfs [−F vxfs] [generic_options] [−o specific_options] special [size]

In the syntax, you specify the command, followed by the file system type, and any generic optionscommon to most other file systems. Using the −o command, you can add VxFS−specific options.Special means to specify the character (or raw) device or the VxVM volume character device node.

The size argument specifies the number of 512−byte sectors in the file system. If size is not specified,the mkfs command determines the size of the special device and constructs a file system equal in sizeto the volume within which it is created. If you prefer to specify a size in a unit other than sectors, youcan append the number by adding a k or K to indicate kilobytes, m or M to indicate megabytes, or g orG to indicate gigabytes. If you separate the appended letter by a space, you must enclose the numberand letter in quotation marks.

Steps to Create a New File System

Initialize the target device using an appropriate method.1. If you have added a new kind of disk controller, which requires a new driver, you mustrun drvconfig.

If you have added a new disk, you must run disks, then run format to create a disk slice.♦ If you are using a logical device such as a VxVM volume, then you can use vxassist orVMSA to initialize the volume. The VxVM disks must be initialized, and the disk groupmust exist before you use vxassist.

Create the VERITAS file system using the mkfs command.•

Example: Creating a File System on a VxVM Volume

Initialize the target device. This example initializes the VxVM volume datavol in the disk groupdatadg. The size is specified as 1 gigabyte.

1.

# vxassist −g datadg make datavol 1g

Create the VERITAS file system. The following mkfs command creates a VERITAS file systemon the VxVM volume datavol.

2.

# mkfs −F vxfs /dev/vx/rdsk/datadg/datavol

version 4 layout

2097152 sectors, 1048576 blocks of size 1024, log size 1024 blocksunlimited inodes, large files not supported1045440 data blocks, 1045327 free data blocks32 allocation units of 32768 blocks, 32768 data blockslast allocation unit has 29632 data blocks

Setting File System Properties

Using mkfs Command Options

17

Page 18: File System Fundamentals

You can set a variety of file system properties when you create a VERITAS file system by addingVxFS−specific options to the mkfs command. To add VxFS−specific options to the mkfs command, youtype −o followed by the specific options in the syntax:

mkfs [−F vxfs] [generic_options] [−o specific_options] special [size]

Some of the specific options supported by the VxFS−specific mkfs command include:

Option DescriptionN Reports the same structural information about the file system as if it had

actually been created, without actually creating the file systemlargefiles Enables the creation of files 2 gigabytes or largerversion Specifies the VxFS file system layout version numberbsize Sets the logical block size in bytes for files on the file systemlogsize Specifies the number of blocks to allocate for the logging area

For a complete list of options, see the mkfs_vxfs manual pages.

Checking VxFS Structure

To check the structure of a VERITAS file system without writing to the device, you use the −o N option.This option reports the same structural information about the file system as if it had actually beencreated, but does not actually create the file system. You can use this option to check the structure thatis created without actually creating the file system.

Example: Checking VxFS Structure

To display information needed to create a file system on the volume datavol, but not actually create thefile system, you type:

# mkfs −F vxfs −o N /dev/vx/rdsk/datadg/datavol

Enabling Large File Support

To enable support for files larger than two gigabytes, you add the −o largefiles option when you createthe file system. This option controls the largefiles flag for the file system.

18

Page 19: File System Fundamentals

This option is valid only for the Version 4 file system layout. If largefiles is specified, the bit is set andfiles two gigabytes or larger can be created. The largefiles parameter also enables the use of more thaneight−million inodes.

If nolargefiles is specified, the bit is cleared and files created on the file system are limited to less thantwo gigabytes. The default is nolargefiles.

Note: Large files are supported on Solaris 2.6 systems and above. When implementing large filesystem capability, system administration utilities such as backup may not operate correctly if they arenot large−file aware.

Example: Enabling Large File Support

To create a file system on the volume datavol that allows for files larger than two gigabytes, you type:

# mkfs −F vxfs −o largefiles /dev/vx/rdsk/datadg/datavol

Note: If you specify the largefiles option with the mount command, this option does not turn largefilescapability on and off, but can be used to verify whether a file system is largefiles−capable. Ifnolargefiles is specified and the mount succeeds, the file system does not contain files two gigabytes orlarger, and such files cannot be created. If largefiles is specified and the mount succeeds, the filesystem can contain files two gigabytes or larger.

Specifying a File System Layout Version

To specify a particular file system layout version to be used when making the file system, you use the−o version= n option, where n is the VxFS file system layout version number.

Valid values are 1, 2, and 4. The default is file system layout Version 4.

If n is 1, then the Version 1 layout is used in creating the file system. The Version 1 layout usesa fixed number of inodes.

If n is 2, then the Version 2 layout is used in creating the file system. The Version 2 layoutsupports unlimited inode allocation and quotas.

If n is 4, then the Version 4 layout is used in creating the file system. You do not need to specifythis option, because it is the default option. The Version 4 layout enables extents to be variablein size, enables support for large files, and adds typed extents to the VxFS architecture.

19

Page 20: File System Fundamentals

Example: Specifying Layout Version

You have a legacy system that requires the use of a VERITAS file system with a Version 2 file systemlayout. To create a file system with a Version 2 layout, you type:

# mkfs −F vxfs −o version=2 /dev/vx/rdsk/...

Setting Block Size

To set the block size for files on the file system, you use the −o bsize=n option, where n is the blocksize in bytes for files on the file system. Block size represents the smallest amount of disk spaceallocated to a file and must be a power of two selected from the range 1024 to 8192.

Example: Setting Block Size

To create a file system with a block size of 2048 bytes, you type:

# mkfs −F vxfs −o bsize=2048 /dev/vx/rdsk/...

Default Block Sizes

If you do not specify a block size when you create a file system, then VxFS chooses a default sizebased on the size of your file system. Default block sizes are:

File System Size Default Block SizeLess than 8 gigabytes 1024 bytesBetween 8 and 16 gigabytes 2048 bytesBetween 16 and 32 gigabytes 4096 bytesGreater than 32 gigabytes 8192 bytes

Considerations for Setting Block Size

Overall file system performance can be improved or degraded by changing the block size.

In most cases, you do not need to specify a block size when creating a file system. However, for largefile systems with relatively few files, the system administrator may want to experiment with larger blocksizes.

Resizing the file system does not change the block size. Therefore, you typically set a larger than usualblock size if you expect to extend the file system in the near future. Determining an appropriate block

20

Page 21: File System Fundamentals

size involves a trade−off between memory consumption and wasted disk space.

Setting Log Size

To allocate the number of file system blocks for an activity logging area, you use the logsize=n option,where n is the number of file system blocks. The activity logging area, called the intent log, contains arecord of changes to be made to the structure of the file system.

Default Log Size

When you create a file system with mkfs, VxFS uses a default log size of 1024 file system blocks,which is sufficient for most workloads. The log size cannot be changed after the file system is created.The default log size for a small file system may be smaller to avoid wasting space.

Minimum and Maximum Log Sizes

For Version 1 and Version 2 file system layouts, the minimum log size is 32 file system blocks. ForVersion 4 layouts, the minimum log size is the number of file system blocks that make the log no lessthan 256K.

The maximum log size is the number of file system blocks that make the log no greater than 16384K.

For all file system layouts, the default log size is 1024 file system blocks for file systems larger than 512MB, and 512 blocks for file systems smaller than 512 MB.

Example: Setting Log Size

To create a file system with a log size of 2048 file system blocks, you type:

# mkfs −F vxfs −o logsize=2048 /dev/vx/rdsk/...

When to Use a Large Log Size

A large log provides better performance on metadata−intensive workloads. For example, setting a logsize larger than the default log size may be beneficial if you have NFS−intensive workloads orapplications that send intensive writes requiring more space to hold transactions.

Note: When you select a larger log size, file system recovery time is proportionately longer, and the filesystem may consume more system resources, such as kernel memory, during normal operation.

When to Use a Small Log Size

21

Page 22: File System Fundamentals

A small log uses less space on the disk and leaves more room for file data. For example, setting a logsize smaller than the default log size may be appropriate for a small floppy device.

On small systems, you should ensure that the log size is not greater than half the available swapspace.

Selecting an Appropriate Log Size

The best way to select an appropriate log size is to test representative system loads against varioussizes and select the size that results in the fastest performance.

Using VERITAS QuickLog

When you use VERITAS QuickLog, the log size can be easily changed at any time during the use of afile system.

Mounting a File System

The mount Command

After creating a VERITAS file system on a raw device, you use the block device to mount the filesystem. To mount a VERITAS file system, you use the standard file system command mount.

Syntax of the mount Command

The syntax for the mount command is:

mount [−F vxfs] [generic_options] [−r] [−o specific_options] special mount_point

In the syntax, you specify the mount command followed by the file system type. You can add genericmount options as well as VxFS−specific mount options. To mount the file system as read−only, you usethe −r option.

The special argument means to identify the file system as either a block device or a VxVM volume. Themount_point is the directory on which to mount the file system. The mount point becomes the name ofthe root of the newly mounted file system. If the directory used as the mount point contains files orsubdirectories, they are inaccessible until the file system is unmounted.

Example

To mount a VERITAS file system on the volume datavol at the mount point/mydata, you type:

# mount −F vxfs /dev/vx/dsk/datadg/datavol /mydata

Displaying Mounted File Systems

You can use the mount command to display a list of currently mounted file systems. By keeping track ofwhich file systems are mounted and which are not, you can avoid trying to access unmounted filesystems. To see the status of mounted file systems, you type:

# mount −v

22

Page 23: File System Fundamentals

This shows the file system type and mount options for all mounted file systems. The −v option specifiesverbose mode.

To display a list of mounted file systems in the /etc/vfstab format, you use the command:

# mount −p

Mounting All File Systems

To mount all file systems listed in the /etc/vfstab file, you use the −a option:

# mount −a

Mounting a File System Automatically

The vfstab File

The mount command checks the /etc/vfstab file for parameters to use. For example, if you enter mount/ext, the rest of the information needed for the mount command is read from the entry in the /etc/vfstabfile.

If you do not supply the file system type using the −F vxfs option, then the mount command searchesthe file /etc/vfstab for a file system and file system type that match the special file or mount pointprovided. If no file system type is specified, then the mount command uses the default file system.

The following is an example of a typical vfstab file. A VERITAS file system is displayed in the last line ofthe file.

Adding an Entry to the vfstab File

You can automatically mount a VERITAS file system at boot time by adding an entry for the file systemin the /etc/vfstab file. To add an entry to the /etc/vfstab file, you specify the following:

Name of the special block device to mount• Name of the special character device used by fsck• Mount point• File system type (vxfs)• Number of the fsck pass•

23

Page 24: File System Fundamentals

The fsck pass number determines the level of file system checking that occurs at boot time or whetherthe file system is checked at all. A hyphen indicates that the file system is not checked.

Whether to mount the file system at boot time (yes or no)• Mount options•

If you use VMSA to create the file system, you are asked whether the file system is required to bemounted at boot time

Unmounting a File System

The umount Command

To unmount a currently mounted file system, you use the standard file system command umount:

umount special|mount_point

In the syntax, you specify the umount command followed by the special device or mount point on whichthe file system resides. You do not need to specify the file system type. The type of a mounted filesystem can be determined automatically.

For example, to unmount the VERITAS file system located at /mydata, you type:

# umount /mydata

Unmounting All File Systems

To unmount all file systems, except the ones required by the operating system, you use the −a optionwith the umount command. With this option, the umount command attempts to unmount all file systemsexcept /, /usr, /usr/kvm, /var, /proc, /dev/fd, and /tmp.

For example, to unmount all mounted file systems, you type:

# umount −a

Forcing an Unmount

Beginning with VxFS 3.4, you can perform forced unmounts of VERITAS file systems by using theoption −o force with the umount command. A forced unmount can be useful in situations such as highavailability environments, where a mounted file system could prevent timely failover. Any active processwith I/O operations pending on an unmounted file system receive an I/O error.

To perform a forced unmount of the VERITAS file system mounted at /mydata, you type:

# umount −o force /mydata

Caution: This command can cause data loss

Identifying File System Type

The fstyp Command

24

Page 25: File System Fundamentals

If you do not know the file system type of a particular file system, you can determine the file systemtype by using the fstyp command. You can use the fstyp command to describe either a mounted orunmounted file system.

To determine the type of file system on a disk partition, you use the following syntax:

fstyp [−v] special

In the syntax, you specify the command followed by the name of the device.

You can use the −v option to specify verbose mode. Verbose mode displays the super−block fields, thenumber of free blocks and inodes, and the number of free extents by size. The output displayed whenusing the −v option varies slightly for each disk layout.

Example: Displaying File System Type

To find out what kind of file system is on the device /dev/dsk/c0t6d0s0, you type:

# fstyp /dev/dsk/c0t6d0s0

vxfs

The output indicates that the file system type is vxfs.

Example: Verbose Mode

To find out what kind of file system is on the volume datavol and to display additional information aboutthe file system, you type:

The output displays:

Superblock fields• Number of free blocks and inodes• Number of free extents by size•

The output for −v differs slightly depending on the disk layout.

For a Version 2 disk layout, the number of free inodes is always zero.• For a Version 4 disk layout, fields such as logstart, logend, and nau are also zero.•

25

Page 26: File System Fundamentals

The number of allocation units can be determined from the file system size field and the aulen field. ForVersion 4 disk layouts, all allocation units are the same size (as shown by aulen) except for the lastallocation unit, which can be smaller

Identifying Free Space

The df Command

To report the number of free disk blocks and inodes for a VxFS File System, you use the df command.The df command displays the number of free blocks and free inodes in a file system or directory byexamining the counts kept in the super−blocks. Extents smaller than 8K may not be usable for all typesof allocation, so the df command does not count free blocks in extents below 8K when reporting thetotal number of free blocks.

In VERITAS File System versions 2.0 and above, inodes are dynamically allocated from a pool of freeblocks. In this case, the number of free inodes and blocks reported by df is an estimate based on thenumber of free 8K (or larger) extents and the current ratio of allocated inodes to allocated blocks.Allocating additional blocks can therefore decrease the count of free inodes and vice versa.

Syntax for the df Command

The syntax for the df command is as follows:

df [−F vxfs] [generic_options] [−o s] [directory|special]

In the syntax, you specify the command followed by the file system type. Generic options are thoseoptions supported by the generic UNIX df command.

The −o s option is specific to VxFS. You can use this option to print the number of free extents of eachsize.

To complete the command, you specify the special device name (for example, /dev/dsk/c0t1d0s5) ormount point directory name (for example, /mydata). If you specify a directory name, the report presentsinformation for the device that contains the directory.

Generic Options

The following table describes some of the generic options that you can use with the df command. Forcomplete descriptions of the options, see the df_vxfs(1m)and df(1m) manual pages.

Option Description−a Reports on all file systems−b Prints the total number of kilobytes free−e Prints only the number of files free−g Prints detailed information about a file system−k Prints one line of information for each specified file system−l Reports only on local file systems−n Prints a list of mounted file system types−o Specifies file system type−specific options−t Prints full listings with totals

26

Page 27: File System Fundamentals

−V Echoes the complete set of file system specific command lines, butdoes not execute them (Used to verify and validate the command line)

Example: Displaying Free Space

Display the number of free disk blocks and inodes for the VERITAS file system mounted at /mydata.

# df −F vxfs /mydata

/mydata (/dev/dsk/c1t11d0s0): 2094438 blocks 261804 files

The number of free disk blocks and inodes (files) are displayed. The command displays information forthe device /dev/dsk/c1t11d0s0 that contains a VERITAS file system mounted at /mydata.

Maintaining File System Consistency

The fsck Command

You use the VxFS−specific version of the fsck command to check the consistency of and repair aVERITAS file system. VxFS uses a feature called intent logging to record pending file system updatesin a log of intent, and by default the fsck utility replays the intent instead of doing a full structural filesystem check. Using the intent log is usually sufficient to set the file system state to CLEAN. You canalso use the fsck utility to perform a full structural recovery in the unlikely event that the log is unusable.

The syntax for the fsck command is:

fsck [−F vxfs] [generic_options] [−y|Y] [−n|N] [−o full,nolog] special

Example: Checking VxFS Consistency

To check file system consistency by using the intent log for the VERITAS file system on the volumedatavol, you type:

# fsck −F vxfs /dev/vx/rdsk/datadg/datavol

Lesson Summary

This lesson described the different types of file systems and provided general guidelines for using filesystem administrative commands. This lesson described how to use common file system commands toperform administrative tasks such as creating and mounting a file system, identifying the file system

27

Page 28: File System Fundamentals

type, and identifying free space.

Next Steps

After learning how to use basic file system administration commands, you are ready to learn how toperform additional administrative duties such as resizing a file system, backing up and restoring a filesystem, and creating a file system snapshot.

Additional Resources

VERITAS File System System Administrator's Guide

This guide describes VERITAS File System concepts, how to use various utilities, and how to performbackup procedures

Lesson Overview

This lesson describes online administration features of VERITAS File System. Methods for resizing,backing up, and restoring a file system are covered, as well as procedures for creating a snapshot filesystem.

Importance

The online administration features of VERITAS File System enable you to perform a variety ofadministrative tasks while minimizing user down time. By learning how to resize a VERITAS file system,you can ensure that a file system can handle changes in the workload over time. The backup andrestore utilities and file system snapshots help you to prevent data loss in the case of system failure.

Outline of Topics

Resizing a File System• Backing Up a File System• Restoring a File System• Creating a Snapshot File System• Managing Snapshot File Systems• Creating Storage Checkpoints•

Objectives

After completing this lesson, you will be able to:

Resize a file system.• Back up a file system by using the vxdump command.• Restore a file system by using the vxrestore command.• Create a snapshot file system.• Manage snapshot file systems.• Create a storage checkpoint•

Resizing a File System

File System Size

28

Page 29: File System Fundamentals

When you create a VERITAS file system using the mkfs command, you can specify a particular size forthe file system or use the default size. The default size is the size of the special raw device on whichthe file system is created. Over time, as the use of the file system changes, the file system maybecome too small or too large. You can resize a VERITAS file system while the file system remainsmounted.

You may need to resize a file system to accommodate a change in use, for example, increased needfor space in the file system. You may also need to resize a file system as part of a generalreorganization of disk usage, for example, the subdivision of a large file system into several smaller filesystems.

Traditional File System Resizing

Traditionally, if a file system became too small, with no more data space or inodes remaining, thesystem administrator addressed the problem by moving some or all contents to another file system.Alternatively, the administrator backed up, repartitioned, and reloaded the file system.

If a file system became too large, the system administrator would try to reclaim the unused space byoffloading the contents of the file system and rebuilding it to a preferable size.

Both of these cases resulted in downtime for users, because the solutions required unmounting the filesystem and blocking user access during modification.

Resizing a VERITAS File System

You can expand or shrink a VERITAS file system without unmounting the file system or interruptinguser productivity. However, to expand a file system, the underlying device on which it is mounted mustbe expandable.

Before you resize a VERITAS file system, you should verify the available free space of theunderlying device.

1.

Use prtvtoc or format to check on the size of disk partitions. You can expand a diskpartition if there is free space on the disk immediately after the disk partition. A diskpartition may always be reduced in size.

Use vxprint to check on the size of VxVM volumes or vxdg to check available free spacein a disk group. You can expand a VxVM volume if there is free space available on anydisk within the disk group. A VxVM volume may always be reduced in size.

You can resize the file system by using the fsadm command or the vxresize command.•

If you use the fsadm command, you also need to resize the underlying volume.•

29

Page 30: File System Fundamentals

If you use the vxresize command, the volume and file system are resized at the same time.• You can verify that the file system was resized by using the df command.•

The fsadm Command

You resize a VERITAS File System by using the fsadm command. The fsadm commandperforms a variety of online administration functions on VERITAS File Systems, includingresizing, extent reorganization, directory reorganization, and querying or changing the largefilesflag. Other uses of the fsadm command are covered in other lessons. The fsadm commandoperates on file systems mounted for read/write access.

The syntax for the fsadm command is as follows:

fsadm −F vxfs [−b newsize] [−r rawdev] mount_point

fs_type specifies the file system type, such as vxfs.♦ newsize is the size to which the file system will increases or decreases. The size of thefile system is specified in units of 512−byte blocks, called sectors.

The −r rawdev option specifies the pathname of the raw device if there is no entry in the/etc/vfstab file and fsadm cannot determine the raw device.

The mount_point specifies the mount point of the file system.♦ Using fsadm to resize a file system does not automatically resize the underlying volume. Whenyou expand a file system, the underlying device must be large enough to contain the new largerfile system.

When you shrink a file system, unused space is released at the end of the underlying device,which can be a VxVM volume or disk partition. You can then resize the device, but be carefulnot to make the device smaller than the size of the file system.

Example: Expanding a VERITAS File System Using fsadm

Expand the size of the file system mounted at /datavol from 512,000 sectors to 1,024,000sectors. The volume datavol exists in the diskgroup datadg.

Verify the available free space of the underlying device by using vxdg:1. # vxdg −g datadg free

Expand the volume using the vxassist command:2. # vxassist −g datadg growto datavol 1024000

Expand the file system using the fsadm command:3. # fsadm −F vxfs −b 1024000 −r /dev/vx/rdsk/datadg/datavol/datavol

Verify that the file system was resized by using the df command:4. # df −k /datavol

Example: Shrinking a VERITAS File System Using fsadm

Shrink the size of the file system mounted at /datavol back down to 512,000 sectors.

Shrink the file system by using the fsadm command:1. # fsadm −F vxfs −b 512000 −r /dev/vx/rdsk/datadg/datavol /datavol

30

Page 31: File System Fundamentals

After you shrink the file system, you can shrink the underlying volume using the vxassistcommand:

2.

# vxassist −g traindg shrinkto myvol 512000

The vxresize Command

If you are running VERITAS Volume Manager (VxVM), you can use the vxresize command toexpand or shrink a volume containing a file system. When you resize a VxVM volume using thevxresize command, the file system is automatically resized at the same time. Only VxFS andUFS file systems can be resized using the vxresize command. The syntax for the vxresizecommand is as follows:

/etc/vx/bin/vxresize [−bsx] [−F vxfs] [−g diskgroup][−t tasktag] volume new_length [medianame]

In the syntax, you use the −b option to perform the resize operation in the background. Thecommand returns without waiting for the completion of the resize, but the resize is in progress.You use the vxprint command to determine when the operation completes.

You specify the file system type as VxFS by using the standard −F vxfs option.

The −g diskgroup option limits the operation of the command to the given disk group, asspecified by a disk group ID or disk group name.

You use the −s option to require that the operation represents a decrease in the volume length,or you can use the −x option to require that the operation represents an increase in the volumelength. If the operation specified does not match the decrease or increase flag, then theoperation fails.

If you want to track the progress of the operation, you can mark the operation with a task tagusing the −t tasktag option of the vxresize command.

You specify the volume that you want to resize followed by the new length of the volume. Thedefault unit of the new length is in sectors, unless specified otherwise. The new length canbegin with a plus sign (+) or minus sign (−) to indicate that the new length is added to orsubtracted from the current volume length.

The medianame operand names disks to use for allocating new space for a volume. Thesearguments can be a simple name for a disk media record, or they can be of the formmedianame,offset to specify an offset within the named disk. If an offset is specified, thenregions from that offset to the end of the disk are considered candidates for allocation.

Example: Expanding a Volume and File System Using vxresize

Suppose that you want to expand the volume and file system mounted on the device/dev/vx/dsk/datadg/datavol from 2 GB to 5 GB.

Verify free space available in the VxVM disk group.1. # vxdg −g datadg free

To verify free space available on a disk, use format or prtvtoc to check if the partition can beextended.

31

Page 32: File System Fundamentals

To expand the volume and file system, use the vxresize command:2. # vxresize −F vxfs −g datadg datavol 5g

Verify that the file system was resized by using the df command.3. # df −k /datavol

Example: Shrinking a Volume and File System Using vxresize

Using the same example as above, suppose that you decide to shrink the 5 GB volume datavolback down to 4 GB. The syntax of the vxresize command is the same:

# vxresize −F vxfs −g datadg datavol 4g

Troubleshooting Tips: Resizing a File System

When resizing a file system, avoid the following common errors:

Resizing a file system that is very busy♦ Although resizing a file system requires that the file system be mounted, the file system"freezes" when the actual resizing occurs. Freezing temporarily prevents new access to the filesystem, but waits for pending I/O's to complete. You should attempt to resize a file systemduring a time when the file system has less of a load on it.

Resizing a file system that has a mounted snapshot file system♦ If a snapshot file system is mounted on the file system being resized, the resize fails. Filesystems that have snapshots mounted on them cannot be resized.

Resizing a corrupt file system♦ A file system that has experienced structural damage and is marked for full fsck cannot beresized. If the resize fails due to structural damage, you must unmount the file system, performa fsck, remount the file system, and try the resize again.

Resizing a file system that is nearly 100% full♦ The resize operation needs space to expand a file system, and if a file system is nearly 100%full, an error is returned. When increasing the size of a file system, the first operation performedis to extend the size of the internal structural files. If the file system is full or almost full, then thismay not be possible. To address this problem, try one or more of the following options:

Increase the size by a smaller amount first.◊ Defragment the file system.◊ Move some files temporarily to another file system◊

Backing Up a File System

VxFS Backup and Restore Utilities

When backing up files in a VERITAS file system, you can use standard file utilities such as tarand cpio, as well as the VxFS−specific utilities vxdump and vxrestore.

The options and parameters for vxdump and vxrestore are similar to the standard UFScommands ufsdump and ufsrestore.

32

Page 33: File System Fundamentals

The vxdump Command

You can use the vxdump command to implement incremental file system dump levels. Thevxdump command copies to magnetic tape all the files in the VERITAS file system that changedafter a particular date. This information is derived from the files /etc/dumpdates and /etc/vfstab.

The vxdump command establishes a checkpoint at the start of each tape volume. If for anyreason writing a volume fails, vxdump, with operator permission, restarts from the checkpointafter the old tape is rewound and removed and a new tape is mounted.

The syntax for the vxdump command is:

vxdump [−clntuwW] [−number] [−b blocking_factor][−B records] [−d density] [−f filename] [−s size][−t tracks] [−T time] mount_point

You specify the vxdump command, followed by options, and the mount point of the file systemto dump.

You can also use the traditional command line style:

vxdump [option [arguments . . .] file_system]

Using this syntax, you specify the options followed by arguments for those options. The firstargument goes with the first option that takes an argument, the second argument goes with thesecond option that takes an argument, and so on.

The vxdump Options

If no arguments are specified, the default options are −9u. The default tape device is/dev/rmt/0m. The following table summarizes the vxdump options and their uses. For moreinformation on these options, see the vxdump.1m manual page.

Option Use− number Indicates a dump level in the range 0 to 9

(The option −0 dumps the entire file system.)−b blocking_factor Sets a blocking factor (Default is 63.)−B records Sets the number of logical records per volume

(The vxdump logical record size is 1024 bytes.)−c Uses a cartridge−d density Sets tape density, which is used to calculate the

amount of tape used per reel−f filename Dumps to a specific file−l Ensures that autoloading tape drives have time to load

a new tape if the end of the tape is reached−n Notifies all users in the group operator whenever

vxdump requires operator attention−s size Specifies size of the dump−t tracks Specifies number of tracks for a cartridge (Default is 9.)−T date

33

Page 34: File System Fundamentals

Specifies a starting time for the dump to override thetime determined in the /etc/dumpdates file

−u Writes dump start dates to file /etc/dumpdates−w Prints file systems that need to be dumped−W Prints recent dump dates and levels

Example: Dumping to a File

To dump the file system mounted at /fsorig to a specific file:

# vxdump −0 −f /backup1/firstdump /fsorig

Example: Dumping to a Tape

To dump the entire file system mounted at /fsorig onto a 2−GB tape:

# vxdump −0 −s 2g −f /dev/ctape1 /fsorig

Using traditional syntax and specifying the tape size in logical records:

# vxdump 0Bf 2097152 /dev/ctape1 /fsorig

The argument 2097152 goes with the option letter B, because it is the first specified option thatrequires an argument. The argument /dev/ctape1 goes with the option f, because it is thesecond option that requires an argument

Restoring a File System

34

Page 35: File System Fundamentals

The vxrestore Command

You can use the vxrestore command to restore files previously copied to tape by the vxdumpcommand. The options used with the vxrestore command are similar to those used with theufsrestore command.

The current version of vxrestore can read dumps produced by older versions of vxdump. Thevxrestore command can also restore files to a file system of a type other than VxFS. However, ifthe file system type does not support extent attributes, then the extent attributes are notrestored. Also, if the dump tape contains files larger than 2 GB, and if the file system beingrestored to does not support files larger than 2 GB, then the file is truncated to 2 GB.

The syntax for the vxrestore command is as follows:

vxrestore [−himrRtvxy] [−s number] [−b block_size]

[−e opt] [−f file] [filename . . .] mount_point

In the syntax, you specify the command, followed by a variety of restore options, and one ormore filename arguments specifying the files to restore. The mount_point is the mount point ofthe restored file system.

The vxrestore command can also be used in the traditional command line style:

vxrestore key [filename . . .]

The vxrestore Options

The following table summarizes the vxrestore options and their uses. For more information onthese options, see the vxrestore.1m manual page.

Option Use−b Specifies tape block size in kilobytes−e Handles extent attribute information−f Specifies the name of the archive other than the

default−h Extracts the directory rather than the files−i Enables interactive interface−m Extracts by inode numbers rather than filename−r Restores into current directory−R Resumes a full restore−s number Specifies the dump file number−t Lists names of files if they occur on the tape−v Specifies verbose output−x Extracts named files from the tape−y Continues operation despite errors

Example: Restoring from a File

35

Page 36: File System Fundamentals

To restore a VERITAS file system from a file using the mount point /fsorig:

# vxrestore −vrf /backup1/firstdump /fsorig

Example: Restoring from a Tape

To restore a VERITAS file system using the mount point /fsorig by extracting the named filesfrom the tape:

# vxrestore −vx /fsorig

Note: vxrestore places a the file restoresymtab in the current directory of the file system to passinformation between incremental vxrestore passes. You can remove this file when the lastincremental tape is restored.

Troubleshooting Tips: Using vxdump and vxrestore

Problem: Unable to Restore Data from UFS to VxFS Using vxrestore

You receive an error when you try to use vxrestore to restore data from a ufsdump backup ontoa new VxFS file system.

Solution

You must use ufsrestore to restore data from a ufsdump backup, regardless of the type of filesystem onto which it is being restored.

Similarly, you must use vxrestore to restore data from a vxdump backup, even if you arerestoring it onto a UFS file system

36

Page 37: File System Fundamentals

Creating a Snapshot File System

Backing Up a VERITAS File System

Backing up a file system on a regular basis is an essential administrative task that ensures thatyou can recover your data in the event of disk failure, system failure, accidental deletion, orcorruption of files. VERITAS File System offers VxFS−specific versions of traditional backuputilities in addition to snapshot file system technology to enable you to back up your file systemwhile it remains online.

Traditional File System Backups

During a traditional UFS backup, user access is prohibited during a backup, while a physicalcopy of the files is created on another disk. This process results in user downtime and requiresthat you have twice the disk space when backing up an entire file system. During a long backup,file system metadata and file contents can become inconsistent if data changes during abackup.

What Is a Snapshot File System?

A snapshot file system is an image of a mounted file system that is an exact read−only copy ofthe file system at a certain point in time. When you create a snapshot file system, the originalfile system is referred to as the "snapped" file system, while the copy is called the "snapshot."The snapshot is a consistent view of the snapped file system at the point in time the snapshot ismade.

What Does a Snapshot File System Contain?

A snapshot file system acts as a database "before−image" log. When blocks are changed in theoriginal file system, the original version of the blocks is copied to the snapshot. Subsequentchanges to a changed block are not copied to the snapshot area again.

The space allocated to the snapshot file system only needs to be large enough to contain thechanged blocks. A snapshot file system does not need to be large enough to contain an entiresecond copy of the original file system. Therefore, a snapshot file system is an exact image ofthe original file system without the cost of duplicate disk space.

How Is a Snapshot File System Used in a Backup?

By using snapshot file systems with standard backup and restore commands, you can back upyour VERITAS file systems while they remain online. When the snapshot is read, data that hasnot changed is read from the original file system. Changed data is read directly from thesnapshot.

37

Page 38: File System Fundamentals

Snapshot File System Disk Structure

The disk structure of a snapshot file system consists of a superblock, bitmap, blockmap, anddata blocks.

The superblock is similar to the superblock of a normal VxFS file system. It containslogistical information about the snapshot.

The bitmap contains one bit for every block on the snapped file system. Initially, allbitmap entries are zero. A set bit indicates that the appropriate block was copied fromthe snapped file system to the snapshot. In this case, the appropriate position in theblockmap references the copied block.

The blockmap contains one entry for each block on the snapped file system. Initially, allentries are zero. When a block is copied from the snapped file system to the snapshot,the appropriate entry in the blockmap is changed to contain the block number on thesnapshot file system that holds the data from the snapped file system.

The data blocks used by the snapshot file system contain data copied from thesnapped file system, starting from the front of the data block area.

Mounting a Snapshot File System

When you mount an empty disk slice as a snapshot of a currently mounted file system, thebitmap, blockmap, and superblock are initialized, and then the currently mounted file system isfrozen. Then, the snapshot is enabled and mounted, and the snapped file system is thawed.This process takes only a few seconds. The snapshot is displayed as an exact image of thesnapped file system at the time the snapshot was made.

Data Copied to Snapshot

Initially, the snapshot file system satisfies read requests by simply finding the data on thesnapped file system and returning it to the requesting process. When a change occurs in block

38

Page 39: File System Fundamentals

n of the snapped file system, the old data is read and copied to the snapshot before thesnapped file system is updated. The bitmap entry for block n is changed from 0 to 1 (indicatingthat the data for block n can be found on the snapped file system). The blockmap entry for blockn is changed from 0 to the block number on the snapshot file system containing the old data.

Reading a Snapshot

A subsequent read request for block n on the snapshot file system is satisfied by checking thebitmap entry for block n and reading the data from the indicated block on the snapshot filesystem, rather than from block n on the snapped file system. Subsequent writes to block n onthe snapped file system do not result in additional copies to the snapshot file system, since theold data only needs to be saved once.

All updates to the snapped file system for inodes, directories, data in files, extent maps, and soon, are handled in this fashion so that the snapshot can present a consistent view of all filesystem structures for the snapped file system for the time when the snapshot was created. Asdata blocks are changed on the snapped file system, the snapshot gradually fills with datacopied from the snapped file system.

Creating a Snapshot File System

To create a snapshot file system, you use the −o snapof option of the mount command. There isno mkfs step involved. The syntax is as follows:

mount [−F vxfs] −o snapof=source[,snapsize=size]destination snap_mount_point

In the −o snapof option:

39

Page 40: File System Fundamentals

The source is the special device name or mount point of the file system to copy.♦ The snapsize option is required only if the device being mounted does not identify thedevice size in its disk label or if you want to select a size that is smaller than the entiredevice. The snapshot size is the size in sectors of the snapshot file system beingmounted. The snapsize cannot exceed the amount of data which is sent to the snapshotwhile mounted.

The destination is the name of the special device on which to create the snapshot, and thesnap_mount_point is where to mount the snapshot. The snapshot mount point must existbefore you enter this command.

Example: Creating a Snapshot File System

A VERITAS file system is located on the device /dev/dsk/c0t6d0s2. To create a snapshot of thisfile system on /dev/dsk/c0t5d0s2 that is 32,768 sectors in size and mount it at /snapmount, youtype:

# mount −F vxfs −o snapof=/dev/dsk/c0t6d0s2,snapsize=32768 /dev/dsk/c0t5d0s2 /snapmount

Using a Snapshot File System for Backup

After creating a snapshot file system, you can back up the file system from the snapshot whilethe snapped file system remains online. Any program that uses the standard UNIX file systemAPI (for example, open, close, read, and write) should be able to access a full file system imageby using the snapshot. You can back up and restore selected files using utilities such as tar,cpio, vxdump, and vxrestore or using commercial backup and restore products such asVERITAS NetBackup.

Backup programs that function using the standard file system tree (such as cpio) can beused without modification on a snapshot file system, since the snapshot presents thesame data as the snapped file system.

Backup programs that access the disk structures of a VxFS file system (such asvxdump) make suitable modifications in their behavior so that their operation on asnapshot file system is indistinguishable from that on a normal file system.

When performing a binary dump of a file system using the dd command, you must usethe fscat command to read the combined file system structure. Without fscat, the resultis a binary dump of only the snapshot volume. The fscat command translates a snapshotfile system back to raw file system information to obtain a raw image of the entire filesystem. This raw image is identical to that obtained by performing a dd of the disk devicecontaining the snapped file system at the exact moment the snapshot was created.

When the backup is complete and you no longer need the snapshot, you unmount the snapshotfile system.

Backing Up a Snapshot File System

To back up a snapshot file system using the vxdump command, you specify the command,followed by vxdump command options, and the mount point of the snapshot file system:

vxdump [options] snap_mount_point

Example

40

Page 41: File System Fundamentals

To back up the VxFS snapshot file system mounted at /snapmount to the tape drive with thedevice name /dev/rmt/00m, you type:

# vxdump −cf /dev/rmt/00m /snapmount

Restoring from a Snapshot File System Backup

After backing up a file system from a snapshot, you can restore it using the vxrestore command.First, you create and mount an empty file system. Then, to restore the file system, you specifythe vxrestore command, followed by command options, and the mount point of the restored filesystem:

vxrestore [options] mount_point

Additional Examples

Here are some typical examples of making a backup of a 300,000 block file system named/home (which exists on disk /dev/dsk/c0t0d0s7) using a snapshot file system on/dev/dsk/c0t1d0s1 with a snapshot mount point of /backup/home:

To back up files changed within the last week using cpio:♦ # mount −F vxfs −o snapof=/dev/dsk/c0t0d0s7,snapsize=100000 /dev/dsk/c0t1d0s1 /backup/home

# cd /backup

# find home −ctime −7 −depth −print | cpio −oc >

/dev/rmt/c0s0

# umount /backup/home

To do a full backup of /dev/dsk/c0t0d0s7 and use dd to control blocking of output ontotape device using vxdump:

# vxdump f − /dev/rdsk/c0t0d0s7 | dd bs=128k >♦ /dev/rmt/c0s0

To do a level 3 backup of /dev/dsk/c0t0d0s7 and collect those files that have changed inthe current directory:

# vxdump 3f − /dev/rdsk/c0t0d0s7 | vxrestore −xf −

To do a full backup of a snapshot file system:♦ # mount −o snapof=/dev/dsk/c0t0d0s7,snapsize=100000

/dev/dsk/c0t1d0s1 /backup/home

# vxdump f − /dev/rdsk/c0t1d0s1 | dd bs=128k >

/dev/rmt/c0s0

The vxdump program determines whether /dev/rdsk/c0t1d0s1 is a snapshot mounted as/backup/home and performs the appropriate work to get the snapshot data through the mount

41

Page 42: File System Fundamentals

point.

Managing Snapshot File Systems

Selecting Snapshot File System Size

The amount of disk space required for the snapshot depends on the rate of change of thesnapped file system and the amount of time the snapshot is maintained. A snapshot file systemis disabled if it runs out of blocks to hold copied data and all further access to the snapshot filesystem fails. The failure of a snapshot file system does not affect the snapped file system.

A snapshot file system must be able to hold any blocks on the snapped file system that can bewritten to while the snapshot file system exists. If every file in the snapped file system wasrewritten, the snapshot would require enough blocks to hold a copy of every block on thesnapped file system, plus additional blocks for the data structures that make up the snapshot, orapproximately 101 percent of the snapped file system size. Most file systems do not change atsuch an extreme rate.

A snapshot file system must be at least five percent of the size of the snapped file system.

During a period of low activity when the system is relatively inactive (for example, onnights and weekends), the snapshot only needs to contain five to six percent of theblocks of the snapped file system.

During a period of higher activity, the snapshot of an "average" file system might require15 to 20 percent of the blocks of the snapped file system.

These percentages tend to be lower for larger file systems and higher for smaller ones.

Unmounting a Snapshot File System

A snapshot file system is always read−only and exists only as long as it and the file system thathas been snapped are mounted. To unmount a snapped file system, you must first unmount anycorresponding snapshots. A snapshot file system ceases to exist when unmounted. Ifremounted, the snapshot initializes and is available as a new snapshot.

Multiple Snapshots of One File System

You can have multiple snapshots of a single file system made at different times. However, it isnot possible to make a snapshot of a snapshot.

If multiple snapshots of the same snapped file system exist, writes are slower, because eachsnapshot must record the original data. Only the initial write to a block suffers this penalty.Subsequent writes to the same block do not change what is in the snapshot.

Performance of Snapshot File Systems

Snapshot file systems maximize the performance of the snapshot at the expense of writes to thesnapped file system. Reads from a snapshot file system typically perform at nearly thethroughput of reads from a normal VxFS file system, allowing backups to proceed at the fullspeed of the VxFS file system.

The performance of reads from the snapped file system should not be affected. Writes to thesnapped file system, however, typically average two to three times as long as without a

42

Page 43: File System Fundamentals

snapshot, because the initial write to a data block now requires a read of the old data, a write ofthe data to the snapshot, and finally the write of the new data to the snapped file system.

Reads from the snapshot file system are impacted if the snapped file system is busy, since thesnapshot reads are slowed by all of the disk I/O associated with the snapped file system.

The overall impact of the snapshot is dependent on the read−to−write ratio of an application andthe mixing of the I/O operations. For example, Oracle running an OLTP workload on a snappedfile system was measured at about 15 to 20 percent slower than a file system that was notsnapped.

Troubleshooting Tips: Snapshot File Systems

Problem: Snapshot File System Runs Out of Space During Backup

If a snapshot file system runs out of space during a backup, then it is disabled. The snapshot filesystem may have been left mounted for too long by mistake, it may have been allocated toolittle disk space, or the primary file system may have had an unexpected burst of activity.

Solution

Ensure that the snapshot file system has the correct amount of space and determine the activitylevel on the primary file system. If the primary file system was unusually busy, then rerun thebackup. If the primary file system is no busier than normal, reschedule the backup to a timewhen the primary file system is relatively idle or increase the amount of disk space allocated tothe snapshot file system

Creating Storage Checkpoints

What Is a Storage Checkpoint?

Storage checkpoints are a feature of the VERITAS File System (VxFS) that you can use toquickly create a persistent image of a file system at an exact point in time. Storage checkpointsserve as an enabling technology for other VERITAS products: Block−Level IncrementalBackups and Storage Rollback, which are used for backing up databases.

Storage checkpoints are available to users of VERITAS Database Edition products. You canuse storage checkpoints only on file systems with the Version 4 disk layout; if you are using anolder disk layout, you must upgrade your layout to Version 4 to use this feature.

Why Use Storage Checkpoints?

Common uses for storage checkpoints include:

Database environments: Storage checkpoints are best suited for file systemscontaining database files. It is not advisable to use storage checkpoints in environmentsthat use a large number of files and directories.

Backup and replication solutions: Various backup and replication solutions can takeadvantage of storage checkpoints. The ability of storage checkpoints to track the filesystem blocks that have changed since the last storage checkpoint facilitates backupand replication applications which only need to retrieve the changed data.

High availability environments: Storage checkpoints significantly minimize data♦

43

Page 44: File System Fundamentals

movement and may promote higher availability and data integrity by increasing thefrequency of backup and replication solutions.

Benefits of Storage Checkpoints

Reduces I/O overhead: Storage checkpoints significantly reduce I/O overhead byidentifying and maintaining only the file system blocks that have changed since the lastStorage checkpoint or backup via a copy−on−write technique.

Requires minimal disk space: Unlike a disk−based mirroring technology that requiresa separate storage space, storage checkpoints minimize the use of disk space bycreating a checkpoint within the same free space available to the file system.

Persistent across reboots: Storage checkpoints are data objects that are managedand controlled by the file system. Therefore, storage checkpoints are persistent acrosssystem reboots and crashes.

Easy to administer: You can create, remove, and rename storage checkpoints becausethey are data objects with associated names. After you create a storage checkpoint of amounted file system, you can also continue to create, remove, and update files on thefile system without affecting the logical image of the storage checkpoint. This technologypreserves not only the name space (directory hierarchy) of the file system, but also theuser data as it existed at the moment the storage checkpoint was taken.

Comparing Storage Checkpoints and Snapshots

The following table compares storage checkpoint functionality with file system snapshotfunctionality:

Characteristic Storage Checkpoints File System SnapshotsData persistency Persistent; available after a

reboot or system crashTransient; lost if the systemis rebooted

Data storage Uses the free pool from theprimary file system

Requires a separate storagepool for saving beforeimages

BackupMaintains relationship with othercheckpoints; allows the backupprocess to extract only changedblocks

Only allows full backups,although it keeps track ofchanged blocks

I/O and storageefficiency Only the latest checkpoint saves

before images; reduces I/O andstorage

Continually saves beforeimages

Administration

Has more administrativefeatures; coordinates withOracle states; can beadministered in multiples; canbe removed or rolled back

Is a read−only file systemthat is administered like afile system

How Does a Storage Checkpoint Work?

44

Page 45: File System Fundamentals

When you create a storage checkpoint:

The file system is brought to a stable state where all of its data is written to disk. Thestorage checkpoint facility freezes the mounted file system (known as the primaryfileset). The freezing process that follows momentarily blocks all I/O operations to the filesystem.

1.

A storage checkpoint is then initialized, that is, the storage checkpoint is created withoutany actual data. The storage checkpoint points to the block map of the primary fileset.

2.

The file system is thawed. The thawing process restarts I/O operations to the file system.3. Inside a Storage Checkpoint

A storage checkpoint of the primary fileset initially contains a pointer to the file system blockmap rather than any actual data. The block map points to the data on the primary fileset. Thestorage checkpoint is logically identical to the primary fileset when the storage checkpoint iscreated, but does not contain any actual data blocks.

Multiple Storage Checkpoints

You can create a storage checkpoint on a single file system or a list of file systems. A multiplefile system storage checkpoint simultaneously freezes the file systems, creates a storagecheckpoint on all file systems, and thaws the file systems. As a result, the storage checkpointsfor multiple file systems have the same creation timestamp. The storage checkpoint facilityguarantees that multiple file system storage checkpoints are created on all or none of thespecified file systems, unless a system crash takes place while the operation is in progress. Thecalling application is responsible for cleaning up storage checkpoints after a system crash.

Example: How a Storage Checkpoint Works

45

Page 46: File System Fundamentals

In the example, each block of the file system is represented by a square.

As the primary fileset is updated, the original data is copied to the storage checkpoint before thenew data is written. When a write operation changes a specific data block in the primary fileset,the old data is first read and copied to the storage checkpoint before the primary fileset isupdated.

Subsequent writes to the specified data block on the primary fileset do not result in additionalupdates to the storage checkpoint because the old data needs to be saved only once. As blocksin the primary fileset continue to change, the storage checkpoint accumulates the original datablocks.

46

Page 47: File System Fundamentals

In the example, the third block originally containing C is updated. Before the block is updatedwith new data, the original data is copied to the storage checkpoint. This is called thecopy−on−write technique, which allows the storage checkpoint to preserve the image of theprimary fileset when the storage checkpoint is taken.

Every update or write operation does not necessarily result in the process of copying data to thestorage checkpoint. In this example, subsequent updates to this block, now containing C', arenot copied to the storage checkpoint because the original image of the block containing C isalready saved.

Types of Storage Checkpoints

You can create the following types of storage checkpoints:

Data storage checkpoints♦ Nodata storage checkpoints♦ Removable storage checkpoints♦ Nonmountable storage checkpoints♦

Data Storage Checkpoints

A data storage checkpoint is a complete image of the file system at the time the storagecheckpoint is created. This type of storage checkpoint contains the file system metadata and filedata blocks. You can mount, access, and write to a data storage checkpoint just as you would toa file system.

Data storage checkpoints are useful for backup applications which require a consistent andstable image of an active file system. Data storage checkpoints introduce some overhead to thesystem and to the application performing the write operation. For best results, you can limit thelife of data storage checkpoints to minimize the impact on system resources.

Nodata Storage Checkpoints

A nodata storage checkpoint only contains file system metadata; this type of storage checkpointdoes not contain any file data blocks. As the original file system changes, the nodata storagecheckpoint records the location of every changed block. Nodata storage checkpoints useminimal system resources and have little impact on the performance of the file system becausethe data itself does not have to be copied.

Removable Storage Checkpoints

A removable storage checkpoint can "self−destruct" under certain conditions when the filesystem runs out of space. After encountering certain conditions, the kernel removes storagecheckpoints to free up space for the application to continue running on the file system. In almostall situations, you should create storage checkpoints with the removable attribute.

Nonmountable Storage Checkpoints

A nonmountable storage checkpoint cannot be mounted. You can use this type of storagecheckpoint as a security feature which prevents other applications from accessing the storagecheckpoint and modifying it.

Administering Storage Checkpoints

47

Page 48: File System Fundamentals

To administer storage checkpoints, you can use the fsckptadm utility:

fsckptadm [−nruv] create ckpt_name mount_point

fsckptadm [−clv] list mount_point...

fsckptadm [−sv] remove ckpt_name mount_point

fsckptadm [−sv] set {nodata|nomount|remove} ckpt_name

This utility enables you to:

Create storage checkpoints.♦ Display statistical data about checkpoints.♦ Remove storage checkpoints.♦ Change attributes of checkpoints.♦

Every storage checkpoint has an associated name which allows you to manage storagecheckpoints; this name is limited to 127 characters and cannot contain a colon (:).

Creating a Storage Checkpoint

To create a storage checkpoint, you use the command:

fsckptadm [−nruv] create ckpt_name mount_point

In the syntax:

−n sets the nodata attribute, creating a checkpoint that contains no file data.♦ −r sets the remove attribute on a checkpoint at creation time. This ensures thecheckpoint is not automatically deleted under certain conditions.

−u sets the nomount attribute of a checkpoint when it is created, making the checkpointunmountable.

−v specifies verbose mode, which displays extensive statistical information.♦ Displaying Checkpoints

To list all checkpoints in a file system, you use the command:

fsckptadm [−clv] list mount_point...

In the syntax:

−c resets statistic counters such as number of reads, writes, and pushes.♦ −v specifies verbose mode, which displays extensive statistical information.♦ −l displays statistical information on the file system as well as its checkpoints.♦

Examples: Creating and Displaying Storage Checkpoints

In these examples, /mnt0 is a mounted VxFS file system with a Version 4 disk layout.

To create a nodata storage checkpoint named thu_7pm on /mnt0 and list all storagecheckpoints of the /mnt0 file system:

# fsckptadm −n create thu_7pm /mnt0

48

Page 49: File System Fundamentals

# fsckptadm list /mnt0

/mnt0

thu_7pm:

ctime = Thu Jun 1 19:02:17 2000

mtime = Thu Jun 1 19:02:17 2000

flags = nodata

To create a removable storage checkpoint named thu_8pm on /mnt0 and list all storagecheckpoints of the /mnt0 file system:

# fsckptadm −r create thu_8pm /mnt0

# fsckptadm list /mnt0

/mnt0thu_8pm:ctime = Thu Jun 1 20:01:19 2000mtime = Thu Jun 1 20:01:19 2000flags = removable

thu_7pm:ctime = Thu Jun 1 19:02:17 2000mtime = Thu Jun 1 19:02:17 2000flags = nodata

Removing a Storage Checkpoint

You can delete a storage checkpoint by specifying the remove keyword of the fsckptadmcommand:

fsckptadm [−sv] remove ckpt_name mount_point

You can use either the synchronous or asynchronous method of removing a storage checkpoint:

The asynchronous method is the default method. The asynchronous method marks thestorage checkpoint for removal and causes fsckptadm to return immediately. At a latertime, an independent kernel thread completes the removal operation and releases thespace used by the storage checkpoint.

The synchronous method entirely removes the storage checkpoint and returns all of theblocks to the file system before completing the fsckptadm operation. To remove thecheckpoint synchronously, you use the −s option.

Examples: Removing a Storage Checkpoint

In these examples, /mnt0 is a mounted VxFS file system with a Version 4 disk layout. Toremove the storage checkpoint named thu_8pm using the asynchronous method and list allremaining storage checkpoints on the file system:

49

Page 50: File System Fundamentals

# fsckptadm remove thu_8pm /mnt0

# fsckptadm list /mnt0

/mnt0thu_7pm:

ctime = Thu Jun 1 19:02:17 2000

mtime = Thu Jun 1 19:02:17 2000

flags = nodata

To remove the storage checkpoint named thu_7pm using the synchronous method and list allremaining storage checkpoints on the file system:

# fsckptadm −s remove thu_7pm /mnt0

# fsckptadm list /mnt0

/mnt0

Mounting a Storage Checkpoint

To access a storage checkpoint, you mount the checkpoint using the mount option:

−o ckpt=ckpt_name

Observe the following rules when mounting storage checkpoints:

Storage checkpoints are mounted as read−only storage checkpoints by default. If youneed to write to a storage checkpoint, mount it using the −o rw option.

If a storage checkpoint is originally mounted as a read−only storage checkpoint, you canremount it as a writable storage checkpoint using the−o remount option.

To mount a storage checkpoint of a file system, first mount the file system itself.♦ To unmount a file system, first unmount all of its storage checkpoints.♦

Caution: If you create a storage checkpoint for backup purposes, do not mount it as a writablestorage checkpoint. You will lose the point−in−time image if you accidently write to the storagecheckpoint.

A storage checkpoint is mounted on a special pseudo device. This pseudo device does not existin the system name space; the device is internally created by the system and used while thestorage checkpoint is mounted. The pseudo device is removed after you unmount the storagecheckpoint. A pseudo device name is formed by appending the storage checkpoint name to thefile system device name using the colon character (:) as the separator.

Example: Mounting a Storage Checkpoint

For example, if a storage checkpoint named may_23 belongs to the file system residing on thespecial device /dev/vx/dsk/fsvol/vol1, the storage checkpoint pseudo device name is:

50

Page 51: File System Fundamentals

/dev/vx/dsk/fsvol/vol1:may_23

To mount the storage checkpoint named may_23 as a read−only (default) storage checkpointon directory /fsvol_may_23, type:

# mount −F vxfs −o ckpt=may_23

/dev/vx/dsk/fsvol/vol1:may_23 /fsvol_may_23

The /fsvol file system must already be mounted before the storage checkpoint can be mounted.To remount the storage checkpoint named may_23 as a writable storage checkpoint, type:

# mount −F vxfs −o ckpt=may_23,remount,rw/dev/vx/dsk/fsvol/vol1:may_23 /fsvol_may_23

Unmounting a Storage Checkpoint

You can unmount storage checkpoints using the umount command. Storage checkpoints can beunmounted by the mount point or pseudo device name:

# umount /fsvol_may_23

# umount /dev/vx/dsk/fsvol/vol1:may_23

Note: You do not need to run the fsck utility on a storage checkpoint pseudo device becausethis utility runs on the actual file system.

Changing Checkpoint Attributes

To change storage checkpoint attributes, you use the command:

fsckptadm [−sv] set {nodata|nomount|remove} ckpt_name

Using this command, you can convert:

A data checkpoint to a nodata checkpoint♦ A mountable checkpoint to a non−mountable checkpoint♦ A non−removable checkpoint to a removable checkpoint♦

Converting to a Nodata Storage Checkpoint

A nodata storage checkpoint does not contain actual file data. Instead, this type of storagecheckpoint contains a collection of markers indicating the location of all the changed blockssince the storage checkpoint was created.

You can use either the synchronous or asynchronous method of convert a data storagecheckpoint to a nodata storage checkpoint.

The asynchronous method is the default method.In an asynchronous conversion,fsckptadm returns immediately and marks the storage checkpoint as a nodata storagecheckpoint even though the storage checkpoint's data blocks are not immediatelyreturned to the pool of free blocks in the file system. The storage checkpoint deallocatesall of its file data blocks in the background and eventually returns them to the pool of free

51

Page 52: File System Fundamentals

blocks in the file system.In a synchronous conversion, fsckptadm waits for all files to undergo the conversionprocess to nodata status before completing the operation. You use the −s option in thefsckptadm set command to perform a synchronous conversion.

Note: You cannot convert a nodata storage checkpoint to a data storage checkpoint because anodata storage checkpoint only keeps track of the location of block changes and does not savethe content of file data blocks.

Converting to a Nonmountable Storage Checkpoint

You use the nomount option in the fsckptadm set command to convert a mountable checkpointto a nonmountable storage checkpoint. If the checkpoint is already mounted, the attribute is stillset, and the next attempt to mount the checkpoint fails.

Converting to a Removable Storage Checkpoint

You use the remove option in the fsckptadm set command to convert a nonremovablecheckpoint to a removable storage checkpoint. Under some conditions, when the file systemruns out of space, removable checkpoints are deleted. This ensures that applications cancontinue running without interruptions due to lack of disk space. Nonremovable checkpoints arenot automatically removed under certain ENOSPC conditions. It is a good policy to create onlyremovable checkpoints

Lesson Summary

This lesson described online administration features of VERITAS File System. Methods forresizing, backing up, and restoring a file system were covered, including procedures for creatinga snapshot file system.

Next Steps

In the next lesson, you learn how to control users by creating quotas and access control lists.

Additional Resources

VERITAS File System System Administrator's Guide

This guide describes VERITAS File System concepts, how to use various utilities, and how toperform backup procedures

Lesson Overview

When administering a file system, it is important to have the ability to control users byestablishing limits on the use of file system resources and by securing files from different typesof user access. VERITAS File System supports the use of quotas for limiting disk usage forindividual users and the use of access control lists (ACLs) for enhancing file security. In thislesson, you set user quotas and ACLs for a VERITAS file system.

Importance

By setting quotas on disk usage and restricting access to files through ACLs, you can moreeffectively manage and protect data against users who may, knowingly or unknowingly,

52

Page 53: File System Fundamentals

overextend their disk usage or corrupt a file.

Outline of Topics

Who Uses Quotas?♦ Quota Limits♦ Quota Commands♦ Setting Quotas♦ Controlling User Access♦ Setting ACLs♦ Viewing ACLs♦

Objectives

After completing this lesson, you will be able to:

Describe environments in which user quotas are beneficial.♦ Define the types of quota limits for establishing user quotas.♦ Identify uses of common VxFS quota commands.♦ Set user quotas for a VERITAS file system by using quota commands.♦ Describe situations in which ACLs are beneficial.♦ Set an ACL for a file using the setfacl command.♦ View ACLs for a file using the getfacl command♦

Who Uses Quotas?

Benefits of Quotas

Quotas are beneficial in environments in which:

Users are not personally accountable to the organization administering the system.♦ The organization requires the rationing of access to storage resources.♦

Examples: Organizations That Use Quotas

Internet service providers (ISPs) typically set quotas on the amount of disk space thatsubscribers can use. When providing disk resources to the general public, quotas are anecessary precaution, because the system administrators have little control over theactions of the users.

Colleges and universities also frequently establish quotas for student users. Quotasensure that system resources are rationed on an equitable basis

Quota Limits

53

Page 54: File System Fundamentals

Types of Quota Limits

VERITAS File System supports the use of Berkeley Software Distribution (BSD) style quotasthat limit file usage and data block usage on a file system. For each of these resources, thesystem administrator can assign per−user quotas.

Each quota consists of the following types of limits for each resource:

Hard limit♦ The hard limit represents an absolute limit on files or data blocks. The user can never exceedthe hard limit under any circumstances.

Soft limit♦ The soft limit is a flexible limit on files or data blocks that can be exceeded for a limited amountof time. This enables users to temporarily exceed limits as long as they fall under those limitsbefore the allotted time expires. The soft limit must be lower than the hard limit.

Time limit♦ The time limit can be configured on a per−file system basis and applies only to the soft quotalimit. There are separate time limits for files and data blocks. However, modified time limitsapply to the entire file system and cannot be set for an individual user. The default time limit isseven days.

Only a privileged user, such as the system administrator, can assign hard and soft limits tousers.

Effect of Quota Limits on Users

When users reach the soft limit, they receive a warning, but can continue to use file systemresources until they reach the hard limit or until the time limit is reached.

You can use a soft limit when the user needs to run applications that generate large temporaryfiles. In this case, quota limit violations can be permitted for a limited time. However, if the usercontinuously exceeds the soft limit, further allocations are not permitted after the expiration ofthe time limit

Quota Commands

The quotas File

54

Page 55: File System Fundamentals

A file named quotas must exist in the root directory of the file system for the quota commands towork. This is a BSD requirement that applies also to VxFS quotas. The quotas file in the rootdirectory is referred to as the external quotas file. VxFS also maintains an internal quotas file forits internal use.

Internal vs. External quotas File

The quotas administration commands read and write the external quotas file to get or changeusage limits. The internal quotas file is used to maintain counts of blocks and inodes used byeach user.

When quotas are turned on, the quota limits are copied from the external quotas file into theinternal quotas file. While quotas are on, all the changes in the usage information as well aschanges to quotas are registered in the internal quotas file. When quotas are turned off, thecontents of the internal quotas file are flushed into the external quotas file so that all data is insync between the two files.

API for Manipulating Disk Quotas

VxFS 3.4 and later versions implement the quota API documented in the Solaris quotactl(7I)manual page. Users who have written their own quota tools based on the Q_QUOTACTL ioctlcan use those tools on VxFS file systems.

VxFS Quota Commands

In general, quota administration for VxFS is performed using commands similar to UFS quotacommands. On Solaris, the available quota commands are UFS− specific; that is, thecommands work only on UFS file systems. For this reason, VxFS supports a similar set ofcommands that work only for VxFS file systems:

55

Page 56: File System Fundamentals

Command Usevxedquota Edit quota limits for users.vxrepquota Display a summary of quotas and disk usage.vxquot Display a summary of ownership and usage.vxquota View quota limits and usage.vxquotaon Turn quotas on for a mounted VERITAS file system.vxquotaoff Turn quotas off for a mounted VERITAS file system.

Quota mount Option

The VxFS mount command supports a special mount option, −o quota, which you can use toturn on quotas for a file system at mount time

Setting Quotas

Overview: How to Set User Quotas

To set user quotas, you follow these steps:

Create the quotas file in the root directory using the touch command.1. Turn on quotas:2.

For a mounted file system, use the vxquotaon command◊ At mount time, use the −o quota mount option◊

Invoke the quota editor for a specific user using the vxedquota command.• Modify soft and hard limit quota entries in the quota editor.• Edit the time limit if desired by using the vxedquota −t command.• Confirm your changes by viewing the quotas that you set using the vxquota −v command.•

Step 1: Create the quotas File

Before turning on quotas, the root directory of the file system must contain a file owned by root,called quotas. You can use the touch command to create the file:

# touch /mnt/quotas

The touch command creates an empty file if the file does not already exist. If the file alreadyexists, the command updates the modification time of the file to the current date and time.

Step 2: Turn On Quotas

You can enable quotas at mount time or after a file system is mounted. When you enablequotas, VxFS uses the internal file quotas to keep track of user quotas.

To turn on quotas for a mounted file system, you use the syntax:

vxquotaon mount_point

For example, to turn on quotas for the VERITAS file system mounted at /mnt, you type:

# vxquotaon /mnt

56

Page 57: File System Fundamentals

To mount a file system and turn on quotas at the same time, you use the syntax:

mount −F vxfs −o quota special mount_point

For example, to mount a VERITAS file system on the device/dev/dsk/c0t5d0s2 at the mount point /mnt, you type:

# mount −F vxfs −o quota /dev/dsk/c0t5d0s2 /mnt

Step 3: Invoke the Quota Editor

To invoke the quota editor, you use the syntax:

vxedquota username

For example, to invoke the quota editor for the user with the username rsmith, you type:

# vxedquota rsmith

You can specify either username or UID as the user name on the command line. For each user,a temporary file is created with an ASCII representation of the current disk quotas for eachmounted VxFS file system that has a quotas file in the root directory. The temporary file isinvoked in an editor, with which you can modify existing quotas and add new quotas. Afterexiting the editor, vxedquota reads the temporary file and modifies the contents of the binaryquota file to reflect the new quota limits.

The editor invoked is vi unless the environment variable EDITOR specifies another editor.Unassigned UIDs can be specified to create quota limits for future users. This can be useful forestablishing default quotas for users who are later assigned a UID. Unassigned user namescannot be used similarly.

Step 4: Modify Quota Limits

The vxedquota command creates a temporary file for a specific user. This file contains on−diskquotas for each mounted VxFS file system that has an internal quotas file. The temporary filehas one or more lines similar to:

fs /mnt blocks (soft=0, hard=0) inodes (soft=0, hard=0)

fs /mnt1 blocks (soft=100, hard=200) inodes (soft=10, hard=20)

You can edit the soft or hard limits for blocks (data block usage) and for inodes (file usage).

Step 5: Edit the Time Limit

To modify the time limit for a file system, you use the syntax:

vxedquota −t

The temporary file created has one or more lines in the form:

fs mount_point blocks time limit=time, files time limit=time

57

Page 58: File System Fundamentals

The time consists of a number and a time unit, for example, 12 hours. The time unit can bemonth, week, day, hour, min, or sec. Characters appended to these keywords are ignored, so,for example, months or minutes is accepted. Time limits are printed in the greatest possible timeunit such that the value is greater than or equal to one.

If the time limit is zero, the default time limits in /usr/include/sys/fs/vx_quota.h are used. If thedefault time limit is zero, then the first time you edit the time limit, the temporary file shouldcontain a line similar to:

fs /mnt1 blocks time limit = 0 (default), files time limit = 0 (default)

To set the time limit to one hour, you edit the line as follows:

fs /mnt1 blocks time limit = 1 hour, files time limit = 1 hour

Step 6: Confirm Quota Changes

To view quotas for a given user, you use the syntax:

vxquota −v username

This displays the user's quotas and disk usage on all mounted VERITAS file systems where thequotas file exists.

For example, to view the quotas for the user rsmith, you type:

# vxquota −v rsmith

The output displayed contains lines similar to:

Turning Off Quotas

You can turn off quotas for a mounted file system using the vxquotaoff command. To turn offquotas for a file system, you use the syntax:

vxquotaoff mount_point

For example, to turn off quotas for a VERITAS file system mounted at /mnt, you type:

# vxquotaoff /mnt

58

Page 59: File System Fundamentals

Controlling User Access

What Are ACLs?

Traditional UNIX file protection enables you to specify read, write, and execute permissions forthree classes of users: the file owner, the file group, and other users. An access control list(ACL) extends file protection by enabling you to define file permissions for specific users andgroups.

An ACL stores a series of entries that identify specific users or groups and their accessprivileges for a particular file. A file can have its own ACL or can share an ACL with other files inthe same directory. Using ACLs, you can specify detailed access permissions for multiple usersand groups.

VERITAS File System versions 3.2 and later and Version 4 file system layout support the use ofACLs.

Examples: Using ACLs

For example, standard UNIX file protection enables you to give a group read permission to aparticular file. Using an ACL, you can give one specific member of that group write permissionto that file as well, without granting write permission to the entire group.

Here is another example. Suppose that Group 1 has permission to read File A and Group 2 haspermission to read File B. If the user Maria is a member of both groups, then she must switchbetween groups in order to read the files. By setting an ACL on the files, you can grant Mariapermission to read both files without having to change groups

Setting ACLs

The setfacl Command

To set or modify an ACL for a file, you use the setfacl command. The setfacl command enablesyou to replace an existing ACL or to add, modify, or delete ACL entries. The syntax for thesetfacl command takes one of the following formats:

setfacl [−r] −s acl_entries file

setfacl [−r] −md acl_entries file

setfacl [−r] −f acl_file file

59

Page 60: File System Fundamentals

In the syntax, you specify the command, followed by the option representing the type ofoperation, one or more ACL entries, and the name of the file for which you are setting the ACL.

Options

The −s option sets an ACL for a file. All old ACL entries are removed and replaced withthe new ACL. You must specify ACL entries for the file owner, the file group, and others.

The −m option adds new ACL entries to a file or modifies existing entries to a file. If anentry already exists, then the permissions you specify replace the current permissions. Ifan entry does not exist, it is created.

You use the −d option to remove an ACL entry for a user.♦ You use the −f option to set an ACL for a file with ACL entries contained in the namedfile acl_file. If you use − for the acl_file, then standard input is used to set the ACL forthe file.

You use the −r option to recalculate the permissions for the ACL mask entry.♦ You can use the character # in an ACL file to indicate a comment. All characters from #to the end of the line are ignored.

ACL Entries

An ACL entry consists of three elements:

entry_type:[uid|gid]:permissions

The entry type is the type of ACL entry on which to set file permissions, and can be user,group, other, or mask.

The uid represents a user name or identification number. For group permissions, youspecify the gid, which represents a group name or identification number.

The permissions variable is where you specify read, write, and execute permissions asindicated by the symbolic characters rwx or by a permission number as used with thechmod command.

For example, an ACL entry that grants read/write permissions for the user bob is:

user:bob:rw−

For more details about the syntax of ACL entries, see the setfacl(1) manual pages.

Examples: Setting ACLs

Add one ACL entry to a file called myfile and give user bob read permission only:♦ # setfacl −m user:bob:r−− myfile

Delete the ACL entry for the user scott from the file myfile:♦ # setfacl −d user:scott myfile

Note: When deleting an ACL entry, you do not specify permissions.

Replace the entire ACL for the file myfile, with these specifications:♦ Give the file owner read, write, and execute permissions.◊ Give the file group owner read access only.◊ Give the user maria read access only.◊ Do not give access to any other users.◊

# setfacl −s user::rwx,group::r−−,user:maria:r−−,

60

Page 61: File System Fundamentals

mask:rw−,other:−−− myfile

Viewing ACLs

The getfacl Command

If you want to verify that an ACL was set for a file or to check if a file has an associated ACL,you use the getfacl command. The getfacl command displays ACL entries for a file. The syntaxfor the getfacl command is:

getfacl filename

If you specify multiple file names in the command, then the ACL entries for each file areseparated by a blank line.

Note: If you want to find out if an ACL exists for a file, but do not need to know what the ACL is,you can also use ls −l.

Example: Viewing ACLs

To view the ACLs for the file myfile, you type:

# getfacl myfile

Example: Setting the Same ACL on Two Files

The file myfile already has an associated ACL. To set the same ACL on the file called newfile,using the standard input, you type:

# getfacl myfile | setfacl −f − newfile

Lesson Summary

When administering a file system, you sometimes need to establish limits on the use of filesystem resources and secure files from different types of user access. VERITAS File Systemsupports the use of quotas for limiting disk usage for individual users and the use of AccessControl Lists (ACLs) for enhancing file security. In this lesson, you set user quotas and ACLs fora VERITAS file system.

Additional Resources

VERITAS File System System Administrator's Guide

This guide describes VERITAS File System concepts, how to use various utilities, and how toperform backup procedures

61