IRIX Disks and Filesystems: fx, XFS, XLV, mkfs_xfs and /etc/fstab

SGI IRIX series, part 4. Earlier parts: IRIX overview and history, admin commands, and installing software and patches. This part covers disks and filesystems on IRIX 6.5: fx, the volume header, XFS, XLV, mkfs_xfs, xfs_growfs and /etc/fstab. For the Solaris layout of the same ideas, see Solaris Filesystem Layout Tour.

Commands and layout rules come from the IRIX 6.5.30 reference pages for fx, mkfs_xfs, xfs_growfs, xlv_make and fstab. This is a reference post, not a lab. I did not run these commands on IRIX hardware for this post. A mistake in fx expert mode, or a mkfs on the wrong partition, destroys data. Work on a copy or a disposable disk until you are sure of the device names.

Prerequisites

  • An IRIX 6.5.x system and a console (graphics or serial). To change the system disk layout you must use the standalone fx from the PROM, not the IRIX command, because that disk is in use.
  • Root access for fx, mkfs_xfs, xlv_make and edits to /etc/fstab.
  • A backup of any filesystem you are about to repartition or grow. Growing XFS does not disturb existing data, but the steps that add space (repartition, XLV changes) can.
  • The disk names from hinv -c disk and the device nodes under /dev/dsk and /dev/rdsk.

How IRIX names disks

On SCSI systems the block and raw devices look like /dev/dsk/dks0d1s7 and /dev/rdsk/dks0d1s7: SCSI controller 0, drive address 1, partition 7. Fibre Channel fabric devices use a different naming scheme and, according to the fx page, must be given to the IRIX fx with -d (the standalone fx does not support them).

Two partitions appear on every SGI-labeled disk:

  • Partition 8 is the volume header. It holds the disk label, the partition table, and standalone programs such as sash and fx.
  • Partition 7 on an option disk is, in the default fx layout, the whole usable portion of the drive (everything after the volume header). The mkfs_xfs page uses this as its example: mkfs_xfs /dev/dsk/dks0d7s7.

A system disk uses a different default: fx scripts call this the root layout, with root and swap partitions (and often a separate /usr). Device aliases such as /dev/root, /dev/rroot, /dev/usr and /dev/swap usually point at those partitions. Always read the label before you write anything:

hinv -c disk
ls /dev/dsk /dev/rdsk
fx -x   # then choose the drive and use the label/show menus; see below

fx: partition and label the disk

fx is the interactive disk utility. It reads and writes the SGI volume header, shows and changes partition sizes and types, and can scan for bad blocks. There are two versions:

  • Standalone fx, booted from the PROM. You must use this when you modify the system disk. You can use it for other disks as well.
  • The IRIX command /usr/sbin/fx (or just fx), used as root on disks that are not mounted as the system disk. It supports scripting (-s), logging (-l) and Fibre Channel -d names. It will refuse some dangerous operations on mounted filesystems.

Expert mode is fx -x. The man page warns you not to use it unless you already know the drive’s parameters and partitions. In expert mode fx can create or rewrite the label, change geometry, and format a disk. A wrong answer can destroy every filesystem on the drive.

Boot standalone fx

From the System Maintenance Menu, enter the Command Monitor (part 6 covers the PROM in detail). The fx(1M) page gives these examples for booting fx from an IRIX CD, where ctlr is the CD-ROM controller (usually 0) and unit is its SCSI id:

# 32-bit ARCS PROM (Indy, Indigo2, O2, and similar)
>> boot -f dksc(ctlr,unit,8)sashARCS dksc(ctlr,unit,7)stand/fx.ARCS

# 64-bit ARCS PROM (Octane, Origin, Fuel, Tezro, and similar)
>> boot -f dksc(ctlr,unit,8)sash64 dksc(ctlr,unit,7)stand/fx.64

A typical option-disk session

For a new data disk, the usual IRIX-command path is: start fx, select the drive, and run auto from the main menu. The man page says auto initializes the volume header, scans for bad blocks, writes a label, and creates a default option disk partition layout (partition 7 as the usable whole disk). On current SCSI disks, auto does not format the drive; formatting is a separate, destructive expert operation and is rarely needed.

# example: IRIX command, expert mode, on a machine that already boots
su
fx -x

# At the fx prompts, select the controller and unit for the new drive,
# then use the auto item on the main menu for an option-disk label.
# Use label/show to read the partition table before you leave.

To build a system disk (root and swap), use the standalone fx and the root layout, not option. That is the path for a replacement system disk or a recovery rebuild, and it goes with a miniroot install (parts 3 and 6), not with a live mkfs of the disk you are running from.

Partition types that matter later for XFS and XLV are xfs, efs (the older SGI filesystem), xlv and xfslog. After you leave fx, you still have to make a filesystem and mount it. The Add_disk command can do the mkfs, mount point and /etc/fstab step for a simple option disk; the System Manager Disk Manager can do the same from the desktop.

Make an XFS filesystem

XFS is the native IRIX filesystem (and later became the default on AlmaLinux and RHEL). mkfs_xfs writes an XFS filesystem onto a partition or an XLV volume. mkfs -t xfs is the same tool. In the common case you let it take the size from the device. The official example is an option drive, controller 0, unit 7, partition 7, with an internal log:

mkfs_xfs /dev/dsk/dks0d7s7

XFS has a data section, a log section, and an optional real-time section. On a single partition the log is usually internal (embedded in the data section). On an XLV volume you can put the log on a separate log subvolume. Useful options, all documented on mkfs_xfs(1M):

# example: internal log, explicit block size, quieter output
mkfs_xfs -b size=4096 -l internal,size=64m -q /dev/dsk/dks0d2s7

# example: filesystem on an XLV volume (after xlv_make / xlv_assemble)
mkfs_xfs /dev/dsk/xlv/datavol

This command is destructive. Confirm the device with hinv, fx label/show, and mount (it must not already be mounted) before you run it.

XLV logical volumes

XLV is the IRIX logical volume manager (it replaced the older lv volumes). You compose a volume from plexes and volume elements, optionally with separate data, log and real-time subvolumes. Mirroring is done with more than one plex; striping or concatenation is done at the volume-element level.

xlv_make writes XLV labels onto the partitions. It can run interactively or from a command file. The partitions must not already belong to another volume object, and they must be of type xfs, efs, xlv or xfslog unless you force the type. Objects are specified top-down: volume, then subvolume, then plex, then volume element. A short command-file example looks like this:

# example xlv_make command file for a simple concatenated data volume
vol datavol
data
plex
ve /dev/dsk/dks0d2s7 /dev/dsk/dks0d3s7
end
exit
xlv_make -f /tmp/datavol.xlv

On a successful exit, xlv_make runs xlv_assemble by default. xlv_assemble scans the disks and activates the volumes. Use xlv_mgr later to extend, change or destroy volume objects; use xlv_shutdown when you need to take a volume down cleanly. Device nodes appear under /dev/dsk/xlv/ and /dev/rdsk/xlv/ with the volume name.

Mount the filesystem and edit /etc/fstab

The file /etc/fstab lists filesystems and swap. Each line is:

filesystem  directory  type  options  frequency  pass

The fstab(4) example for the root filesystem is:

/dev/root   /   xfs   rw  0 0

For an option disk or an XLV volume, use the block device, an XFS type, and usually a raw= option so fsck can find the character device. A # starts a comment. Example entries (adjust the names to your machine):

# example: option disk on partition 7, mounted on /disk2
/dev/dsk/dks0d2s7  /disk2  xfs  rw,raw=/dev/rdsk/dks0d2s7  0  0

# example: XLV volume
/dev/dsk/xlv/datavol  /data  xfs  rw,raw=/dev/rdsk/xlv/datavol  0  0

# example: extra swap partition
/dev/dsk/dks0d2s1  swap  swap  sw  0  0

Create the mount point, mount everything listed (except noauto entries), and confirm:

mkdir /disk2
mount /disk2
# or: mount -a
df -k
mount

Other fstab options worth knowing: noauto skips the entry during mount -a; fsck / nofsck control whether a default fsck run checks that filesystem; ro mounts read-only. Root is mounted before /etc/fstab can be read, so options on the root line do not apply the way they do on other filesystems.

Grow an XFS filesystem

xfs_growfs expands an XFS filesystem that is already mounted. Existing data is left alone. You pass the mount point, not the device:

# print geometry, make no change
xfs_growfs -n /disk2

# grow the data section to the largest size the device now allows
xfs_growfs -d /disk2

The filesystem has to have somewhere to grow into. On a plain partition that usually means you enlarged the partition (same starting block) with standalone fx or moved the filesystem onto a larger XLV volume. On an XLV volume, extend the volume first with xlv_mgr, then run xfs_growfs on the mount point. The -D, -L and -R options grow the data, log and real-time sections to a size you specify, in filesystem blocks.

Check and repair

Unmount the filesystem first unless you are only looking. xfs_repair -n checks without writing; xfs_repair repairs. xfs_check is the older checker. Run repair from the miniroot if the filesystem is the root filesystem (part 6).

umount /disk2
xfs_repair -n /dev/dsk/dks0d2s7
xfs_repair /dev/dsk/dks0d2s7
mount /disk2

Verification checklist

  • hinv -c disk lists the drives you expect, and fx label/show matches the partition layout you intended (option disk: partition 7 is the usable whole disk; system disk: root and swap are where you think they are).
  • mkfs_xfs was run only on the target partition or volume, and mount shows it at the right mount point with type xfs.
  • /etc/fstab has a line for the filesystem, with a correct raw= path, and the mount survives a reboot.
  • If you used XLV, xlv_assemble has been run (or happened at the end of xlv_make), and /dev/dsk/xlv/name exists.
  • After a grow, xfs_growfs -n /mount and df -k show the new size.

Troubleshooting

ProblemLikely causeFix
fx or mkfs_xfs refuses the system diskThe disk is mounted; the IRIX fx cannot safely relabel itBoot standalone fx from the PROM or an IRIX CD. Do not force a live relabel of the system disk.
Wrong disk formattedDevice name mapped to the wrong unitStop. Restore from backup. Always match hinv -c disk to the dks<ctlr>d<unit> name before mkfs_xfs or fx auto.
xlv_make rejects a partitionType is not xfs/efs/xlv/xfslog, or the partition is already in a volume or mountedChange the type in fx, unmount, and do not use -f unless you are converting an old lv volume and understand the risk.
Volume missing after rebootXLV labels not assembled, or a disk is missingRun xlv_assemble, check hinv, and read the XLV messages in /var/adm/SYSLOG.
xfs_growfs does nothing usefulThe device was not enlarged firstExtend the XLV volume or the partition, then rerun xfs_growfs -d. Use -n first to see the geometry.
Filesystem will not mount at bootBad /etc/fstab line, missing raw= device, or XLV not up yetFix the line (fields are whitespace-separated), confirm the device exists, and mount by hand from single-user if needed.
xfs_repair wanted on rootRoot is dirty or damagedBoot the miniroot (part 6) and repair /root, not a live mounted root.

AlmaLinux equivalents

  • Partitioning: parted or fdisk (and UEFI/GPT), not a PROM volume header. There is no fx.
  • XFS is still the default: sudo mkfs.xfs /dev/sdb1, sudo xfs_growfs /mount, sudo xfs_repair.
  • Logical volumes: LVM2 (pvcreate, vgcreate, lvcreate, lvextend) rather than XLV.
  • /etc/fstab has the same six-field shape; use UUIDs (blkid, xfs_admin -u) instead of unstable device names.

Next in this series

Part 5 covers IRIX networking: /etc/sys_id, /etc/hosts, netif.options, NFS and OpenSSH. Part 6 returns to the PROM, standalone tools and miniroot recovery used in this post.

Sources

  • IRIX 6.5.30 reference pages: fx(1M), mkfs_xfs(1M), xfs_growfs(1M), xlv_make(1M), xlv_assemble(1M), xlv_mgr(1M), fstab(4), as published on man.irix.fans.
  • SGI, IRIX Admin: Disks and Filesystems (document 007-2825).
  • AlmaLinux and RHEL documentation for XFS and LVM.

Leave a Reply

Your email address will not be published. Required fields are marked *