2 .\" Copyright (c) 1999 Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH FSDB_UDFS 1M "Nov 26, 2017"
8 fsdb_udfs \- udfs file system debugger
12 \fBfsdb \fR [\fB-F\fR] udfs [\fIgeneric_option\fR] [\fB-o \fR\fIspecific_option\fR] \fIspecial\fR
17 The \fBfsdb_udfs\fR command is an interactive tool that can be used to patch up
18 a damaged \fBudfs\fR file system. \fBfsdb_udfs\fR has conversions to translate
19 block and i-numbers into their corresponding disk addresses. Mnemonic offsets
20 to access different parts of an inode are also included. Mnemonic offsets
21 greatly simplify the process of correcting control block entries or descending
25 \fBfsdb\fR contains several error-checking routines to verify inode and block
26 addresses. These can be disabled if necessary by invoking \fBfsdb\fR with the
27 \fB-o\fR option or by using the \fBo\fR command.
30 \fBfsdb\fR reads one block at a time, and therefore works with raw as well as
31 block \fBI/O\fR devices. A buffer management routine is used to retain commonly
32 used blocks of data in order to reduce the number of read system calls. All
33 assignment operations result in an immediate write-through of the corresponding
34 block. In order to modify any portion of the disk, \fBfsdb\fR must be invoked
35 with the \fB-w\fR option.
38 Wherever possible, \fBadb\fR-like syntax has been adopted to promote the use of
39 \fBfsdb\fR through familiarity.
42 The following options are supported:
46 \fB\fB-o\fR \fIspecific_option\fR\fR
49 Specify \fBudfs\fR file system specific options in a comma-separated list with
50 no intervening spaces. The following specific options are supported:
57 Override some error conditions.
66 Set prompt to \fIstring\fR.
91 Numbers are considered hexadecimal by default. The user has control over how
92 data is to be displayed or accepted. The \fBbase\fR command displays or sets
93 the input and output base. Once set, all input defaults to this base and all
94 output displays in this base. The base can be overriden temporarily for input
95 by preceding hexadecimal numbers by \fB0x\fR, preceding decimal numbers with a
96 \fB0t\fR, or octal numbers with a \fB0\fR. Hexadecimal numbers beginning with
97 \fBa\fR-\fBf\fR or \fBA\fR -\fBF\fR must be preceded with a \fB0x\fR to
98 distinguish them from commands.
101 Disk addressing by \fBfsdb\fR is at the byte level. However, \fBfsdb\fR offers
102 many commands to convert a desired inode, directory entry, block, and so forth,
103 to a byte address. After the address has been calculated, \fBfsdb\fR records
104 the result in the current address (\fBdot\fR).
107 Several global values are maintained by \fBfsdb\fR\fB\fR:
112 Current base (referred to as \fBbase\fR)
118 Current address (referred to as \fBdot\fR)
124 Current inode (referred to as \fBinode\fR)
130 Current count (referred to as \fBcount\fR)
136 Current type (referred to as \fBtype\fR)
140 Most commands use the preset value of \fBdot\fR in their execution. For
152 first sets the value of dot (\fB\&.\fR) to \fB2\fR, colon (\fB:\fR), signifies
153 the start of a command, and the \fBinode\fR command sets \fBinode\fR to
154 \fB2\fR. A count is specified after a comma (\fB,\fR). Once set, count remains
155 at this value until a new command is encountered that resets the value back to
156 \fB1\fR (the default).
170 is entered, \fB400\fR hex longs are listed from \fB2000\fR, and when completed,
171 the value of dot is \fB 2000 + 400 * sizeof\fR (long). If a RETURN is then
172 entered, the output routine uses the current values of \fBdot\fR, \fBcount\fR,
173 and \fBtype\fR and displays \fB400 \fRmore hex longs. An asterisk (\fB*\fR)
174 causes the entire block to be displayed. An example showing several commands
175 and the use of RETURN would be:
190 > 2:ino; 0:db:block?d
197 The two examples are synonymous for getting to the first directory entry of the
198 root of the file system. Once there, subsequently entering a RETURN, plus
199 (\fB+\fR), or minus (\fB-\fR) advances to subsequent entries. Notice that
224 The following symbols are recognized by \fBfsdb\fR:
231 Update the value of dot by the current value of \fItype\fR and \fIdisplay\fR
232 using the current value of \fIcount\fR.
241 Update the value of dot by specifying a numeric expression. Specify numeric
242 expressions using addition, subtraction, multiplication, and division
243 operators ( \fB+\fR, \fB-\fR, \fB*\fR, and \fB%\fR). Numeric expressions are
244 evaluated from left to right and can use parentheses. After evaluation, the
245 value of dot is updated.
254 Update the count indicator. The global value of \fIcount\fR is updated to
255 \fIcount\fR. The value of \fIcount\fR remains until a new command is run. A
256 \fIcount\fR specifier of \fB*\fR attempts to show a blocks's worth of
257 information. The default for \fIcount\fR is \fB1\fR.
266 Display in structured style with format specifier \fBf\fR. See \fBFormatted
276 Display in unstructured style with format specifier \fBf\fR. See \fBFormatted
286 Display the value of dot.
295 Increment the value of dot by the expression \fIe\fR. The amount actually
296 incremented is dependent on the size of type: \fBdot = dot + \fR\fIe \fR\fB*
297 \fR\fBsizeof\fR (\fItype\fR) The default for \fIe\fR is \fB1\fR.
306 Decrement the value of dot by the expression \fIe \fR. See \fB+\fR.
315 Multiply the value of dot by the expression \fIe\fR. Multiplication and
316 division don't use \fItype\fR. In the above calculation of dot, consider the
317 \fBsizeof\fR (\fItype\fR) to be \fB1\fR.
326 Divide the value of dot by the expression \fIe\fR. See \fB*\fR.
335 Restore an address saved in register \fIname\fR. \fIname\fR must be a single
345 Save an address in register \fIname\fR. \fIname\fR must be a single letter or
355 Display indicator. If \fIf\fR is a legitimate format specifier (see
356 \fBFormatted Output\fR), then the value of dot is displayed using format
357 specifier \fIf\fR. Otherwise, assignment is assumed. See \fB= [s] [e]\fR.
363 \fB= [\fIs\fR] [\fIe\fR]\fR
366 Change the value of dot using an assignment indicator. The address pointed to
367 by dot has its contents changed to the value of the expression \fIe\fR or to
368 the \fBASCII\fR representation of the quoted (\fB"\fR) string \fIs\fR. This can
369 be useful for changing directory names or \fBASCII\fR file information.
378 Change the value of dot using an incremental assignment. The address pointed to
379 by dot has its contents incremented by expression \fIe\fR.
388 Change the value of dot using a decremental assignment. Decrement the contents
389 of the address pointed to by dot by expression \fIe\fR.
394 A command must be prefixed by a colon (\fB:\fR). Only enough letters of the
395 command to uniquely distinguish it are needed. Multiple commands can be entered
396 on one line by separating them by a SPACE, TAB, or semicolon (\fB;\fR).
399 To view a potentially unmounted disk in a reasonable manner, \fBfsdb\fR
400 supports the \fBcd\fR, \fBpwd\fR, \fBls\fR, and \fBfind\fR commands. The
401 functionality of each of these commands basically matches that of its UNIX
402 counterpart. See \fBcd\fR(1), \fBpwd\fR(1), \fBls\fR(1), and \fBfind\fR(1) for
403 details. The \fB*\fR, \fB,\fR, \fB?\fR, and \fB-\fR wildcard characters are
407 The following commands are supported:
415 Display or set the base. All input and output is governed by the current base.
416 Without the \fB=\fR \fIb\fR, displays the current base. Otherwise, sets the
417 current base to \fIb\fR. Base is interpreted using the old value of base, so to
418 ensure correctness use the \fB0\fR, \fB0t\fR, or \fB0x\fR prefix when changing
419 the base. The default for base is hexadecimal.
429 Convert the value of dot to a block address.
439 Change the current directory to directory \fIdir\fR. The current values of
440 inode and dot are also updated. If \fBdir\fR is not specified, changes
441 directories to inode 2, root (\fB/\fR).
451 If the current inode is a directory, converts the value of dot to a directory
452 slot offset in that directory, and dot now points to this entry.
462 Set the value of dot as a relative block count from the beginning of the file.
463 The value of dot is updated to the first byte of this block.
469 \fBfind \fIdir\fR [\fB-name\fR \fIn\fR] | [\fB-inum\fR\fI i\fR]\fR
473 Find files by name or i-number. Recursively searches directory \fIdir\fR and
474 below for file names whose i-number matches\fB i\fR or whose name matches
475 pattern \fIn\fR. Only one of the two options (\fB-name\fR or \fB-inum\fR) can
476 be used at one time. The find \fB-print\fR is not necessary or accepted.
486 Fill an area of disk with pattern \fIp\fR. The area of disk is delimited by dot
497 Convert the value of dot to an inode address. If successful, the current value
498 of inode is updated as well as the value of dot. As a convenient shorthand, if
499 \fB:inode\fR appears at the beginning of the line, the value of dot is set to
500 the current inode and that inode is displayed in inode format.
506 \fBls [ \fB-R\fR ] [\fB-l\fR ] \fIpat1\fR \fIpat2\fR...\fR
510 List directories or files. If no file is specified, the current directory is
511 assumed. Either or both of the options can be used (but, if used, must be
512 specified before the filename specifiers). Wild card characters are available
513 and multiple arguments are acceptable. The long listing shows only the i-number
514 and the name; use the inode command with \fB?i\fR to get more information.
524 Toggle the value of override. Some error conditions might be overridden if
525 override is toggled to \fBon\fR.
531 \fBprompt "\fIp\fR"\fR
535 Change the \fBfsdb\fR prompt to \fIp\fR. \fIp\fR must be enclosed in quotes.
545 Display the current working directory.
565 Convert the value of dot and if this is a valid tag, print the volume structure
566 according to the tag.
581 In addition to the above commands, several other commands deal with inode
582 fields and operate directly on the current inode (they still require the colon
583 (\fB:\fR). They can be used to more easily display or change the particular
584 fields. The value of dot is only used by the \fB:db\fR and \fB:ib\fR commands.
585 Upon completion of the command, the value of dot is changed so that it points
586 to that particular field. For example,
597 increments the link count of the current inode and sets the value of dot to the
598 address of the link count field.
601 The following inode commands are supported:
689 This command actually operates on the directory name field. Once poised at
690 the desired directory entry (using the \fBdirectory\fR command), this command
691 allows you to change or display the directory name. For example,
700 gets the \fB7\fRth directory entry of the current inode and changes its name to
701 \fBfoo\fR. Directory names cannot be made larger than the field allows. If an
702 attempt is made to make a directory name larger than the field allows,, the
703 string is truncated to fit and a warning message is displayed.
733 .SS "Formatted Output"
735 Formatted output comes in two styles and many format types. The two styles of
736 formatted output are: structured and unstructured. Structured output is used to
737 display inodes, directories, and so forth. Unstructured output displays raw
741 Format specifiers are preceded by the slash (\fB/\fR) or question mark
742 (\fB?\fR) character. \fItype\fR is updated as necessary upon completion.
745 The following format specifiers are preceded by the \fB?\fR character:
752 Display as inodes in the current base.
761 Display as directories in the current base.
766 The following format specifiers are preceded by the \fB/\fR character:
773 Display as bytes in the current base.
782 Display as characters.
791 Display as octal shorts or longs.
800 Display as decimal shorts or longs.
809 Display as hexadecimal shorts or longs.
814 \fBExample 1 \fRUsing fsdb as a calculator for complex arithmetic
817 The following command displays \fB2010\fR in decimal format, and is an example
818 of using \fBfsdb\fR as a calculator for complex arithmetic.
829 \fBExample 2 \fRUsing fsdb to display an i-number in idode fomat
832 The following command displays the i-number \fB386\fR in inode format.\fB386\fR
833 becomes the current inode.
844 \fBExample 3 \fRUsing fsdb to change the link count
847 The following command changes the link count for the current inode to \fB4\fR.
858 \fBExample 4 \fRUsing fsdb to increment the link count
861 The following command increments the link count by \fB1\fR.
872 \fBExample 5 \fRUsing fsdb to display the creation time as a hexadecimal long
875 The following command displays the creation time as a hexadecimal long.
886 \fBExample 6 \fRUsing fsdb to display the modification time in time format
889 The following command displays the modification time in time format.
900 \fBExample 7 \fRUsing fsdb to display in ASCII
903 The following command displays, in \fBASCII\fR, block \fB0\fR of the file
904 associated with the current inode.
915 \fBExample 8 \fRUsing fsdb to display the directory enteries for the root inode
918 The following command displays the first block's directory entries for the root
919 inode of this file system. This command stops prematurely if the \fBEOF\fR is
931 \fBExample 9 \fRUsing fsdb to change the current inode
934 The following command changes the current inode to that associated with the
935 \fB5\fRth directory entry (numbered from \fB0\fR) of the current inode. The
936 first logical block of the file is then displayed in \fBASCII\fR.
941 > 5:dir:inode; 0:file,*/c
947 \fBExample 10 \fRUsing fsdb to change the i-number
950 The following command changes the i-number for the \fB7\fRth directory slot in
951 the root directory to \fB3\fR.
962 \fBExample 11 \fRUsing fsdb to change the name field
965 The following command changes the \fIname\fR field in the directory slot to
977 \fBExample 12 \fRUsing fsdb to display the a block
980 The following command displays the \fB3\fRrd block of the current inode as
984 \fBExample 13 \fRUsing fsdb to set the contents of address
987 The following command sets the contents of address \fB2050\fR to
988 \fB0xffffffff\fR. \fB0xffffffff\fR can be truncated, depending on the current
1000 \fBExample 14 \fRUsing fsdb to place an ASCII string at an address
1003 The following command places the \fBASCII\fR string \fBthis is some text\fR at
1004 address \fB1c92434\fR.
1009 > 1c92434="this is some text"
1016 \fBclri\fR(1M), \fBfsck_udfs\fR(1M), \fBdir\fR(4), \fBattributes\fR(5)