Chapter 2. XFS Filesystem Administration

This chapter explains the procedures for creating XFS filesystems, converting EFS filesystems to XFS, and performing filesystem administration tasks that require programs specific to XFS.

The main sections in this chapter are:

Planning for XFS Filesystems

The following subsections discuss choices you must make and preparation for creating an XFS filesystem. Each time you plan to make an XFS filesystem or convert a filesystem from EFS to XFS, you should review each section and make any necessary preparations.

Don't Use XFS When ...

Do not use an XFS filesystem if any of the following is true:

  • There is insufficient free disk space (see the section “Checking for Adequate Free Disk Space” in this chapter).

  • The system doesn't meet the hardware configuration requirements listed in the section “Hardware Requirements” in “About This Guide.”

  • The filesystem is the root filesystem and you intend to increase its size later. In this case, delay the conversion until you are ready to increase the size of the filesystem.

  • The filesystems are the root and, if present, usr filesystems and you want to continue using the System Recovery procedure (item 4, Recover System, on the System Maintenance Menu). System Recovery doesn't work with XFS filesystems because of the limitations of bru(1M), which is used by System Recovery. However, xfsdump(1M) can be used to create backups that can be used to recover the system, if necessary.

Prerequisite Software

Using XFS filesystems and XLV logical volumes requires at least IRIX 5.3 with XFS or a later system software release. The procedures in this chapter assume that the proper software has been installed and the system rebooted prior to beginning the procedure.

Some important subsystems in the IRIX 5.3 with XFS and later releases are:

eoe1.sw.unix  

The minimum release level is IRIX 5.3 with XFS.

eoe2.sw.efs  

This subsystem is required.

eoe2.sw.lv  

This subsystem needs to be installed only if lv logical volumes are in use on the system.

eoe2.sw.xfs  

This subsystem is required.

eoe2.sw.xlv 

Install this subsystem if you intend to use the XLV volume manager.

eoe2.sw.xlvplex  

Install this subsystem if you have purchased the Disk Plexing Option software option.

In addition to the subsystems listed above, software patches may be required to use all of the features documented in this guide. See the xfs, IRIX, eoe, nfs, and dev Release Notes for more information.

If you are converting the root and usr filesystems, you must have software distribution CDs or access to a remote distribution directory for IRIX Release 5.3 with XFS or a later system software release. Instructions on loading the miniroot from these CDs is provided in Chapter 3 of the Software Installation Administrator's Guide.

Choosing Block Sizes

XFS allows you to choose two types of block sizes for each filesystem. (EFS has a fixed block size of 512 bytes.) One is the filesystem block size, used for user files, and the other is the extent size, used for the real-time subvolume on an XLV logical volume, if present. The extent size is the amount of space that will be allocated to the file every time more space needs to be allocated to it.

For XFS filesystems on disk partitions and for the data subvolume of filesystems on XLV volumes, the block size guidelines for user files are:

  • The minimum block size is 512 bytes.

  • The maximum block size is 65536 bytes (64K). However, in general block sizes shouldn't be larger than 4096 bytes.

  • The default block size is 4096 bytes (4K).

  • For root filesystems on systems with separate root and usr filesystems, the recommended block size is 512 bytes. (Root filesystems in this configuration usually don't have much extra disk space and large block sizes compound the problem.)

  • For news servers, the recommended block size is 2048 bytes.

  • In general, the recommended block size for filesystems under 100 MB is 512 bytes. For larger filesystems 4096 bytes is recommended.

Block sizes are specified in bytes in decimal (default), octal (prefixed by 0), or hexadecimal (prefixed by 0x or 0X). If the number has the suffix “k”, it is multiplied by 1024. If the number has the suffix “m”, it is multiplied by 1048576 (1024 * 1024).

For real-time subvolumes of XLV logical volumes, the block size is the same as the block size of the data subvolume. The guidelines for the extent size are:

  • The extent size must be a multiple of the block size of the data subvolume.

  • The minimum extent size is 64 KB.

  • The maximum extent size is 1 GB.

  • The default extent size is 64 KB.

  • The extent size should be matched to the application and the stripe unit of the volume elements used in the real-time subvolume.

Choosing the Log Type and Size

Each XFS filesystem has a log that contains filesystem journaling records. This log requires dedicated disk space. This disk space doesn't show up in df(1) listings, nor can you access it with a filename.

The location of the disk space depends on the type of log you choose. The two types of logs are:

external 

When an XFS filesystem is created on an XLV logical volume and log records are put into a log subvolume, the log is called an external log. The log subvolume is one or more disk partitions dedicated to the log exclusively.

internal 

When an XFS filesystem is created on a disk partition, or when it is created on an XLV logical volume that doesn't have a log subvolume, log records are put into a dedicated portion of the disk partition (or data subvolume) that contains user files. This type of log is called an internal log.

The guidelines for choosing the log type are:

  • If you want the log and the data subvolume to be on different partitions or to use different subvolume configurations for them, use an external log.

  • If you are making the XFS filesystem on a disk partition (rather than on an XLV logical volume), you must use an internal log.

  • If you are making the XFS filesystem on an XLV logical volume that has no log subvolume, you must use an internal log.

  • If you are making the XFS filesystem on an XLV logical volume that has a log subvolume, you must use an external log.

For more information about XLV and log subvolumes, see Chapter 4, “XLV Logical Volumes.”

The amount of disk space needed for the log is a function of how the filesystem is used. The amount of disk space required for log records is proportional to the transaction rate and the size of transactions on the filesystem, not the size of the filesystem. Larger block sizes result in larger transactions. Transactions from directory updates (for example, mkdir(1), rmdir(1), create(2), and unlink(2)) cause more log data to be generated. You must choose the amount of disk space to dedicate to the log (called the log size).

The minimum log size is 512 blocks. Some guidelines for log sizes are shown in Table 2-1.

Table 2-1. Log Size Guidelines

Log Size

Blocks

Transaction Activity

Small

512 blocks

Low update activity or small filesystem (less than 100 MB)

Medium

2000 blocks

Average

Large

4000 blocks

Very high

For external logs, the size of the log is the same as the size of the log subvolume. The log subvolume is one or more disk partitions. You may find that you need to re-partition a disk to create a properly sized log subvolume (see the section “Disk Partitioning” in this chapter). For external logs, the size of the log is set when you create the log subvolume with xlv_make(1M).

For internal logs, the size of the log is specified when you create the filesystem with mkfs(1M).

The log size is specified in bytes or as a multiple of the filesystem block size. Decimal numbers are the default, but they can be specified in octal (prefixed by 0) or hexadecimal (prefixed by 0x or 0X). Numbers with no suffixes are bytes. If the number has the suffix “k”, it is multiplied by 1024 bytes. If the number has the suffix “m”, it is multiplied by 1048576 (1024 * 1024) bytes or one megabyte. If the number has the suffix “b”, it is multiplied by the filesystem block size.

Checking for Adequate Free Disk Space

XFS filesystems may require more disk space than EFS filesystems for the same files. This extra disk space is required to accommodate the XFS log and as a result of block sizes larger than EFS's 512 bytes. However, XFS represents free space more compactly, on average, and the inodes are allocated dynamically by XFS, which can result in less disk space usage.

This procedure can be used to get a rough idea of the amount of free disk space that will remain after a filesystem is converted to XFS:

  1. Get the size in kilobytes of the filesystem to be converted and round the result to the next megabyte. For example:

    df -k 
    Filesystem           Type  kbytes     use   avail %use  Mounted on
    /dev/root             efs  969857  648451  321406  67%  /
    

    This filesystem is 969857 KB, which rounds up to 970 MB.

  2. If you plan to use an internal log (see the section “Choosing the Log Type and Size” in this chapter), give this command to get an estimate of the disk space required for the files in the filesystem after conversion:

    xfs_estimate -i logsize -b blocksize mountpoint 
    

    logsize is the size of the log. blocksize is the block size you chose for user files in the section “Choosing Block Sizes” in this chapter. mountpoint is the directory that is the mount point for the filesystem.

    The output of this command tells you how much disk space the files in the filesystem and an internal log of size logsize will take after conversion to XFS.

  3. If you plan to use an external log, give this command to get an estimate of the disk space required for the files in the filesystem after conversion:

    xfs_estimate -e 0 -b blocksize mountpoint 
    

    blocksize is the block size you chose for user files in the section “Choosing Block Sizes” in this chapter. mountpoint is the directory that is the mount point for the filesystem.

    The first line of output from xfs_estimate tells you how much disk space the files in the filesystem will take after conversion to XFS. In addition to this, you will need disk space on a different disk partition for the external log. You should ignore the second line of output.

  4. Compare the size of the filesystem from step 1 with the size of the files from step 2 or step 3. For example,

    970 MB - 739 MB = 231 MB free disk space
    739 MB / 970 MB = 76.2% full
    

    Use this information to decide if there will be an adequate amount of free disk space if this filesystem is converted to XFS.

If the amount of free disk space after conversion is not adequate, some options to consider are:

  • Implement the usual solutions for inadequate disk space: remove unnecessary files, archive files to tape, move files to another filesystem, add another disk, and so on.

  • Repartition the disk to increase size of the disk partition for the filesystem.

  • If there isn't sufficient disk space in the root filesystem and you have separate root and usr filesystems, switch to combined root and usr filesystems on a single disk partition.

  • If the filesystem is on an lv logical volume or an XLV logical volume, increase the size of the volume.

  • Create an XLV logical volume with a log subvolume elsewhere, so that all of the disk space can be used for user files.

Disk Partitioning

Many system administrators may find that they want or need to repartition disks when they switch to XFS filesystems and/or XLV logical volumes. The next two subsections explain why you might want to repartition and give some tips on partition sizes and types.

Why Should Disks Be Repartitioned?

Some of the reasons to consider repartitioning are:

  • If the system disk has separate partitions for root and usr, the root partition may be running out of space. Repartitioning is a way to increase the space in root (at the expense of the size of usr) or to solve the problem by combining root and usr into a single partition.

  • System administration is a little easier on systems with combined root and usr filesystems.

  • If you plan to use XLV logical volumes, you may want to put the XFS log into a small subvolume. This requires disk repartitioning to create a small partition for the log subvolume.

  • If you plan to use XLV logical volumes, you may want to repartition to create disk partitions of equal size that can be striped or plexed.

How Should Disks Be Repartitioned?

Explaining the details of using fx to repartition a disk is beyond the scope of this guide (see the fx(1M) reference page for details). However, the list below provides useful information about new features of fx and about partitioning details that are specific to XFS and XLV.

  • If you are repartitioning the system disk, you must use the standalone version of fx. Otherwise, you can use the IRIX version of fx. Using the expert mode of fx (the –x option) shouldn't be necessary.

  • If you repartition a system disk, remember that the swap space should never be less than 40 MB. A smaller swap space impacts system performance and makes it impossible to install software using the miniroot.

  • New partition types have been added to fx. Table 2-2 lists and describes all partition types.

    Table 2-2. Disk Partition

    Type

    Description

    efs

    Used for an EFS filesystem

    lvol

    Part of an lv logical volume

    raw

    Used for data

    xfs

    Used for an XFS filesystem

    xfslog

    Used for an XFS filesystem log

    xlv

    Part of an XLV logical volume

    volhdr

    Volume header

    volume

    Entire volume


  • The repartition/usrroot and repartition/option menu items have been changed. If you select these menu items, you are asked what type of data partition you want. If you enter xfs, you are asked if you want a log partition. If you answer yes, fx makes partition 15 into a 4 MB xfslog partition, which can be used for an XLV log subvolume.

Dump and Restore Requirements

The filesystem conversion procedures in the sections “Converting Filesystems on the System Disk From EFS to XFS” and “Converting a Filesystem on an Option Disk from EFS to XFS” in this chapter require that you dump the filesystems you plan to convert to tape or to another disk with sufficient free disk space to contain the dump image.

When you convert a system disk, you must use dump(1M) and restore(1M). When you convert a filesystem on an option disk, you can any backup and restore programs. The reference pages for dump and restore are included in Appendix B, “Reference Pages.”

If you dump to a tape drive, follow these guidelines:

  • Have sufficient tapes available for dumping the filesystems to be converted.

  • If you are converting filesystems on a system disk, the tape drive must be local.

  • If you are converting filesystems on option disks, the tape drive can be local or remote.

The requirements for dumping to a different filesystem are:

  • The filesystem being converted must have 2 GB or less in use (the maximum size of the dump image file on an EFS filesystem).

  • The filesystem that will contain the dump must have sufficient disk space available to hold the filesystems to be converted.

  • If you are converting filesystems on a system disk, the filesystem where you place the dump must be local to the system.

  • If you are converting filesystems on option disks, the filesystem you dump to can be local or remote.

Dumping to disk takes about 10 minutes per gigabyte. Dumping to tape takes about 12 minutes per 100 megabytes.

Making an XFS Filesystem on a Disk Partition

This section explains how to create an XFS filesystem on an empty disk partition. This procedure applies to two cases:

  • The disk partition is not part of an XLV logical volume.

  • The disk partition is part of an XLV logical volume that doesn't have a log subvolume (the log is internal).

See the section “Making an XFS Filesystem on an XLV Logical Volume” in this chapter for instructions on creating an XFS filesystem on an XLV logical volume that has a log subvolume (an external log).

You must be superuser to perform this procedure.

  1. Review the subsections within the section “Planning for XFS Filesystems” in this chapter to verify that you are ready to begin this procedure.

  2. Identify the device name of the partition, partition, where you plan to create the filesystem. For example, if you plan to use partition 7 (the entire disk) of a SCSI option disk on controller 0, unit 2, partition is /dev/dsk/dks0d2s7. For more information on determining partition (also known as a special file), see dks(7M) for SCSI disks and ipi(7M) for Xylogics IPI disks.

  3. If the disk partition is already mounted, unmount it:

    umount partition
    

    Any data that is on the disk partition will be destroyed (to convert the data rather than destroy it, use the procedure in the section “Converting a Filesystem on an Option Disk from EFS to XFS” in this chapter instead).

  4. Use the mkfs(1M) command to create the new XFS filesystem:

    mkfs -d name=partition -b size=blocksize -l internal,size=logsize
    

    blocksize is the filesystem block size (see the section “Choosing Block Sizes” in this chapter) and logsize is the size of the area dedicated to log records (see the section “Choosing the Log Type and Size” in this chapter).

    Example 2-1 shows the command line used to create an XFS filesystem and the system output. The filesystem has a 10 MB internal log and a block size of 1K bytes and is on the partition /dev/dsk/dks0d2s7.

    Example 2-1. mkfs Command for an XFS Filesystem With an Internal Log


    mkfs -d name=/dev/dsk/dks0d2s7 -b size=1k -l internal,size=10m 
    meta-data=/dev/dsk/dks0d2s7      isize=256    agcount=8, agsize=128615 blks
    data     =                       bsize=1024   blocks=1028916
    log      =internal log           bsize=1024   blocks=10240
    realtime =none                   bsize=65536  blocks=0, rtextents=0
    

  5. If it doesn't already exist, create a mount point directory, mountdir, for the filesystem:

    mkdir mountdir 
    

  6. To mount the filesystem immediately, give this command:

    mount partition mountdir 
    

  7. To configure the system so that the new filesystem is automatically mounted when the system is booted, add this line to the file /etc/fstab:

    partition mountdir xfs rw,raw=rawpartition 0 0
    

    where rawpartition is the raw version of partition. For example, if partition is /dev/dsk/dks0d2s7, rawpartition is /dev/rdsk/dks0d2s7.

Making an XFS Filesystem on an XLV Logical Volume

This section describes how to make an XFS filesystem on an empty XLV volume that has an external log subvolume and a data subvolume. (Creating XLV volumes is explained in the section “Using xlv_make to Create Volume Objects” in Chapter 4.)

  1. Review the subsections within the section “Planning for XFS Filesystems” in this chapter to verify that you are ready to begin this procedure.

  2. Use the mkfs(1M) command to make the new XFS filesystem:

    mkfs -b size=blocksize volume 
    

    blocksize is the block size for filesystem (see “Choosing Block Sizes” in this chapter), and volume is the device name for the volume.

    Example 2-2 shows the command line used to create an XFS filesystem on a logical volume /dev/dsk/xlv/a and a block size of 1K bytes and the system output.

    Example 2-2. mkfs Command for an XFS Filesystem With an External Log


    mkfs -b size=1k /dev/dsk/xlv/a 
    meta-data=/dev/dsk/xlv/a         isize=256    agcount=8, agsize=245530 blks
    data     =                       bsize=1024   blocks=1964240
    log      =volume log             bsize=1024   blocks=25326
    realtime =none                   bsize=65536  blocks=0, rtextents=0
    

    Example 2-3 shows the command line used to create an XFS filesystem on a logical volume /dev/dsk/xlv/xlv_data1 and the system output. The default block size of 4096 bytes is used and the real-time extent size is set to 128K bytes.

    Example 2-3. mkfs Command for an XFS Filesystem With a Real-Time Subvolume


    mkfs_xfs -r extsize=128k /dev/rdsk/xlv/xlv_data1 
    meta-data=/dev/rdsk/xlv/xlv_data1 isize=256    agcount=8, agsize=4300 blks
    data     =                       bsize=4096   blocks=34400
    log      =volume log             bsize=4096   blocks=34400
    realtime =volume rt              bsize=131072 blocks=2560, rtextents=80
    

  3. If it doesn't already exist, create a mount point directory, mountdir, for the filesystem:

    mkdir mountdir 
    

  4. To mount the filesystem immediately, give this command:

    mount volume mountdir 
    

  5. To configure the system so the new filesystem is automatically mounted when the system is booted, add this line to the file /etc/fstab:

    volume mountdir xfs rw,raw=rawvolume 0 0
    

    where rawvolume is the raw version of volume. For example, if volume is /dev/dsk/xlv/a, rawvolume is /dev/rdsk/xlv/a and the /etc/fstab entry is:

    /dev/dsk/xlv/a /a xfs rw,raw=/dev/rdsk/xlv/a 0 0
    

Converting Filesystems on the System Disk From EFS to XFS

This section explains the procedure for converting filesystems on the system disk from EFS to XFS. Some systems have two filesystems on the system disk, the root filesystem (mounted at /) and the usr filesystem (mounted at /usr). Other systems have a single, combined root and usr filesystem mounted at /. This procedure covers both cases but assumes that neither lv nor XLV logical volumes are in use on the system disk. The basic procedure for converting a system disk is:

  • Load the IRIX 5.3 with XFS miniroot.

  • Do a complete dump of filesystems on the system disk.

  • Repartition the system disk if necessary.

  • Create one or two new, empty XFS filesystems.

  • Restore the files from the filesystem dumps.

  • Reboot the system.

During this procedure, you can repartition the system disk if needed. For example, you can convert from separate root and usr filesystems to a single, combined filesystem, or you can resize partitions to make the root partition larger and the usr partition smaller. See the section “Disk Partitioning” in this chapter for more information.

The early steps of this procedure ask you to identify the values of various variables, which are used later in the procedure. You may find it helpful to make a list of the variables and values for later reference. Be sure to perform only the steps that apply to your situation. Perform all steps as superuser.


Note: It is very important to follow this procedure as documented without giving additional inst or shell commands. Unfortunately, deviations from this procedure, even changing to a different directory or going from the inst shell to an inst menu when not directed to, can have very severe consequences from which recovery is difficult.


  1. Review the subsections within the section “Planning for XFS Filesystems” in this chapter to verify that you are ready to begin this procedure. In particular, be sure that the software listed in the section “Prerequisite Software” has been installed and the system has been rebooted.

  2. Verify that your backups are up to date. Because this procedure temporarily removes all files from your system disk, it is important that you have a complete set of backups that have been prepared using your normal backup procedures. You will make a complete dump of the system disk in step 11, but you should have your usual backups in addition to the backup made during this procedure.

  3. Use prtvtoc(1M) to get the device name of the root disk partition, rootpartition. For example:

    # prtvtoc
    Printing label for root disk
    
    * /dev/rdsk/dks0d1s0 (bootfile "/unix")
    ...
    

    The bootfile line contains the raw device name of the root disk partition, which is /dev/rdsk/dks0d1s0 in this example. rootpartition is the non-raw device name, which is /dev/dsk/dks0d1s0 in this example.

  4. If the system disk has separate root and usr filesystems, use the output of prtvtoc in the previous step to figure out the device name of the usr partition, usrpartition. Look for the line that shows a mount directory of /usr:

    Partition  Type  Fs   Start: sec   (cyl)    Size: sec    (cyl)  Mount Directory
    ...
    6          efs  yes      116725  ( 203)       727950   (1266)   /usr
    

    The usr partition number is shown in the first column of this line; it is 6 in this example. To determine the value of usrpartition, replace the final digit in rootpartition with the usr partition number. For this example, usrpartition is /dev/dsk/dks0d1s6.

  5. If you are using a tape drive as the backup device, use hinv(1M) to get the controller and unit numbers (<tapecntlr> and <tapeunit>) of the tape drive. For example:

    # hinv -c tape
    Tape drive: unit 2 on SCSI controller 0: DAT
    

    In this example, <tapecntlr> is 0 and <tapeunit> is 2.

  6. If you are using a disk drive as your backup device, use df(1) to get the device name, backupdevice, and mount point, backupfs, of the partition that contains the filesystem where you plan to put the backup. For example:

    # df
    Filesystem                 Type  blocks     use   avail %use  Mounted on
    /dev/root                   efs 1992630  538378 1454252  27%  /
    /dev/dsk/dks0d3s7           efs 3826812 1559740 2267072  41%  /d3
    /dev/dsk/dks0d2s7           efs 2004550      23 2004527   0%  /d2
    

    The filesystem mounted at /d2 has plenty of disk space for a backup of the system disk (/ uses 538,378 blocks and /d2 has 2,004,527 blocks available). The backupdevice for /d2 is /dev/dsk/dks0d2s7 and the backupfs is /d2.

  7. Create a temporary copy of /etc/fstab called /etc/fstab.xfs and edit it with your favorite editor. For example:

    # cp /etc/fstab /etc/fstab.xfs
    # vi /etc/fstab.xfs
    

    Make these changes in /etc/fstab.xfs:

    • Replace efs with xfs in the line for the root filesystem, /, if there is a line for root.

    • If root and usr are separate filesystems and will remain so, replace efs with xfs in the line for the usr filesystem.

    • If root and usr have been separate filesystems, but the disk will be repartitioned during the conversion procedure so that they are combined, remove the line for the usr filesystem.

  8. Shut down your workstation using shutdown(1M) or the “System Shutdown” item on the System toolchest. Answer prompts as appropriate to get to the five-item System Maintenance menu.

  9. Bring up the miniroot from system software CDs or a software distribution directory that contains the release IRIX 5.3 with XFS or a later release of IRIX. See the section “Prerequisite Software” in this chapter for more information.

  10. Switch to the shell prompt in inst:

    Inst> sh
    

  11. Create a full backup of the root filesystem by giving this command:

    # dump 0uCf tapesize dumpdevice rootpartition 
    

    tapesize is the tape capacity (it's used for backup to disks, too) and dumpdevice is the appropriate device name for the tape drive or the name of the file that will contain the dump image. Table 2-3 gives the values of tapesize and dumpdevice for different tape drives and disk. The dump(1M) reference page is included in Appendix B.

    Table 2-3. dump Arguments for Filesystem Backup

    Backup Device

    tapesize

    dumpdevice

    Disk

    2m

    use /root/backupfs/root.dump for the root filesystem and /root/backupfs/usr.dump for the usr filesystem

    DAT tape

    2m

    /dev/rmt/tps<tapecntlr>d<tapeunit>nsv

    DLT tape

    10m

    /dev/rmt/tps<tapecntlr>d<tapeunit>nsv

    EXABYTE 8mm model 8200 tape

    2m

    /dev/rmt/tps<tapecntlr>d<tapeunit>nsv

    EXABYTE 8mm model 8500 tape

    4m

    /dev/rmt/tps<tapecntlr>d<tapeunit>nsv

    QIC cartridge tape

    150k

    /dev/rmt/tps<tapecntlr>d<tapeunit>ns


  12. If usr is a separate filesystem, insert a new tape (if you are using tape) and create a full backup of the usr filesystem by giving this command:

    # dump tapesize dumpdevice usrpartition 
    

    Use the same values of tapesize and dumpdevice as in step 11.

  13. If you do not need to repartition the system disk, skip to step 18.

  14. To repartition the system disk, use the standalone version of fx(1M). This version of fx is invoked from the Command Monitor, so you must bring up the Command Monitor. To do this, quit out of inst, reboot the system, shut down the system, then request the Command Monitor. An example of this procedure is:

    # exit
    ...
    Inst> quit
    ...
    Ready to restart the system.  Restart? { (y)es, (n)o, (sh)ell, (h)elp }: yes
    ...
    login: root
    # halt
    ...
    System Maintenance Menu
    ...
    Option? 5
    Command Monitor.  Type "exit" to return to the menu.
    >>
    

    On systems with a graphical System Maintenance menu, choose the last option, Enter Command Monitor, instead of choosing option 5.

  15. Boot fx(1M) and repartition the system disk so that it meets your needs. The example below shows how to use fx to switch from separate root and usr partitions to a single root partition.

    >> boot stand/fx
    84032+11488+3024+331696+26176d+4088+6240 entry: 0x89f97610
    114208+29264+19536+2817088+60880d+7192+11056 entry: 0x89cd31c0
    Currently in safe read-only mode.
    Do you require extended mode with all options available? (no) <Enter>
    SGI Version 5.3 ARCS   Dec 14, 1994
    fx: "device-name" = (dksc) <Enter> 
    fx: ctlr# = (0) <Enter>
    fx: drive# = (1) <Enter>
    ...opening dksc(0,1,0)
    ...controller test...OK
    Scsi drive type == SGI     SEAGATE ST31200N8640
    
    ----- please choose one (? for help, .. to quit this menu)-----
    [exi]t             [d]ebug/           [l]abel/           [a]uto
    [b]adblock/        [exe]rcise/        [r]epartition/     [f]ormat
    fx> repartition/rootdrive
    
    fx/repartition/rootdrive: type of data partition = (xfs) <Enter>
    Warning: you will need to re-install all software and restore user data
    from backups after changing the partition layout.  Changing partitions
    will cause all data on the drive to be lost.  Be sure you have the drive
    backed up if it contains any user data.  Continue? yes
    
    ----- please choose one (? for help, .. to quit this menu)-----
    [exi]t             [d]ebug/           [l]abel/           [a]uto
    [b]adblock/        [exe]rcise/        [r]epartition/     [f]ormat
    fx> exit
    

  16. Load the miniroot again, using the same procedure you used in step 9.

  17. Switch to the shell prompt in inst:

    Inst> sh
    

  18. Unmount all filesystems except the miniroot:

    # umount -b /,/proc
    

  19. Make an XFS filesystem for root:

    # mkfs -d name=rootpartition -b size=blocksize -l internal,size=logsize 
    

    blocksize is the filesystem block size (see the section “Choosing Block Sizes” in this chapter) and logsize is the size of the area dedicated to log records (see the section “Choosing the Log Type and Size” in this chapter).

    Example 2-4 shows an example of this command for a root filesystem and the command output. The filesystem is made on /dev/dsk/dks0d1s0 with a block size of 512 bytes and a log size of 500 KB (1000 blocks * 512 bytes/block).

    Example 2-4. Example mkfs Command and Output for the Root Filesystem


    # mkfs -d name=/dev/dsk/dks0d1s0 -b size=512 -l internal,size=1000b
    meta-data=/dev/dsk/dks0d1s0      isize=256    agcount=1, agsize=51054 blks
    data     =                       bsize=512    blocks=51054
    log      =internal log           bsize=512    blocks=1000
    realtime =none                   bsize=65536  blocks=0, rtextents=0
    

  20. If you have a separate usr filesystem, give this command to make it an XFS filesystem:

    # mkfs -d name=usrpartition -b size=usrblocksize -l internal,size=usrlogsize 
    

    usrblocksize and usrlogsize are the block size and log size you've chosen for the usr filesystem.

  21. Mount the root filesystem with this command:

    # mount rootpartition /root 
    

  22. If you have a separate usr filesystem, create the /usr mount point directory and mount the filesystem with these commands:

    # mkdir /root/usr 
    # mount usrpartition /root/usr 
    

  23. If you made the backup on disk, create a mount point for the filesystem that contains the backup and mount it:

    # mkdir /backupfs
    # mount backupdevice /backupfs
    

  24. If you made the backup on tape, restore all files on the root filesystem from the backup you made in step 11 by putting the correct tape in the tape drive and giving these commands:

    # cd /root 
    # mt -t /dev/rmt/tps<tapecntlr>d<tapeunit> rewind 
    # restore rf dumpdevice 
    

    You may need to be patient while the restore is taking place; it normally doesn't generate any output and it can take a while. The restore(1M) reference page is included in Appendix B.

  25. If you made the backup on disk, restore all files on the root filesystem from the backup you made in step 11 by giving these commands:

    # cd /root 
    # restore rf /backupfs/root.dump 
    

  26. If you made a backup of the usr filesystem in step 12 on tape, restore all files in the backup by putting the correct tape in the tape drive and giving these commands:

    # cd /root/usr
    # mt -t /dev/rmt/tps<tapecntlr>d<tapeunit> rewind 
    # restore rf dumpdevice 
    

  27. If you made a backup of the usr filesystem in step 12 on disk, restore all files in the backup by giving these commands:

    # cd /root/usr
    # restore rf /backupfs/usr.dump 
    

  28. Move the new version of /etc/fstab that you created in step 7 into place:

    # mv /root/etc/fstab.xfs /root/etc/fstab
    

  29. Exit from the shell and inst and restart the system:

    # exit
    # 
    Calculating sizes .. 100% Done.
    
    Inst> quit
    ...
    Ready to restart the system.  Restart? { (y)es, (n)o, (sh)ell, (h)elp }: yes
    Preparing to restart system ...
    
    The system is being restarted.
    

Converting a Filesystem on an Option Disk from EFS to XFS

This section explains how to convert an EFS filesystem on an option disk (a disk other than the system disk) to XFS. It assumes that neither lv nor XLV logical volumes are used. You must be superuser to perform this procedure.

  1. Review the subsections within the section “Planning for XFS Filesystems” in this chapter to verify that you are ready to begin this procedure.

  2. Verify that your backups are up to date. Because this procedure temporarily removes all files from the filesystem you convert, it is important that you have a complete set of backups that have been prepared using your normal backup procedures. You will make a complete dump of the system disk in step 4, but you should have your usual backups in addition to the backup made during this procedure.

  3. Identify the device name of the partition, partition, where you plan to create the filesystem. For example, if you plan to use partition 7 (the entire disk) of a SCSI option disk on controller 0, unit 2, partition is /dev/dsk/dks0d2s7. For more information on determining partition (also known as a special file), see dks(7M) for SCSI disks and ipi(7M) for Xylogics IPI disks.

  4. Back up all files on the disk partition to tape or disk because they will be destroyed by the conversion process. You can use any backup utility (Backup, bru, cpio, tar, and so on) and backup to a local or remote tape drive or a local or remote disk. For example, the command for dump for local tape is:

    # dump 0uCf tapesize dumpdevice partition 
    

    tapesize is the tape capacity (it's used for backup to disks, too) and dumpdevice is the device name for the tape drive. Table 2-3 gives the values of tapesize and dumpdevice for different local tape drives and disk. You can get the values of <tapecntlr> and <tapeunit> used in the table from the command hinv –c tape. The dump(1M) reference page is included in Appendix B.

  5. Unmount the partition:

    umount partition
    

  6. Use the mkfs(1M) command to create the new XFS filesystem:

    mkfs -d name=partition -b size=blocksize -l internal,size=logsize
    

    blocksize is the filesystem block size (see the section “Choosing Block Sizes” in this chapter) and logsize is the size of the area dedicated to log records (see the section “Choosing the Log Type and Size” in this chapter). Example 2-1 shows an example of this command line and its output.

  7. Mount the new filesystem with this command:

    mount partition mountdir 
    

  8. In the file /etc/fstab, in the entry for partition, replace efs with xfs. For example:

    partition mountdir xfs rw,raw=rawpartition 0 0
    

    where rawpartition is the raw version of partition.

  9. Restore the files to the filesystem from the backup you made in step 4. For example, if you gave the dump command in step 4, the commands to restore the files from tape are:

    # cd mountdir 
    # mt -t device rewind 
    # restore rf dumpdevice 
    

    The value of device is the same as dumpdevice without nsv or other letters at the end. The restore(1M) reference page is included in Appendix B.

    You may need to be patient while the restore is taking place; it doesn't generate any output and it can take a while.

Checking Filesystem Consistency

The filesystem consistency checking program for XFS filesystems is xfs_check(1M). (fsck(1M) is used only for EFS filesystems.) Unlike fsck, xfs_check is not invoked automatically on system startup; xfs_check should be used only if you suspect a filesystem consistency problem. Before running xfs_check, the filesystem to be checked should be unmounted.

The command line used for xfs_check depends upon the underlying device:

  • If the filesystem is on an XLV logical volume, the xfs_check command line is:

    xfs_check xlvvolume 
    

    xlvvolume is the device file for the logical volume, for example /dev/dsk/xlv/xlv0.

  • If the filesystem is on a disk partition, the xfs_check command line is:

    xfs_check -d partition 
    

    partition is the device name for the partition, for example /dev/dsk/dks0d2s7.

  • If the filesystem is on an lv logical volume, the xfs_check command line is:

    xfs_check -d lvvolume 
    

    lvvolume is the device file for the logical volume, for example /dev/dsk/lv0.

Unlike fsck, xfs_check does not repair any reported filesystem consistency problems; it only reports them. If xfs_check reports a filesystem consistency problem:

  • If possible, contact the Silicon Graphics Technical Assistance Center for assistance (see the Release Notes for this product for more information).

  • To attempt to recover from the problem, follow this procedure:

    1. Mount the filesystem, but be very careful not to write to it.

    2. Make a filesystem backup with xfsdump.

    3. Use mkfs to a make new filesystem on the same disk partition or XLV logical volume.

    4. Restore the files from the backup.