fx(1M) fx(1M) NAME fx - disk utility SYNOPSIS fx [-x] [-d device-name] [-l logfile] [-r maxretries] [-C] [-s scriptfile] [controller_type[(ctlr,unit[,lun])]] fx -c -x [-d device-name] [-l logfile] [-r maxretries] controller_type(ctlr,unit[,lun]) [VERIFY] [INITIALIZE] [FORMAT] DESCRIPTION fx is an interactive, menu-driven disk utility. It detects and maps out bad blocks on a disk. It also displays information stored on the label of the disk, including partition sizes, disk drive parameters, and the volume directory. An expert mode, available by invoking with the -x flag, provides additional functions normally used during factory set-up or servicing of disks, such as formatting the disk and creating or modifying the disk label or drive parameters. Warning: Unless you are very familiar with the parameters and partitions of your disks, you are strongly advised not to invoke the expert mode of fx. A mistake in expert mode can destroy all the data on the disk. When this option is used, fx also warns of discrepancies between the disk label and the parameters that are normally used for the drive and asks if you want to fix them. You should usually NOT change these unless you have all the data on the drive backed up and are prepared to restore it, because the changes frequently result in a different partition layout. The -d device-name option allows you to specify the character device name corresponding to the disk you wish to administer. The device name must correspond to the volume partition. For example: -d /dev/rdsk/2000002037005169/lun0vol/c12p1 Using the -d option is the only way to administer Fibre Channel fabric devices (devices which use the Nodename/LunPart/CtlrPort name scheme). The -r retries option allows you to specify how many retries fx attempts when exercising the disk. If you have persistent soft errors, -r 0 usually allows fx to find the bad sectors and spare them. For SCSI disks, see also the discussion of parameters in the section LABEL MENU. The -l logfile option (in the IRIX command version only) causes fx to log disk errors, blocks that are forwarded, and other severe errors in the named file. The -s scriptfile option (in the IRIX command version only) allows fx scripting. See the section SCRIPTS below. The -c option (in the IRIX command version only) is designed for the use of programs and scripts; the -x option must also be given. When used, the VERIFY, INITIALIZE, or FORMAT (or any combination) options must be given at the end of the command line, and the full drive specification must be given on the command line. In this mode, no keyboard input (except keyboard interrupts) is accepted, and any error causes the program to exit with a non-zero value, following an error message. A warning message is printed at startup that destructive operations will follow, with no subsequent confirmation required. Additionally, it is considered a fatal error if the drive contains any mounted filesystems, or is part of a mounted logical volume filesystem. The VERIFY option is the equivalent of /exercise/complete -a, and overwrites any existing data on the drive. The INITIALIZE option creates only the volume header and partition table; this is the minimum that needs to be done for a disk drive to be usable. The FORMAT option is the equivalent of format with the current parameters (all data on the drive is destroyed). All the above options create a new partition table (suitable for an option disk) and volume header, if necessary. This particular choice should almost never be used for hard or fixed disks. It may be necessary for certain types of removable media, most commonly floppy media. Almost all removable media for M-O (Magneto-Optical) and similar drives is pre-formatted, and should not be formatted again. Sometimes formatting the media can render it unusable, if errors occur. The -C option is used to disable the check for mounted partitions or volumes. By default fx checks to see if any in-use partitions are contained on the target disk. If a partition is in-use, the user will be warned that modification of the disk layout may lead to corruption of the existing on disk data. For systems with a large number of disks, this additional checking may add noticeable overhead to the command's execution time. For situations where command performance is necessary, this switch may be used to disable the safeguards. Due to the potential for user-error causing corrupted filesystems or other on-disk data corruption, we strongly discourage use of this switch in normal operation. USING FX There are two versions of fx. One runs in the standalone environment and must be used when the system disk is modified; it can be used for most other purposes as well, but may be less convenient. Fabric and fd (floppy) devices are not supported in the standalone version; the -d, -l, -c, and -C options are also not supported in standalone. The other version runs as an IRIX command and is normally used by the superuser. While some features can be used by an ordinary user if the disk device permissions permit, other features (typically formatting and bad block management) have permission checks within the various drivers that can only be used by the super user. A notable exception is that as shipped, all floppy-related fx features can be used by any user. When used on a mounted disk, or a disk whose partitions are part of mounted logical volume, this version warns you not to do anything destructive, but does not otherwise prohibit it. A copy of the standalone version is normally kept in /stand/fx and can be invoked when the system is not running by giving the following command at the PROM Command Monitor: boot stand/fx A standalone fx is provided in the /stand directory of CD-ROM discs containing software distributions with install tools, and can be invoked by the Command Monitor command: For systems with the 32 bit ARCS PROM (Indigo, Indigo2, Indy, Onyx, Challenge and O2), use this command: boot -f dksc(ctlr,unit,8)sashARCS dksc(ctlr,unit,7)stand/fx.ARCS For systems with 64-bit ARCS PROM (for example, Power Challenge, Power Onyx, Power Indigo2, Indigo2 10000, Origin, Onyx2, and OCTANE ) use this command: boot -f dksc(ctlr,unit,8)sash64 dksc(ctlr,unit,7)stand/fx.64 where ctlr is the controller number (usually 0), unit is the SCSI id of the CD-ROM drive. When the standalone version is booted without the -x option, it prompts to see if you wish to use the expert mode, because it is often forgotten on the command line. The command version of fx is invoked by name like any IRIX command. Unless the -d option is used, fx will prompt for disk type, controller, target, and lun numbers. Recognized controller types are dksc for SCSI disk drives, and fd for floppy drives. Note that fd is not available in the standalone version. fx next prompts for controller number, drive number (SCSI target ID), and lun (logical unit) number. The controller type, controller number, drive number, and optional lun number can be given as command line parameters, bypassing the interactive questions just described (see also the -d option). The format is: fx "controllertype(controller_number, drive_number[, lun_number])" For example: fx "dksc(0,1)" This is equivalent to: fx "dksc(0,1,0)" because the lun number defaults to 0 if it is not specified. The quotes are necessary in the first argument in the command version, because parentheses are shell special characters, and in the second because the drive name contains a space. For floppy disk drives, you are also prompted for the density to use. Once controller type, controller number, drive number, and lun number have been selected, fx issues a diagnostic command to the drive. For SCSI drives, the drive information from the inquiry command is displayed, including the firmware revision; for other drive types, the previously assigned type from the volume header is displayed. A controller or drive self test is performed, followed by sanity checks on the partition layout. If any 'major' differences are found, you are asked if you want to use the existing values. It is almost always correct to keep the existing values, unless you are going to initialize the disk anyway. If it appears that no valid volume header is present, fx asks if you want to use the defaults; you can answer no if you plan to set up custom parameters or partitions. fx then enters its main menu. Menu items can be selected by typing the least unambiguous prefix (the portion included between [ and ]) or the full name. A menu item can be an action (for example, exit) or the name of a submenu (for example, badblock). Submenus have a trailing / to indicate that they are submenus. Selecting a submenu name causes that submenu to be displayed, and items from it can be selected. To return to a parent menu from a submenu, enter two dots (..). The menus are organized as a hierarchy, so you can go up two levels by typing ../.., or use a command several levels down by separating each level by a /. By typing a command pathname, such as /label/show/partition a command can be executed from any point in the menu hierarchy. Similarly, typing the full pathname of any menu moves you to that menu (this includes typing / for the top level). To obtain help for the items on the current menu, enter a question mark (?) at the prompt. Many of the functions listed below have options to modify their actions; to obtain more information about them than the summary, enter ? item where item can be either the least unambiguous prefix, or the full name. Most of the (non-default) options are not listed in this document. To exit from fx, select exit at the main menu; a shorthand for exiting from any level is /exit. Entering /.. from any menu allows you to select a different disk using normal controller/target/lun prompts, without having to exit and restart. Note however, that since Fibre Channel fabric devices can not be specified this way, accessing a fabric device requires a restart. Normal prompts (to save parameters, label, etc.) occur if modified parameters are not yet committed to disk. Once the main menu is reached, fx catches interrupts: an interrupt stops any operation in progress but does not terminate fx itself. The current operation executing in the disk driver (if any) completes first; this is most notable when formatting a SCSI disk, because that is a single operation lasting many minutes. SCRIPTS This section describes script files as used with the -s option. Also see the section CHANGING DISK PARTITIONS for more detailed information about partitioning. Currently only partitioning is supported; other functions may be added in the future. The scriptfile is a text file. Blank lines, and lines starting with the # character are ignored. The file is made up of lines with 3 or more fields separated by spaces or tabs. Fields after the 3rd are ignored. The fields are: devicename startingblock:size type They were deliberately chosen to be a subset of the inst(1m) miniroot script file, and the lines from that script with the keyword partition are passed to fx after the first and last fields are stripped off. devicename is of the standard form described in the dksc(7) manual page: dksCTLRdIDlLUNsPART, where the lLUN field is optional and not normally present, and the sPART partition portion may also be vh for the volume header. The disk and partition to be modified is determined by the devicename field. The type field is one of xfs, efs, swap, raw, preserve or the pseudotypes protect, root or option. The first 5 set the partition type (swap and raw sets the volume header type raw and preserve preserve the type of partition to be modified). The second set affect the whole disk, not just the named partition. root creates a standard system disk (swap and root), while option creates an option disk (partition 7 as the whole disk). The type protect declares that this partition (or some part of it) may not be changed, and attempts to have other partitions overlap it will be treated as errors and ignored. At this time, only one protect line per script is allowed to be active at a time; the last one seen is the active one. In the latter form the starting block is 0, and the size is the number of blocks of this partition to be protected). The type field may be followed by a / and a number. This is intended to be the blocksize for the filesystem, and is ignored by fx if present, other than to terminate the type name. The size field may be in one of two forms. The first is one of these keywords: existing, standard, or all. existing is currently treated like a comment, the line is ignored. standard must be used with the type field set to either root or option. all is similar to the standard with option choice, but can apply to any partition. When this form is used, all other partitions are removed, for other script commands, existing partitions that are not explicitly changed are left as is. The second form specifies the starting block for the partition, and the number of blocks in the partition, with the two parts separated by a colon (:). Both parts may be numeric (base 10), or symbolic; the two forms may also be mixed. If the number of blocks is specified as 0, the partition will be deleted, not present on the disk. The units for the numeric values are always in terms of 512 byte blocks, regardless of the actual media blocksize. The symbolic form of the starting block indicates the partition number that this partition follows, and is of the form followspart#, where # is in the range of 0-15 (the volume header partition must be given numerically as 8, not in symbolic form). The symbolic form for the number of blocks is the keyword remainder indicating that this partition extends from the starting block to the end of the disk. Here are some examples to clarify the usage; all are shown on controller zero for simplicity: # set disk 1 to be a standard system disk dks0d1s0 standard root # protect all of partition 1 on disk 1 dks0d1s1 existing protect # protect the first 100000 blocks of partition 1 on disk 1 # useful when resizing swap, but miniroot is active dks0d1s1 0:100000 protect # set disk 2 to be a standard option disk dks0d2s0 standard option # set partition 13 to start at block 5000, and use the rest of the # disk type is set to raw dks0d2s13 5000:remainder swap # partition 6 follows partition 0 with 10000 blocks, with type efs, # partition 7 follows partition 6 with 20000 blocks, with type xfs. dks0d2s6 followspart0:10000 efs dks0d2s7 followspart6:20000 xfs/4096 # delete partition 6 from disk 2; the type field is ignored. dks0d2s6 0:0 xfs/4096 # setup disk 2 similar to a normal system disk, but with the # swap partition set to only 50MB. dks0d2s1 followspart8:102400 swap dks0d2s0 followspart1:remainder xfs # set partition 1 on disk 2 to be the entire disk except for the # volume header, with type efs. dks0d2s1 all efs FX PROMPTS A general note about prompts: when a prompt with the word no or the word yes appears at the end, simply pressing <Enter> accepts that value. For other prompts that ask a question, you must answer either yes or no. For prompts requesting numeric values, you can usually reply with a decimal number, or a hex number (a leading 0x). If a number is displayed at the end of the prompt, pressing <Enter> accepts that value. It is usually the current value, although it is sometimes a reasonable default. In many cases, if you are unsure of what your choices are, typing a ? gives you a short description of your choices. TOP LEVEL MENU The top level fx menu contains the following choices: exit Exits from fx. If changes have been made to the copy fx keeps of the disk label and this has not been written to the disk, a prompt gives the option to write it to disk. badblock Selects the menu of operations dealing with bad block handling. debug Selects the menu of debug functions. exercise Selects the menu of functions for analyzing the disk surface to find bad blocks. label Selects the menu of functions for reading (and, in expert mode, modifying) the disk label. repartition Allows simple repartitioning of disks. A disk can be easily partitioned into a root (system) or option (all of usable disk in one partition) disk. The size of a single partition can be easily modified, with the adjacent partitions (if any) resized to match. The following items appears only in expert mode. auto Initializes a new disk. An SGI disk label is created and written to it, and it is exercised to detect and map out bad blocks, and then a standard partition table is created. BADBLOCK MENU The list of bad blocks is maintained by the firmware on the disk drive itself; it can be interrogated and altered but does not appear in the user-readable part of the disk. The badblock menu contains the following choices: addbb Allows new bad blocks to be added to the badblock list. Blocks are entered as their logical block number, relative to the start of the disk. To terminate adding bad blocks, enter two dots (..); this returns to the badblock menu. You are asked if you want to try and preserve the data. If the disk contains valuable data, answer yes (it's worth trying). As each block is entered, it is immediately sent to the disk drive. There is no way to undo the operation, short of a full low level drive format, which is discouraged. An attempt is first made to read the data from that block, so it can be rewritten after it is added. This will usually produce error messages from the disk drive, if the block is completely unreadable. Also see the exercise command description below. It is often a good idea to run a readonly exercise pass across the whole drive, or the section where you suspect bad blocks, rather than adding them manually. Some drive firmware will mis-report the block that is unreadable, instead reporting the first block in a read command. To avoid incorrectly adding a bad block, the exercise command will find the block by reading one block at a time after getting a read error on a large read, and then add only the blocks that are not readable. It is sometimes not possible to add additional bad blocks. This can occur after the drive is damaged, or rarely when there are no more spare locations available on the drive (or in some cases for that section of the drive). showbb Displays the current badblock list. It is obtained by interrogating the SCSI drive. Usually the logical location of the bad sectors is displayed (relative to block zero on the drive). The display may be in another style (usually cylinder/head/sector) if the drive firmware does not support logical format. Only the grown (added after the drive left the manufacturer's plant) defects are shown by default. Use the -f option to show the full defect list, or the -m option to show just the manufacturer's (original) list. The -g option requests the default grown defect list only. The -l option requests the logical block number style (for compatibility only, since it is now the default). The -b option requests the bytes from index (physical, not logical) style, and the -c option requests the old default style of cylinder/head/sector. If there are more than 8192 entries in the list, only the first 8192 are reported. If new bad blocks develop during the life of the system, it is necessary to add these new bad blocks to the badblock list; this is best done by doing an exercise pass (rd-cmp, or if the disk has no data that you care about, wr-cmp). Typically, the disk driver prints error messages on the console when it encounters a bad block. These messages are also normally logged to the system log file /var/adm/SYSLOG. The error messages give the location of the bad block, either as a single block number or as a pair. When given as a pair, the larger number is the one used when adding bad blocks; the smaller is relative to the partition for which it is reported. The disk is identified by its special filename; see the dks(7M) man page. The SCSI disk driver prints bad block numbers relative to the start of the partition it is accessing, as well as the absolute block number. It is the absolute block number that must be used when adding a bad block. Note: fx attempts to save data when mapping out bad blocks by re-reading the old data a number of times. In all cases, it is strongly recommended to make a backup of the disk before proceeding with any bad block operations. Bad block mapping is NOT supported for floppy disk drives. To manually map out a bad block, follow the procedures below. Unless you are completely sure that a particular block or track is bad, it is often a good idea to use the exercise function to locate and automatically map out the bad blocks. In some cases, a bad block may be reported that was the first block of a read or write request and not the block that is actually bad. For this reason, the exercising routines attempts to read each block in a failed I/O individually to find the bad blocks. Persistent soft errors may not be found by the exerciser and may require using the manual procedure. For SCSI drives, you may wish to reduce the number of retries performed by the drive itself to 0, if the drive supports it, so that fx is more likely to find and forward the bad block. See the section on parameters. The default exerciser function is to do a read-only scan of the entire disk surface. The exercising method only adds blocks that are unrecoverable, so the data on the block is lost. Also see the addbb command above. add any block, whether it is bad or not. A read-only exercise pass may not work if the block fails on writes only, and the disk contains important data, so that a write-read-compare pass isn't practical. In this case, you may need to manually add the bad blocks. However, if the disk is backed up and can be restored after the exercise is complete, a write-compare exercise pass finds and automatically maps bad blocks. The procedure for forwarding bad blocks is divided into two parts: for SCSI disks ( dksc ) and for other types. SCSI disks are much simpler, because the badblock map is maintained by the drive itself, rather than by the driver. To enter new bad blocks, select the addbb item. Then enter the location of the bad block as a logical block number relative to the start of the disk. More than one bad block can be entered. When you have finished entering, terminate the entries by entering two dots (..). The updated badblock list must be saved to disk and the new bad blocks mapped out. Select the forward option on the badblock menu to do this. For SCSI disks, bad blocks are mapped out as soon as they are entered by the addbb function. Nothing more needs to be done. All SCSI bad blocks are entered by logical block number relative to the start of the disk, using the addbb function. (Driver messages about bad blocks typically give two numbers, where the smaller one is relative to the start of a partition, and the larger is relative to the start of the disk.) Enter as many bad blocks as you want, one per line, ending the list by typing .. on a line by itself. The showbb function displays the complete list of bad blocks. The -m option can be used to show only the manufacturer's bad block list in one of several formats, which vary from drive to drive. The default and the most common format is to display by logical block. All disk error messages are logged to the system log /var/adm/SYSLOG by default. You should examine the log periodically. If the same blocks show up repeatedly, you should add them to the badblock list with the exercise method. If necessary, use the badblock menu. It is best to replace a block that is going bad before it becomes unreadable. FX LABEL FUNCTIONS fx can display the information in the various parts of the disk label. To do this, select the label option at the main menu. Then select the readin function, and select the parts of the label you wish to display. This reads in the information from the disk. This choice is not present for SCSI disks, because all of the drive related label information is read from the embedded drive controller. Return to the label menu and select show. The various parts of the label can be selected for display. When expert mode is used, the label values can be changed. Some of the values that can be changed are also sent directly to the drive or controller. Changing some parameters may require reformatting the drive before it can be used. LABEL MENU This menu gives access to functions for displaying and, in expert mode, modifying information contained in the disk label. It contains the following items: readin Allows part or all of the label to be read in from the disk. Selecting this item brings up a menu of the accessible parts of the label. (These are described in detail below.) Selecting a part causes that part to be read in from disk; there is also an all option, to read in all parts at once. Note that this is normally done automatically before the first menu is displayed. show Allows display of parts of the label. As with readin, it brings up a menu of the label parts, allowing selection of the part to be displayed. The remaining items appear only in expert mode, because they offer the possibility of changing data on the disk. sync Writes the in-core copy of the disk label back to disk, as well as changing the parameters in the disk driver. set Allows parts of the label to be modified. As for readin, it brings up a menu of the label parts, allowing selection of the part to be modified. The current values are given as the default in the prompts, so simply pressing <Enter> for every prompt leaves the values unchanged. For SCSI drives, the drive parameters are divided into geometry and parameters menus. Changes to the geometry values require that the drive be reformatted, while other changes do not require reformatting of the drive. create Discards existing label information, and creates new label information. For SCSI drives, the information used to create the label is obtained from the drive by modesense commands. For other drive types, the information comes from tables compiled into fx, unless the other choice was selected for the drive type, in which case the user-entered data is used. This is normally used only for attempting to repair a damaged disk label (or to recover from major errors during set). As with readin, it brings up a menu of the label parts, allowing selection of the part to be worked on. PARTS OF THE DISK LABEL A disk label contains the following parts: parameters This is information used by the disk controller, such as disk geometry (for example, number of cylinders), and parameter information. The parameters actually used depend on the type of controller. The geometry information is on the geometry menu, and changes to values on the parameters menu do not require a reformat of the drive; changes to those on the geometry menu do. These values do not need to be changed in normal use. A full discussion of the disk controller and disk drive is beyond the scope of this document. The reader should refer to the manufacturer's documentation. Some parameters affect only the label, others are passed on to the controller or drive. For SCSI drives, the parameters are sent to the disk with the save-parameters bit set, so that they remain in force even if the system is restarted. When exercising SCSI drives, and attempting to find blocks with soft errors, it may be advisable to set the number of retries performed by the drive to 0, so that intermittent errors can be found. You may also want to disable ECC error correction on the drive. Not all drives allow you to change the number of retries. If you do change it during the exercise pass, you probably want to restore the old value before exiting. geometry This menu exists only for SCSI disks. A change to any of the parameters on this menu requires reformatting the drive before it can be used. Not all drives support changing all geometry items. Some changes also affect drive capacity. For some drives this capacity change is reflected immediately in values read from the drive, while for others the new values are not returned until after the drive is formatted. partitions The disk surface is divided for convenience into a number of different sections called partitions, which are used for various purposes. (See intro(7) for more details). When the operating system is accessing the disk, its drivers make the connection between the special filename and the physical disk partition, using information from the partition table in the disk label. Even if not started in expert mode, the drive partitions can be displayed and changed by using the repartition menu; see the section CHANGING DISK PARTITIONS. There can be up to 16 partitions on a disk, numbered 0 to 15 (though not all need be present). Partitions of 0 length (0 or -1 for backwards compatibility) are not normally displayed, because they are logically not present. Each partition is described by its starting block on the disk, its size in blocks, and a type indicating its expected use (for example, filesystem, disk label, swap, and so forth). In older releases, the MAKEDEV(1M) program created only the entries in /dev for the SGI standard partitions (0, 1, 6, 7, vh (8), and vol (10)). In current releases, these devices are part of the hardware graph hwgfs(4), and are created dynamically as the disk partitions are changed, so MAKEDEV no longer needs to be run, nor modified to create additional partition devices. sgiinfo This contains information kept for administrative purposes: the type of disk drive and its serial number. For labels created under IRIX 4.0, it also includes the version of fx that was used to create the label (and presumably to do the drive setup). bootinfo This contains information used by the system PROMs during a normal system boot. It specifies the root partition, the name of the file on the root partition to boot, and the swap partition. Normal defaults for these are: unix for the bootfile, 0 for the root partition, and 1 for the swap partition. directory Some system files are normally kept in the label area (volume header) on the disk. These are files used in standalone operations such as the standalone shell sash and sometimes the diagnostic program ide, depending on system type. The directory is a table in the label that enables these files to be located. The show submenu of the label menu allows the directory of these files to be displayed. The files in the disk label are manipulated by the use of dvhtool(1M). fx does not provide facilities for adding or deleting files. It writes the sgilabel file when it has changed and the user requests it. The create/directory menu may be used to clear the directory (delete all files). CHANGING DISK PARTITIONS The top level menu repartition is provided in both the modes. In the expert mode, one additional function is provided. The expert function is simply an alternate method of reaching the /label/set/partition function, provided for ease of use. You need to use this function if you want to create or modify other partitions that are not normally used. Use the -b flag to set the partition size in blocks, and the -m flag to set the partition size in megabytes. The partition sizes are set in megabytes by default. When this menu is entered, the current partition layout is displayed, as well as the total drive capacity. For all of the non-expert choices, you are asked if you really want to change the partition layout after choosing the function. You are warned that any existing data on the drive could be lost if the partitions are changed. Remember that you must normally use the mkfs(1M) command to create filesystems on partitions before you can install software or restore files onto them. The rootdrive function creates a drive with the standard partitioning for a system (or root) drive. This function should be used if you are setting up a new drive or changing an option drive into a root drive. The optiondrive function creates a drive with all of the usable area in a single partition (partition 7). Some space is still allocated to the volume label. The resize function allows you to resize any of the standard partitions (root, swap, usr, xfslog, and entire). After you select this function, a message is shown, reminding you that after you finish resizing a partition, the other partitions are resized to match (if necessary). You are shown the changes and given a chance to reject them, before they are committed to the disk, unless no changes were made. The default partition presented depends on whether the drive appears to be a system (root) drive, or an option drive. For option drives, the default is entire. For system drives, the default is the swap partition. After choosing the partition, you are shown the current values for the partition and asked to choose the method of partitioning the drive. The choices are to resize by megabytes, blocks, or as a percentage of the entire disk. The default is megabytes. Next you are shown the maximum allowable size and asked to enter the new size. If you made a change, the new partition layout of the drive is shown. You are asked to confirm that you want to use it (with a default of no). If you accept it, the new partition layout is immediately written to the drive and driver. EXERCISE MENU This gives access to functions intended for surface analysis of the disk to find bad blocks. Only read-only tests are possible in normal (non- expert) mode. Destructive read-write tests are allowed in expert mode. For all choices except random, I/O is done 512 blocks at a time, unless an error is found. If an error is found, the I/O is repeated one sector at a time to find the actual block that is bad, since not all drives report the actual block in error on a large read. For each unrecoverable error that is found, the failing block is added to the badblock list. The number of retries performed by fx itself defaults to 3. It may be set to any number, including 0, using the -r option. Most drivers, and some drives, do retries before reporting an error. For most SCSI drives, the number of retries performed can be set by using the /label/set/parameters menu. By using the stoponerror menu selection, you can have fx stop and ask you if you want to map the bad block. Whether you answer yes or no, you are asked if you want to continue exercising. This can be useful when trying to determine how many errors a disk has before you commit yourself to mapping the bad blocks. butterfly Invokes a test pattern in which successive transfers cause seeks to widely separated areas of the disk. This stresses the head positioning system of the drive and sometimes finds errors that do not show up in a sequential test. It prompts for the range of disk blocks to exercise, number of scans to do, and a test modifier. Each of the available test patterns can be executed in a number of different modes (read-only, read-write, and so on) that are described below. errlog Prints the total number of read and write errors that have been detected during a preceding exercise, showing both soft and hard errors. If the -l option is used, the blocks on which errors occurred are also reported. Soft errors are those errors for which a driver reported an error, but fx was able to successfully complete the I/O on a retry. Blocks with soft errors are not forwarded. random Invokes a test pattern in which the disk location of successive transfers is selected randomly. It is intended to simulate a multiuser load. Like the butterfly test, it prompts for range of blocks to exercise, number of scans, and modifier. This does random sized I/Os (from one block to the current maximum) as well as seeking to random locations on the disk. It is useful for finding problems on drives with seek problems and with errors in the caching logic or hardware. sequential Invokes a test pattern in which the disk surface is scanned sequentially. As with the butterfly test, it prompts for: range of blocks to exercise, number of scans, and modifier. stop_on_error Toggles whether fx proceeds automatically when errors are detected. The default is automatic. If stop is set, you are asked on each error whether you want to continue or not. If you continue, you are asked if you want to add the failing block to the badblock list. This can be useful if you want to find all the failing bad blocks but not actually add them to the badblock list. The following items appear only in expert mode, because they are concerned with destructive (write) tests. settestpat Allows you to specify the pattern of data that to be used in tests that write to the disk to be created. Up to 4K bytes of pattern can be set, byte by byte. Each byte can be entered as a decimal or hex value (with a leading 0x). Enter .. when you are done entering the pattern. The pattern is repeated as many times as necessary to fill the buffer. The default is a random pattern 1023 bytes long ensuring that few, if any sectors have the same data. When used with the write-compare test, this helps find drives that have hardware or firmware problems causing them to write data to the wrong location on the drive. showtestpat Displays the pattern of data that is used in tests that write to the disk. This can be changed with settestpat. complete Causes a write-and-compare sequential test to be run on the entire disk area; all data on the drive is lost. The -a options eliminates the warning prompt for confirmation before starting the test. The butterfly, random, and sequential tests prompt for a modifier that determines the type of transfer that occurs during the test patterns. Possible modifiers are: rd-only Performs reads only. The value of read data is ignored. The test detects only the success or failure of the read operation. rd-cmp Causes two reads at each location in the test pattern. The data obtained in the two reads is compared. If there is a difference, the blocks that differ are considered bad. seek Causes each block in the test pattern to be read (no writes) separately. It is used to verify individual sector addressability. (This is a rather time-consuming operation!) The following modifiers are presented and legal only in expert mode, because they cause writing to the disk, thereby destroying existing data. Be absolutely sure you have backed up any data you care about before using them. You are given one last chance to abort after you have specified all the parameters to use. wr-only Performs writes only. Written data is not re-examined. The test detects only the success or failure of the write operation. Certain kinds of media errors cause write errors, but not read errors. wr-cmp Performs a write, read, compare operation. If any of the three operations fail, the block is considered to be bad. Data miscompares are reported differently than I/O errors, but a data miscompare still causes the block with the miscompare to be added to the badblock list. This is the most thorough test and highly recommended before using a disk drive for the first time, unless you are certain that it is OK. DEBUG FUNCTIONS fx has a menu of disk debug functions. For safety reasons, most are not present in the normal (non-expert) mode, where only nondestructive functions are available. In the expert mode, disk blocks can be written as well as read. For SCSI disks, the drive parameters (modesense pages) can be displayed and individual bytes altered and sent to the disk via modeselect commands. A function that can be useful is the ability to directly read and display the contents of any block on the disk. An internal memory buffer is provided as a source or destination for data; the contents of this buffer can be displayed and edited. For SCSI drives, there are also functions to display the drive capacity, to display the modesense page values, and to allow setting of modeselect page values (as decimal, octal, or hex values, rather than symbolicly, as is normally done with the label functions). cmpbuf Allows blocks of data in different areas of the buffer to be compared; written and read-back data, for example. It prompts for the starts of the two areas to be compared (relative to the beginning of the internal buffer) and for the length of comparison. dumpbuf Allows display of the contents of the buffer. It prompts for start address (relative to beginning of buffer), length to display and display output type: bytes, (2-byte) words, or (4-byte) longwords. Data is displayed in the hex output selected and also as characters with non-printable characters represented by dots. editbuf Allows individual buffer locations to be modified in byte, 2- byte or 4-byte units. fillbuf Allows sections of the buffer to be filled with a repeating pattern. It prompts for start location and length to fill and for a string of data to use as the fill pattern. (Unfortunately, only a string is accepted. It is not possible to enter hex data. The buffer can be cleared by entering a null string.) number Accepts a decimal number, and prints it in octal and hex. readbuf Allows disk blocks to be read into the internal buffer. It prompts for buffer address (relative to start of buffer), and number of blocks to read. Up to 100 blocks can be read in one operation. The disk block address from which the read occurs is maintained as an internal variable by fx. It can be set with the seek function. seek Sets the internal fx variable that holds the source or destination blocknumber on disk for transfers between disk and the internal buffer. A prompt of the current value is given. It does not cause any I/O, just sets the block number for the next I/O. The remaining functions appear only in expert mode, because they are either potentially destructive (for example, writebuf) or of little interest to the normal user. writebuf Writes blocks from the internal buffer to the disk. It prompts for source buffer address and number of blocks to write. The disk address block for the write is taken from the internal fx variable set by seek, as for readbuf. showcapacity It shows the output of the SCSI readcapacity command. This can be used to verify that the partition layout chosen is valid (fx verifies this automatically, but it can still be useful to see this). Drives with variable geometry can have a partition layout that does not use all of the drive. The partitions should never extend past the value displayed by showcapacity. Note that after geometry on SCSI drives is changed, the drive may not report any capacity changes until after a low level format is done; for some drives the geometry changes will not even take effect if a low level format is not done before the drive is power cycled or a scsi bus reset occurs. showpages Shows which modesense pages (drive parameters) the drive supports, their length, and, with the -c option, their current values. The -m and -d options display the modifiable and default values, respectively. The -s option shows the saved parameters (almost always the same as the current parameters). This is sometimes useful when attempting to connect a drive that has features not already supported by fx. setpage Appears only for SCSI drives. It allows you to set the values of a modeselect page (and optionally the block descriptor) on a byte by byte basis. As with other fx input, numbers are decimal by default, octal with a leading 0, or hex with a leading 0x. Trailing bytes not entered are treated as 0. The values are masked with the changeable values; the masked values are displayed before they are set. There are no sanity checks on the values entered (other than that they must fit in a byte). Therefore it is possible to render a drive unusable by changing values this way. This function is intended for those who understand the meanings of the values in the modeselect pages, primarily when dealing with new types of drives. It is sometimes possible to recover from mistakes by doing /label/creat/all. format Formats the disk, erasing all information on the disk. The whole disk is formatted in a single un-interruptible operation, lasting anywhere from a few minutes for floppies, and 30 minutes to 8 hours for hard disks, depending on size and type. It is very rare that a low level format is necessary on a SCSI disk, and doing a low level format can render the disk unusable if an error occurs. Even when no errors occur, it is possible that the drive may have its parameters changed in such a way that its performance is affected. This operation is discouraged, and it has been moved to the debug functions to make it more obvious that it is not a normal operation. INITIALIZING NEW DISKS fx can be used to initialize disk drives that have not been previously set up as SGI disks. The new drive to be initialized MUST be physically connected to the system, and appear in the hardware graph (for the non- standalone system). See the scsiha(1M) command for re-probing for devices not found at system boot, and therefore not present in the hardware graph (i.e., links to it are present in the /dev/rdsk directory. Warning: Do not connect or disconnect non-RAID drives while the system is powered up, because this could damage the drive or controller. For some types of systems or disks, it could also cause the termination power fuse to fail (newer systems have solid state equivalents of a circuit breaker that will reset automatically after a few seconds or minutes). Such failures can result in apparently random SCSI errors. The disk drives in a RAID brick can be removed and added while the system is up and accessing the RAID. Initialization of a RAID should be done using the RAID administrative utility raid(1M). Take care that termination of the new drive is correct. This varies with the drive type and system type. On systems with SCSI drives and an external terminator pack, none of the drives should be terminated unless they are external to the system; in that case, only the device at the end of the SCSI bus should have terminators. Be sure that the drive ID does not conflict with that of any other drive connected to the same controller. For all systems shipped by SGI, the controller (host adapter) SCSI ID is 0. Many other manufacturers' systems are shipped with the controller as ID 7, so be sure to check the ID when moving drives from one type of system to another. With the new drive connected, bring the system back up to normal multiuser mode, and invoke fx in expert mode (the -x option). Enter the controller type and number, and the drive number for the new drive. For SCSI drives, the drive type is determined automatically by an inquiry operation on the drive. SCSI drives determine all of the information about the drive by using the modesense command, after determining which modesense pages the drive supports. If the drive supports the SCSI 2 pages, they are used. Otherwise, the CCS extensions to SCSI 1 are assumed (as well as some defacto standard vendor-specific pages). If none of the geometry pages are supported, fx chooses some reasonable set of defaults, such that most disks should be able to be used to their full capacity. Use of drives not qualified by Silicon Graphics Inc., is not recommended. Once drive type is identified, select the auto item on the main menu. This initializes the drive volume header, scans it for bad blocks, and places a label on it, and creates a default partition layout (as an option disk). On completion, the drive is ready for use. It is usually necessary to create filesystems on the drive and to mount these filesystems before the drive can be used. See mkfs(1M), Add_disk(1) and mount(1M). A graphical interface from the system manager program is also available to do these functions for option disks. Note: Use of auto no longer formats the disk drive, because this operation is not necessary with SCSI disk drives. NOTE The udf filesystem is not known by fx, hence the user should be aware that there is no udf partition label. A udf filesystem can be created on a partition labeled xfs. It is unnecessary to run fx on DVD-RAM devices. FILES /dev/rdsk/dks*, /dev/rdsk/*/lun*vol/*, /dev/rdsk/fds* SEE ALSO Add_disk(1), MAKEDEV(1M), dvhtool(1M), mknod(1M), mount(1M), scsiha(1M), hwgfs(4), dks(7M), smfd(7M), vh(7M), xlv(7M). Page 20