| '\" te |
| .\" Copyright (c) 1988 Regents of the University |
| .\" of California. All rights reserved. Copyright (c) 2003 Sun Microsystems, |
| .\" Inc. All Rights Reserved. |
| .TH FSDB_UFS 1M "Apr 14, 2003" |
| .SH NAME |
| fsdb_ufs \- ufs file system debugger |
| .SH SYNOPSIS |
| .LP |
| .nf |
| \fBfsdb\fR \fB-F\fR ufs [\fIgeneric_options\fR] [\fIspecific_options\fR] \fIspecial\fR |
| .fi |
| |
| .SH DESCRIPTION |
| .LP |
| The \fBfsdb_ufs\fR command is an interactive tool that can be used to patch up |
| a damaged \fBUFS\fR file system. It has conversions to translate block and |
| i-numbers into their corresponding disk addresses. Also included are mnemonic |
| offsets to access different parts of an inode. These greatly simplify the |
| process of correcting control block entries or descending the file system tree. |
| .sp |
| .LP |
| \fBfsdb\fR contains several error-checking routines to verify inode and block |
| addresses. These can be disabled if necessary by invoking \fBfsdb\fR with the |
| \fB-o\fR option or by the use of the \fBo\fR command. |
| .sp |
| .LP |
| \fBfsdb\fR reads a block at a time and will therefore work with raw as well as |
| block \fBI/O\fR devices. A buffer management routine is used to retain commonly |
| used blocks of data in order to reduce the number of read system calls. All |
| assignment operations result in an immediate write-through of the corresponding |
| block. Note that in order to modify any portion of the disk, \fBfsdb\fR must be |
| invoked with the \fBw\fR option. |
| .sp |
| .LP |
| Wherever possible, \fBadb-\fRlike syntax was adopted to promote the use of |
| \fBfsdb\fR through familiarity. |
| .SH OPTIONS |
| .LP |
| The following option is supported: |
| .sp |
| .ne 2 |
| .na |
| \fB\fB-o\fR\fR |
| .ad |
| .RS 6n |
| Specify \fBUFS\fR file system specific options. These options can be any |
| combination of the following separated by commas (with no intervening spaces). |
| The options available are: |
| .sp |
| .ne 2 |
| .na |
| \fB\fB?\fR\fR |
| .ad |
| .RS 14n |
| Display usage |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBo\fR\fR |
| .ad |
| .RS 14n |
| Override some error conditions |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBp='string'\fR\fR |
| .ad |
| .RS 14n |
| set prompt to string |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBw\fR\fR |
| .ad |
| .RS 14n |
| open for write |
| .RE |
| |
| .RE |
| |
| .SH USAGE |
| .LP |
| Numbers are considered hexadecimal by default. However, the user has control |
| over how data is to be displayed or accepted. The \fBbase\fR command will |
| display or set the input/output base. Once set, all input will default to this |
| base and all output will be shown in this base. The base can be overridden |
| temporarily for input by preceding hexadecimal numbers with \&'\fB0x\fR', |
| preceding decimal numbers with '\fB0t\fR', or octal numbers with '\fB0\fR'. |
| Hexadecimal numbers beginning with \fBa-f\fR or \fBA-F\fR must be preceded with |
| \&'\fB0x\fR' to distinguish them from commands. |
| .sp |
| .LP |
| Disk addressing by \fBfsdb\fR is at the byte level. However, \fBfsdb\fR offers |
| many commands to convert a desired inode, directory entry, block, superblock |
| and so forth to a byte address. Once the address has been calculated, |
| \fBfsdb\fR will record the result in dot (\fB\&.\fR). |
| .sp |
| .LP |
| Several global values are maintained by \fBfsdb\fR: |
| .RS +4 |
| .TP |
| .ie t \(bu |
| .el o |
| the current base (referred to as \fBbase\fR), |
| .RE |
| .RS +4 |
| .TP |
| .ie t \(bu |
| .el o |
| the current address (referred to as \fBdot\fR), |
| .RE |
| .RS +4 |
| .TP |
| .ie t \(bu |
| .el o |
| the current inode (referred to as \fBinode\fR), |
| .RE |
| .RS +4 |
| .TP |
| .ie t \(bu |
| .el o |
| the current count (referred to as \fBcount\fR), |
| .RE |
| .RS +4 |
| .TP |
| .ie t \(bu |
| .el o |
| and the current type (referred to as \fBtype\fR). |
| .RE |
| .sp |
| .LP |
| Most commands use the preset value of \fBdot\fR in their execution. For |
| example, |
| .sp |
| .LP |
| \fB> 2:inode\fR |
| .sp |
| .LP |
| will first set the value of \fBdot\fR to 2, ':', will alert the start of a |
| command, and the \fBinode\fR command will set \fBinode\fR to 2. A count is |
| specified after a ','. Once set, \fBcount\fR will remain at this value until a |
| new command is encountered which will then reset the value back to 1 (the |
| default). So, if |
| .sp |
| .LP |
| \fB> 2000,400/X\fR |
| .sp |
| .LP |
| is typed, 400 hex longs are listed from 2000, and when completed, the value of |
| \fBdot\fR will be \fB2000 + 400 * sizeof (long)\fR. If a \fBRETURN\fR is then |
| typed, the output routine will use the current values of \fBdot\fR, |
| \fBcount\fR, and \fBtype\fR and display 400 more hex longs. A '*' will cause |
| the entire block to be displayed. |
| .sp |
| .LP |
| End of fragment, block and file are maintained by \fBfsdb\fR. When displaying |
| data as fragments or blocks, an error message will be displayed when the end of |
| fragment or block is reached. When displaying data using the \fBdb\fR, |
| \fBib\fR, \fBdirectory\fR, or \fBfile\fR commands an error message is displayed |
| if the end of file is reached. This is mainly needed to avoid passing the end |
| of a directory or file and getting unknown and unwanted results. |
| .sp |
| .LP |
| An example showing several commands and the use of \fBRETURN\fR would be: |
| .sp |
| .in +2 |
| .nf |
| \fB> 2:ino; 0:dir?d\fR |
| or |
| \fB> 2:ino; 0:db:block?d\fR |
| .fi |
| .in -2 |
| .sp |
| |
| .sp |
| .LP |
| The two examples are synonymous for getting to the first directory entry of the |
| root of the file system. Once there, any subsequent \fBRETURN\fR (or +, -) |
| will advance to subsequent entries. Note that |
| .sp |
| .in +2 |
| .nf |
| \fB> 2:inode; :ls\fR |
| or |
| \fB> :ls /\fR |
| .fi |
| .in -2 |
| .sp |
| |
| .sp |
| .LP |
| is again synonymous. |
| .SS "Expressions" |
| .LP |
| The symbols recognized by \fBfsdb\fR are: |
| .sp |
| .ne 2 |
| .na |
| \fB\fBRETURN\fR\fR |
| .ad |
| .RS 13n |
| update the value of \fBdot\fR by the current value of \fBtype\fR and display |
| using the current value of \fBcount\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB#\fR\fR |
| .ad |
| .RS 13n |
| numeric expressions may be composed of +, -, *, and % operators (evaluated left |
| to right) and may use parentheses. Once evaluated, the value of \fBdot\fR is |
| updated. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB,\fR\fI count\fR\fR |
| .ad |
| .RS 13n |
| count indicator. The global value of \fBcount\fR will be updated to |
| \fBcount\fR. The value of \fBcount\fR will remain until a new command is run. A |
| count specifier of '*' will attempt to show a \fIblocks's\fR worth of |
| information. The default for \fBcount\fR is 1. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB?\fR\fI f\fR\fR |
| .ad |
| .RS 13n |
| display in structured style with format specifier \fIf\fR. See |
| \fBFormatted Output\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB/\fR\fI f\fR\fR |
| .ad |
| .RS 13n |
| display in unstructured style with format specifier \fIf\fR. See |
| \fBFormatted Output\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB\&.\fR\fR |
| .ad |
| .RS 13n |
| the value of \fBdot\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB+\fR\fIe\fR\fR |
| .ad |
| .RS 13n |
| increment the value of \fBdot\fR by the expression \fIe.\fR The amount actually |
| incremented is dependent on the size of \fBtype\fR: |
| .sp |
| \fBdot = dot + e * sizeof (type)\fR |
| .sp |
| The default for \fIe\fR is \fB1\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB-\fR\fIe\fR\fR |
| .ad |
| .RS 13n |
| decrement the value of \fBdot\fR by the expression \fIe\fR. See \fB+\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB*\fR\fIe\fR\fR |
| .ad |
| .RS 13n |
| multiply the value of \fBdot\fR by the expression \fIe.\fR Multiplication and |
| division don't use \fBtype\fR. In the above calculation of \fBdot\fR, consider |
| the \fBsizeof(type)\fR to be \fB1\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB%\fR\fIe\fR\fR |
| .ad |
| .RS 13n |
| divide the value of \fBdot\fR by the expression \fIe\fR. See \fB*\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB<\fR\fI name\fR\fR |
| .ad |
| .RS 13n |
| restore an address saved in register \fIname\fR. \fIname\fR must be a single |
| letter or digit. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB>\fR\fI name\fR\fR |
| .ad |
| .RS 13n |
| save an address in register \fIname\fR. \fIname\fR must be a single letter or |
| digit. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB=\fR\fI f\fR\fR |
| .ad |
| .RS 13n |
| display indicator. If \fIf\fR is a legitimate format specifier, then the value |
| of \fBdot\fR is displayed using the format specifier \fIf\fR. See |
| \fBFormatted Output\fR. Otherwise, assignment is assumed. See \fB=\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB= [\fR\fIs\fR\fB] [\fR\fIe\fR\fB]\fR\fR |
| .ad |
| .RS 13n |
| assignment indicator. The address pointed to by \fBdot\fR has its contents |
| changed to the value of the expression \fIe\fR or to the \fBASCII\fR |
| representation of the quoted (") string \fIs\fR. This may be useful for |
| changing directory names or \fBASCII\fR file information. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB=+\fR\fI e\fR\fR |
| .ad |
| .RS 13n |
| incremental assignment. The address pointed to by \fBdot\fR has its contents |
| incremented by expression \fIe\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB=-\fR\fI e\fR\fR |
| .ad |
| .RS 13n |
| decremental assignment. The address pointed to by \fBdot\fR has its contents |
| decremented by expression \fIe\fR. |
| .RE |
| |
| .SS "Commands" |
| .LP |
| A command must be prefixed by a ':' character. Only enough letters of the |
| command to uniquely distinguish it are needed. Multiple commands may be entered |
| on one line by separating them by a \fBSPACE,\fR \fBTAB\fR or ';'. |
| .sp |
| .LP |
| In order to view a potentially unmounted disk in a reasonable manner, |
| \fBfsdb\fR offers the \fBcd\fR, \fBpwd\fR, \fBls\fR and \fBfind\fR commands. |
| The functionality of these commands substantially matches those of its UNIX |
| counterparts. See individual commands for details. The '*', '?', and '[-]' wild |
| card characters are available. |
| .sp |
| .ne 2 |
| .na |
| \fB\fBbase=b\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| display or set base. As stated above, all input and output is governed by the |
| current \fBbase\fR. If the \fB=b\fR is omitted, the current \fBbase\fR is |
| displayed. Otherwise, the current \fBbase\fR is set to \fIb.\fR Note that this |
| is interpreted using the old value of \fBbase\fR, so to ensure correctness use |
| the '0', '0t', or '0x' prefix when changing the \fBbase\fR. The default for |
| \fBbase\fR is hexadecimal. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBblock\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| convert the value of \fBdot\fR to a block address. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBcd \fR\fIdir\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| change the current directory to directory \fIdir\fR. The current values of |
| \fBinode\fR and \fBdot\fR are also updated. If no \fIdir\fR is specified, then |
| change directories to inode \fB2\fR ("/"). |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBcg\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| convert the value of \fBdot\fR to a cylinder group. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBdirectory\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| If the current \fBinode\fR is a directory, then the value of \fBdot\fR is |
| converted to a directory slot offset in that directory and \fBdot\fR now points |
| to this entry. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBfile\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| the value of \fBdot\fR is taken as a relative block count from the beginning of |
| the file. The value of \fBdot\fR is updated to the first byte of this block. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBfind\fR \fIdir\fR [ \fB-name\fR \fIn\fR] [\fB-inum\fR \fIi\fR]\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| find files by name or i-number. \fBfind\fR recursively searches directory |
| \fBdir\fR and below for filenames whose i-number matches \fIi\fR or whose name |
| matches pattern \fIn\fR. Note that only one of the two options (-name or -inum) |
| may be used at one time. Also, the -print is not needed or accepted. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBfill\fR\fI=p\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| fill an area of disk with pattern \fIp\fR. The area of disk is delimited by |
| \fBdot\fR and \fBcount\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBfragment\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| convert the value of \fIdot\fR to a fragment address. The only difference |
| between the \fBfragment\fR command and the \fBblock\fR command is the amount |
| that is able to be displayed. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBinode\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| convert the value of \fIdot\fR to an inode address. If successful, the current |
| value of \fBinode\fR will be updated as well as the value of \fIdot\fR. As a |
| convenient shorthand, if ':inode' appears at the beginning of the line, the |
| value of \fIdot\fR is set to the current \fBinode\fR and that inode is |
| displayed in inode format. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBlog_chk\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| run through the valid log entries without printing any information and verify |
| the layout. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBlog_delta\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| count the number of deltas into the log, using the value of dot as an offset |
| into the log. No checking is done to make sure that offset is within the |
| head/tail offsets. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBlog_head\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| display the header information about the file system logging. This shows the |
| block allocation for the log and the data structures on the disk. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBlog_otodb\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| return the physical disk block number, using the value of dot as an offset into |
| the log. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBlog_show\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| display all deltas between the beginning of the log (BOL) and the end of the |
| log (EOL). |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBls\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| [ \fB-R\fR ] [ \fB-l\fR ] \fIpat1 pat2\fR\|.\|.\|. list directories or files. |
| If no file is specified, the current directory is assumed. Either or both of |
| the options may be used (but, if used, \fImust\fR be specified before the |
| filename specifiers). Also, as stated above, wild card characters are available |
| and multiple arguments may be given. The long listing shows only the i-number |
| and the name; use the \fBinode\fR command with '?i' to get more information. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBoverride\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| toggle the value of override. Some error conditions may be overridden if |
| override is toggled on. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBprompt\fR\fI p\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| change the \fBfsdb\fR prompt to \fIp\fR. \fIp\fR must be surrounded by (")s. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBpwd\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| display the current working directory. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBquit\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| quit \fBfsdb\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBsb\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| the value of \fIdot\fR is taken as a cylinder group number and then converted |
| to the address of the superblock in that cylinder group. As a shorthand, ':sb' |
| at the beginning of a line will set the value of \fIdot\fR to \fIthe\fR |
| superblock and display it in superblock format. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBshadow\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| if the current inode is a shadow inode, then the value of \fIdot\fR is set to |
| the beginning of the shadow inode data. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB!\fR\fR |
| .ad |
| .sp .6 |
| .RS 4n |
| escape to shell |
| .RE |
| |
| .SS "Inode Commands" |
| .LP |
| In addition to the above commands, there are several commands that deal with |
| inode fields and operate directly on the current \fBinode\fR (they still |
| require the ':'). They may be used to more easily display or change the |
| particular fields. The value of \fIdot\fR is only used by the '\fB:db\fR' |
| and '\fB:ib\fR' commands. Upon completion of the command, the value of \fIdot\fR is |
| changed to point to that particular field. For example, |
| .sp |
| .LP |
| \fB> :ln=+1\fR |
| .sp |
| .LP |
| would increment the link count of the current \fBinode\fR and set the value of |
| \fIdot\fR to the address of the link count field. |
| .sp |
| .ne 2 |
| .na |
| \fB\fBat\fR\fR |
| .ad |
| .RS 7n |
| access time. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBbs\fR\fR |
| .ad |
| .RS 7n |
| block size. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBct\fR\fR |
| .ad |
| .RS 7n |
| creation time. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBdb\fR\fR |
| .ad |
| .RS 7n |
| use the current value of \fIdot\fR as a direct block index, where direct blocks |
| number from 0 - 11. In order to display the block itself, you need to 'pipe' |
| this result into the \fBblock\fR or \fBfragment\fR command. For example, |
| .sp |
| .in +2 |
| .nf |
| \fB > 1:db:block,20/X\fR |
| .fi |
| .in -2 |
| .sp |
| |
| would get the contents of data block field 1 from the inode and convert it to a |
| block address. 20 longs are then displayed in hexadecimal. See |
| \fBFormatted Output\fR. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBgid\fR\fR |
| .ad |
| .RS 7n |
| group id. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBib\fR\fR |
| .ad |
| .RS 7n |
| use the current value of \fIdot\fR as an indirect block index where indirect |
| blocks number from 0 - 2. This will only get the indirect block itself (the |
| block containing the pointers to the actual blocks). Use the \fBfile\fR command |
| and start at block 12 to get to the actual blocks. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBln\fR\fR |
| .ad |
| .RS 7n |
| link count. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBmt\fR\fR |
| .ad |
| .RS 7n |
| modification time. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBmd\fR\fR |
| .ad |
| .RS 7n |
| mode. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBmaj\fR\fR |
| .ad |
| .RS 7n |
| major device number. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBmin\fR\fR |
| .ad |
| .RS 7n |
| minor device number. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBnm\fR\fR |
| .ad |
| .RS 7n |
| although listed here, this command actually operates on the directory name |
| field. Once poised at the desired directory entry (using the \fIdirectory\fR |
| command), this command will allow you to change or display the directory name. |
| For example, |
| .sp |
| \fB> 7:dir:nm="foo"\fR |
| .sp |
| will get the \fB7\fRth directory entry of the current \fBinode\fR and change |
| its name to foo. Note that names cannot be made larger than the field is set up |
| for. If an attempt is made, the string is truncated to fit and a warning |
| message to this effect is displayed. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBsi\fR\fR |
| .ad |
| .RS 7n |
| shadow inode. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBsz\fR\fR |
| .ad |
| .RS 7n |
| file size. |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBuid\fR\fR |
| .ad |
| .RS 7n |
| user id. |
| .RE |
| |
| .SS "Formatted Output" |
| .LP |
| There are two styles and many format types. The two styles are structured and |
| unstructured. Structured output is used to display inodes, directories, |
| superblocks and the like. Unstructured displays raw data. The following shows |
| the different ways of displaying: |
| .sp |
| .ne 2 |
| .na |
| \fB\fB?\fR\fR |
| .ad |
| .RS 5n |
| .sp |
| .ne 2 |
| .na |
| \fB\fBc\fR\fR |
| .ad |
| .RS 5n |
| display as cylinder groups |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBi\fR\fR |
| .ad |
| .RS 5n |
| display as inodes |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBd\fR\fR |
| .ad |
| .RS 5n |
| display as directories |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBs\fR\fR |
| .ad |
| .RS 5n |
| display as superblocks |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBS\fR\fR |
| .ad |
| .RS 5n |
| display as shadow inode data |
| .RE |
| |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fB/\fR\fR |
| .ad |
| .RS 5n |
| .sp |
| .ne 2 |
| .na |
| \fB\fBb\fR\fR |
| .ad |
| .RS 7n |
| display as bytes |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBc\fR\fR |
| .ad |
| .RS 7n |
| display as characters |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBo O\fR\fR |
| .ad |
| .RS 7n |
| display as octal shorts or longs |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBd D\fR\fR |
| .ad |
| .RS 7n |
| display as decimal shorts or longs |
| .RE |
| |
| .sp |
| .ne 2 |
| .na |
| \fB\fBx X\fR\fR |
| .ad |
| .RS 7n |
| display as hexadecimal shorts or longs |
| .RE |
| |
| The format specifier immediately follows the '/' or '?' character. The values |
| displayed by '/b' and all '?' formats are displayed in the current \fBbase\fR. |
| Also, \fBtype\fR is appropriately updated upon completion. |
| .RE |
| |
| .SH EXAMPLES |
| .LP |
| \fBExample 1 \fRDisplaying in Decimal |
| .sp |
| .LP |
| The following command displays \fB2010\fR in decimal (use of \fBfsdb\fR as a |
| calculator for complex arithmetic): |
| |
| .sp |
| .in +2 |
| .nf |
| > 2000+400%(20+20)=D |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 2 \fRDisplaying an i-number in Inode Format |
| .sp |
| .LP |
| The following command displays i-number \fB386\fR in an inode format. This now |
| becomes the current \fBinode\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 386:ino?i |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 3 \fRChanging the Link Count |
| .sp |
| .LP |
| The following command changes the link count for the current \fBinode\fR to |
| \fB4\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > :ln=4 |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 4 \fRIncrementing the Link Count |
| .sp |
| .LP |
| The following command increments the link count by \fB1\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > :ln=+1 |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 5 \fRDisplaying the Creation Time |
| .sp |
| .LP |
| The following command displays the creation time as a hexadecimal long: |
| |
| .sp |
| .in +2 |
| .nf |
| > :ct=X |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 6 \fRDisplaying the Modification Time |
| .sp |
| .LP |
| The following command displays the modification time in time format: |
| |
| .sp |
| .in +2 |
| .nf |
| > :mt=t |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 7 \fRDisplaying in ASCII |
| .sp |
| .LP |
| The following command displays in \fBASCII,\fR block zero of the file |
| associated with the current \fBinode\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 0:file/c |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 8 \fRDisplaying the First Block's Worth of Directorty Entries |
| .sp |
| .LP |
| The following command displays the first block's worth of directory entries for |
| the root inode of this file system. It will stop prematurely if the \fBEOF\fR |
| is reached: |
| |
| .sp |
| .in +2 |
| .nf |
| > 2:ino,*?d |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 9 \fRDisplaying Changes to the Current Inode |
| .sp |
| .LP |
| The following command displays changes the current inode to that associated |
| with the \fB5\fRth directory entry (numbered from zero) of the current |
| \fBinode\fR. The first logical block of the file is then displayed in |
| \fBASCII\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 5:dir:inode; 0:file,*/c |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 10 \fRDisplaying the Superblock |
| .sp |
| .LP |
| The following command displays the superblock of this file system: |
| |
| .sp |
| .in +2 |
| .nf |
| > :sb |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 11 \fRDisplaying the Cylinder Group |
| .sp |
| .LP |
| The following command displays cylinder group information and summary for |
| cylinder group \fB1\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 1:cg?c |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 12 \fRChanging the i-number |
| .sp |
| .LP |
| The following command changes the i-number for the seventh directory slot in |
| the root directory to \fB3\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 2:inode; 7:dir=3 |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 13 \fRDisplaying as Directory Entries |
| .sp |
| .LP |
| The following command displays the third block of the current \fBinode\fR as |
| directory entries: |
| |
| .sp |
| .in +2 |
| .nf |
| > 2:db:block,*?d |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 14 \fRChanging the Name Field |
| .sp |
| .LP |
| The following command changes the name field in the directory slot to |
| \fIname\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 7:dir:nm="name" |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 15 \fRGetting and Filling Elements |
| .sp |
| .LP |
| The following command gets fragment \fB3c3\fR and fill \fB20\fR \fBtype\fR |
| elements with \fB0x20\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 3c3:fragment,20:fill=0x20 |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 16 \fRSetting the Contents of an Address |
| .sp |
| .LP |
| The following command sets the contents of address \fB2050\fR to |
| \fB0xffffffff\fR. \fB0xffffffff\fR may be truncated depending on the current |
| \fBtype\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 2050=0xffff |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 17 \fRPlacing ASCII |
| .sp |
| .LP |
| The following command places the \fBASCII\fR for the string at \fB1c92434\fR: |
| |
| .sp |
| .in +2 |
| .nf |
| > 1c92434="this is some text" |
| .fi |
| .in -2 |
| .sp |
| |
| .LP |
| \fBExample 18 \fRDisplaying Shadow Inode Data |
| .sp |
| .LP |
| The following command displays all of the shadow inode data in the shadow inode |
| associated with the root inode of this file system: |
| |
| .sp |
| .in +2 |
| .nf |
| > 2:ino:si:ino;0:shadow,*?S |
| .fi |
| .in -2 |
| .sp |
| |
| .SH SEE ALSO |
| .LP |
| \fBclri\fR(1M), \fBfsck_ufs\fR(1M), \fBdir_ufs\fR(4), \fBattributes\fR(5), |
| \fBufs\fR(7FS) |
| .SH WARNINGS |
| .LP |
| Since \fBfsdb\fR reads the disk raw, extreme caution is advised in determining |
| its availability of \fBfsdb\fR on the system. Suggested permissions are 600 and |
| owned by bin. |
| .SH NOTES |
| .LP |
| The old command line syntax for clearing i-nodes using the ufs-specific |
| \fB\&'-z i-number'\fR option is still supported by the new debugger, though it |
| is obsolete and will be removed in a future release. Use of this flag will |
| result in correct operation, but an error message will be printed warning of |
| the impending obsolesence of this option to the command. The equivalent |
| functionality is available using the more flexible \fBclri\fR(1M) command. |