Veritas File System (VxFS) overview and commands
The Veritas File System (VxFS) was one of the first commercial journalling file systems. It is fast, recovers quickly after a crash, and can be resized and defragmented while it is in use. It usually sits on a VxVM volume.
Features
- Intent log (journal): after a crash, the file system is consistent again in seconds, without a full check.
- Extent-based allocation: large contiguous areas for big files, good for databases.
- Online administration: grow, shrink and defragment while mounted.
- Storage checkpoints: space-efficient point-in-time copies of the whole file system.
- Cluster File System (CFS): the same file system mounted on several nodes at once.
- Concurrent I/O and direct I/O options for databases.
Create and mount
mkfs -t vxfs /dev/vx/rdsk/datadg/appvol # Linux (on AIX: mkfs -V vxfs, Solaris: mkfs -F vxfs)
mkdir -p /app
mount -t vxfs /dev/vx/dsk/datadg/appvol /app
fstyp -v /dev/vx/dsk/datadg/appvol | head # layout version and settings
Outside a cluster, add the file system to /etc/fstab (Linux), /etc/filesystems (AIX) or /etc/vfstab (Solaris). Inside a VCS cluster, leave it out: the Mount resource mounts it.
Resize
The simplest way is vxresize, which resizes the volume and the file system together (see Volume Manager). fsadm resizes only the file system, for example after growing the volume separately:
fsadm -t vxfs -b 150g /app # set the file system size to 150 GB
Defragment
fsadm -t vxfs -D -E /app # report directory and extent fragmentation
fsadm -t vxfs -d -e /app # reorganise directories and extents
Run defragmentation in a quiet period; on busy file systems it is worth scheduling it weekly from crontab.
Storage checkpoints
fsckptadm create before_upgrade /app
fsckptadm list /app
mount -t vxfs -o ckpt=before_upgrade /dev/vx/dsk/datadg/appvol:before_upgrade /app_ckpt # read the old state
fsckptadm remove before_upgrade /app
Checkpoints use space only for blocks that change afterwards. Remove them when no longer needed, or they slowly fill the file system.
Tuning
vxtunefs /app # current I/O parameters
vxtunefs -o read_pref_io=262144 /app # change one (until the next mount)
# permanent settings go in /etc/vx/tunefstab
For databases, mount options such as -o cio (concurrent I/O) avoid double caching between the database and the file system. Follow your database vendor's recommendations.
Check and repair
umount /app
fsck -t vxfs /dev/vx/rdsk/datadg/appvol # replays the intent log (normally quick)
fsck -t vxfs -o full -y /dev/vx/rdsk/datadg/appvol # full structural check
A full check is needed only when VxFS marks the file system for it after detecting damage; the system log says so.
Cluster File System
With InfoScale Storage or Enterprise, a VxFS file system on a shared disk group can be mounted on all nodes at once (mount -t vxfs -o cluster), managed through cfsmntadm and the CFSMount resource in VCS. Applications on every node see the same files, which speeds up failover because nothing needs to be unmounted and remounted.