1 '\" te
   2 .\"  Copyright (c) 1988 Regents of the University
   3 .\" of California.  All rights reserved.  Copyright (c) 2003 Sun Microsystems,
   4 .\" Inc.  All Rights Reserved.
   5 .TH FSDB_UFS 1M "Apr 14, 2003"
   6 .SH NAME
   7 fsdb_ufs \- ufs file system debugger
   8 .SH SYNOPSIS
   9 .LP
  10 .nf
  11 \fBfsdb\fR \fB-F\fR ufs [\fIgeneric_options\fR] [\fIspecific_options\fR] \fIspecial\fR
  12 .fi
  13 
  14 .SH DESCRIPTION
  15 .sp
  16 .LP
  17 The \fBfsdb_ufs\fR command is an interactive tool that can be used to patch up
  18 a damaged \fBUFS\fR file system. It has conversions to translate block and
  19 i-numbers into their corresponding disk addresses. Also included are mnemonic
  20 offsets to access different parts of an inode. These greatly simplify the
  21 process of correcting control block entries or descending the file system tree.
  22 .sp
  23 .LP
  24 \fBfsdb\fR contains several error-checking routines to verify inode and block
  25 addresses. These can be disabled if necessary by invoking \fBfsdb\fR with the
  26 \fB-o\fR option or by the use of the \fBo\fR command.
  27 .sp
  28 .LP
  29 \fBfsdb\fR reads a block at a time and will therefore work with raw as well as
  30 block \fBI/O\fR devices. A buffer management routine is used to retain commonly
  31 used blocks of data in order to reduce the number of read system calls. All
  32 assignment operations result in an immediate write-through of the corresponding
  33 block. Note that in order to modify any portion of the disk, \fBfsdb\fR must be
  34 invoked with the \fBw\fR option.
  35 .sp
  36 .LP
  37 Wherever possible, \fBadb-\fRlike syntax was adopted to promote the use of
  38 \fBfsdb\fR through familiarity.
  39 .SH OPTIONS
  40 .sp
  41 .LP
  42 The following option is supported:
  43 .sp
  44 .ne 2
  45 .na
  46 \fB\fB-o\fR\fR
  47 .ad
  48 .RS 6n
  49 Specify \fBUFS\fR file system specific options. These options can be any
  50 combination of the following separated by commas (with no intervening spaces).
  51 The options available are:
  52 .sp
  53 .ne 2
  54 .na
  55 \fB\fB?\fR\fR
  56 .ad
  57 .RS 14n
  58 Display usage
  59 .RE
  60 
  61 .sp
  62 .ne 2
  63 .na
  64 \fB\fBo\fR\fR
  65 .ad
  66 .RS 14n
  67 Override some error conditions
  68 .RE
  69 
  70 .sp
  71 .ne 2
  72 .na
  73 \fB\fBp='string'\fR\fR
  74 .ad
  75 .RS 14n
  76 set prompt to string
  77 .RE
  78 
  79 .sp
  80 .ne 2
  81 .na
  82 \fB\fBw\fR\fR
  83 .ad
  84 .RS 14n
  85 open for write
  86 .RE
  87 
  88 .RE
  89 
  90 .SH USAGE
  91 .sp
  92 .LP
  93 Numbers are considered hexadecimal by default. However, the user has control
  94 over how data is to be displayed or accepted. The \fBbase\fR command will
  95 display or set the input/output base. Once set, all input will default to this
  96 base and all output will be shown in this base. The base can be overridden
  97 temporarily for input by preceding hexadecimal numbers with \&'\fB0x\fR',
  98 preceding decimal numbers with '\fB0t\fR', or octal numbers with '\fB0\fR'.
  99 Hexadecimal numbers beginning with \fBa-f\fR or \fBA-F\fR must be preceded with
 100 \&'\fB0x\fR' to distinguish them from commands.
 101 .sp
 102 .LP
 103 Disk addressing by \fBfsdb\fR is at the byte level. However, \fBfsdb\fR offers
 104 many commands to convert a desired inode, directory entry, block, superblock
 105 and so forth to a byte address. Once the address has been calculated,
 106 \fBfsdb\fR will record the result in dot (\fB\&.\fR).
 107 .sp
 108 .LP
 109 Several global values are maintained by \fBfsdb\fR:
 110 .RS +4
 111 .TP
 112 .ie t \(bu
 113 .el o
 114 the current base (referred to as \fBbase\fR),
 115 .RE
 116 .RS +4
 117 .TP
 118 .ie t \(bu
 119 .el o
 120 the current address (referred to as \fBdot\fR),
 121 .RE
 122 .RS +4
 123 .TP
 124 .ie t \(bu
 125 .el o
 126 the current inode (referred to as \fBinode\fR),
 127 .RE
 128 .RS +4
 129 .TP
 130 .ie t \(bu
 131 .el o
 132 the current count (referred to as \fBcount\fR),
 133 .RE
 134 .RS +4
 135 .TP
 136 .ie t \(bu
 137 .el o
 138 and the current type (referred to as \fBtype\fR).
 139 .RE
 140 .sp
 141 .LP
 142 Most commands use the preset value of \fBdot\fR in their execution. For
 143 example,
 144 .sp
 145 .LP
 146 \fB> 2:inode\fR
 147 .sp
 148 .LP
 149 will first set the value of \fBdot\fR to 2, ':', will alert the start of a
 150 command, and the \fBinode\fR command will set \fBinode\fR to 2. A count is
 151 specified after a ','. Once set, \fBcount\fR will remain at this value until a
 152 new command is encountered which will then reset the value back to 1 (the
 153 default). So, if
 154 .sp
 155 .LP
 156 \fB> 2000,400/X\fR
 157 .sp
 158 .LP
 159 is typed, 400 hex longs are listed from 2000, and when completed, the value of
 160 \fBdot\fR will be \fB2000 + 400 * sizeof (long)\fR. If a  \fBRETURN\fR is then
 161 typed, the output routine will use the current values of \fBdot\fR,
 162 \fBcount\fR, and \fBtype\fR and display 400 more hex longs. A '*' will cause
 163 the entire block to be displayed.
 164 .sp
 165 .LP
 166 End of fragment, block and file are maintained by \fBfsdb\fR. When displaying
 167 data as fragments or blocks, an error message will be displayed when the end of
 168 fragment or block is reached. When displaying data using the \fBdb\fR,
 169 \fBib\fR, \fBdirectory\fR, or \fBfile\fR commands an error message is displayed
 170 if the end of file is reached. This is mainly needed to avoid passing the end
 171 of a directory or file and getting unknown and unwanted results.
 172 .sp
 173 .LP
 174 An example showing several commands and the use of  \fBRETURN\fR would be:
 175 .sp
 176 .in +2
 177 .nf
 178 \fB> 2:ino; 0:dir?d\fR
 179       or
 180 \fB> 2:ino; 0:db:block?d\fR
 181 .fi
 182 .in -2
 183 .sp
 184 
 185 .sp
 186 .LP
 187 The two examples are synonymous for getting to the first directory entry of the
 188 root of the file system. Once there, any subsequent  \fBRETURN\fR (or +, -)
 189 will advance to subsequent entries. Note that
 190 .sp
 191 .in +2
 192 .nf
 193 \fB> 2:inode; :ls\fR
 194       or
 195 \fB> :ls /\fR
 196 .fi
 197 .in -2
 198 .sp
 199 
 200 .sp
 201 .LP
 202 is again synonymous.
 203 .SS "Expressions"
 204 .sp
 205 .LP
 206 The symbols recognized by \fBfsdb\fR are:
 207 .sp
 208 .ne 2
 209 .na
 210 \fB\fBRETURN\fR\fR
 211 .ad
 212 .RS 13n
 213 update the value of \fBdot\fR by the current value of \fBtype\fR and display
 214 using the current value of \fBcount\fR.
 215 .RE
 216 
 217 .sp
 218 .ne 2
 219 .na
 220 \fB\fB#\fR\fR
 221 .ad
 222 .RS 13n
 223 numeric expressions may be composed of +, -, *, and % operators (evaluated left
 224 to right) and may use parentheses. Once evaluated, the value of \fBdot\fR is
 225 updated.
 226 .RE
 227 
 228 .sp
 229 .ne 2
 230 .na
 231 \fB\fB,\fR\fI count\fR\fR
 232 .ad
 233 .RS 13n
 234 count indicator. The global value of \fBcount\fR will be updated to
 235 \fBcount\fR. The value of \fBcount\fR will remain until a new command is run. A
 236 count specifier of '*' will attempt to show a \fIblocks's\fR worth of
 237 information. The default for \fBcount\fR is 1.
 238 .RE
 239 
 240 .sp
 241 .ne 2
 242 .na
 243 \fB\fB?\fR\fI f\fR\fR
 244 .ad
 245 .RS 13n
 246 display in structured style with format specifier \fIf\fR. See
 247 \fBFormatted\fROutput\fB\&.\fR
 248 .RE
 249 
 250 .sp
 251 .ne 2
 252 .na
 253 \fB\fB/\fR\fI f\fR\fR
 254 .ad
 255 .RS 13n
 256 display in unstructured style with format specifier \fIf\fR See
 257 \fBFormatted\fROutput\fB\&.\fR
 258 .RE
 259 
 260 .sp
 261 .ne 2
 262 .na
 263 \fB\fB\&.\fR\fR
 264 .ad
 265 .RS 13n
 266 the value of \fBdot\fR.
 267 .RE
 268 
 269 .sp
 270 .ne 2
 271 .na
 272 \fB\fB+\fR\fIe\fR\fR
 273 .ad
 274 .RS 13n
 275 increment the value of \fBdot\fR by the expression \fIe.\fR The amount actually
 276 incremented is dependent on the size of \fBtype\fR:
 277 .sp
 278 \fBdot = dot + e * sizeof (type)\fR
 279 .sp
 280 The default for \fIe\fR is \fB1\fR.
 281 .RE
 282 
 283 .sp
 284 .ne 2
 285 .na
 286 \fB\fB-\fR\fIe\fR\fR
 287 .ad
 288 .RS 13n
 289 decrement the value of \fBdot\fR by the expression \fIe\fR. See  \fB+\fR.
 290 .RE
 291 
 292 .sp
 293 .ne 2
 294 .na
 295 \fB\fB*\fR\fIe\fR\fR
 296 .ad
 297 .RS 13n
 298 multiply the value of \fBdot\fR by the expression \fIe.\fR Multiplication and
 299 division don't use \fBtype\fR. In the above calculation of \fBdot\fR, consider
 300 the \fBsizeof(type)\fR to be \fB1\fR.
 301 .RE
 302 
 303 .sp
 304 .ne 2
 305 .na
 306 \fB\fB%\fR\fIe\fR\fR
 307 .ad
 308 .RS 13n
 309 divide the value of \fBdot\fR by the expression \fIe\fR. See  \fB*\fR.
 310 .RE
 311 
 312 .sp
 313 .ne 2
 314 .na
 315 \fB\fB<\fR\fI name\fR\fR
 316 .ad
 317 .RS 13n
 318 restore an address saved in register \fIname\fR. \fIname\fR must be a single
 319 letter or digit.
 320 .RE
 321 
 322 .sp
 323 .ne 2
 324 .na
 325 \fB\fB>\fR\fI name\fR\fR
 326 .ad
 327 .RS 13n
 328 save an address in register \fIname\fR. \fIname\fR must be a single letter or
 329 digit.
 330 .RE
 331 
 332 .sp
 333 .ne 2
 334 .na
 335 \fB\fB=\fR\fI f\fR\fR
 336 .ad
 337 .RS 13n
 338 display indicator. If \fIf\fR is a legitimate format specifier. then the value
 339 of \fBdot\fR is displayed using the format specifier \fIf\fR. See
 340 \fBFormatted\fROutput. Otherwise, assignment is assumed See  \fB=\fR.
 341 .RE
 342 
 343 .sp
 344 .ne 2
 345 .na
 346 \fB\fB= [\fR\fIs\fR\fB] [\fR\fIe\fR\fB]\fR\fR
 347 .ad
 348 .RS 13n
 349 assignment indicator. The address pointed to by \fBdot\fR has its contents
 350 changed to the value of the expression \fIe\fR or to the \fBASCII\fR
 351 representation of the quoted (") string \fIs\fR. This may be useful for
 352 changing directory names or \fBASCII\fR file information.
 353 .RE
 354 
 355 .sp
 356 .ne 2
 357 .na
 358 \fB\fB=+\fR\fI e\fR\fR
 359 .ad
 360 .RS 13n
 361 incremental assignment. The address pointed to by \fBdot\fR has its contents
 362 incremented by expression \fIe\fR.
 363 .RE
 364 
 365 .sp
 366 .ne 2
 367 .na
 368 \fB\fB=-\fR\fI e\fR\fR
 369 .ad
 370 .RS 13n
 371 decremental assignment. The address pointed to by \fBdot\fR has its contents
 372 decremented by expression \fIe\fR.
 373 .RE
 374 
 375 .SS "Commands"
 376 .sp
 377 .LP
 378 A command must be prefixed by a ':' character. Only enough letters of the
 379 command to uniquely distinguish it are needed. Multiple commands may be entered
 380 on one line by separating them by a  \fBSPACE,\fR \fBTAB\fR or ';'.
 381 .sp
 382 .LP
 383 In order to view a potentially unmounted disk in a reasonable manner,
 384 \fBfsdb\fR offers the \fBcd\fR, \fBpwd\fR, \fBls\fR and \fBfind\fR commands.
 385 The functionality of these commands substantially matches those of its UNIX
 386 counterparts. See individual commands for details. The '*', '?', and '[-]' wild
 387 card characters are available.
 388 .sp
 389 .ne 2
 390 .na
 391 \fB\fBbase=b\fR\fR
 392 .ad
 393 .sp .6
 394 .RS 4n
 395 display or set base. As stated above, all input and output is governed by the
 396 current \fBbase\fR. If the  \fB=b\fR is omitted, the current \fBbase\fR is
 397 displayed. Otherwise, the current \fBbase\fR is set to \fIb.\fR Note that this
 398 is interpreted using the old value of \fBbase\fR, so to ensure correctness use
 399 the '0', '0t', or '0x' prefix when changing the \fBbase\fR. The default for
 400 \fBbase\fR is hexadecimal.
 401 .RE
 402 
 403 .sp
 404 .ne 2
 405 .na
 406 \fB\fBblock\fR\fR
 407 .ad
 408 .sp .6
 409 .RS 4n
 410 convert the value of \fBdot\fR to a block address.
 411 .RE
 412 
 413 .sp
 414 .ne 2
 415 .na
 416 \fB\fBcd \fR\fIdir\fR\fR
 417 .ad
 418 .sp .6
 419 .RS 4n
 420 change the current directory to directory \fIdir\fR. The current values of
 421 \fBinode\fR and \fBdot\fR are also updated. If no \fIdir\fR is specified, then
 422 change directories to inode \fB2\fR ("/").
 423 .RE
 424 
 425 .sp
 426 .ne 2
 427 .na
 428 \fB\fBcg\fR\fR
 429 .ad
 430 .sp .6
 431 .RS 4n
 432 convert the value of \fBdot\fR to a cylinder group.
 433 .RE
 434 
 435 .sp
 436 .ne 2
 437 .na
 438 \fB\fBdirectory\fR\fR
 439 .ad
 440 .sp .6
 441 .RS 4n
 442 If the current \fBinode\fR is a directory, then the value of \fBdot\fR is
 443 converted to a directory slot offset in that directory and \fBdot\fR now points
 444 to this entry.
 445 .RE
 446 
 447 .sp
 448 .ne 2
 449 .na
 450 \fB\fBfile\fR\fR
 451 .ad
 452 .sp .6
 453 .RS 4n
 454 the value of \fBdot\fR is taken as a relative block count from the beginning of
 455 the file. The value of \fBdot\fR is updated to the first byte of this block.
 456 .RE
 457 
 458 .sp
 459 .ne 2
 460 .na
 461 \fB\fBfind\fR \fIdir\fR [ \fB-name\fR \fIn\fR] [\fB-inum\fR \fIi\fR]\fR
 462 .ad
 463 .sp .6
 464 .RS 4n
 465 find files by name or i-number. \fBfind\fR recursively searches directory
 466 \fBdir\fR and below for filenames whose i-number matches \fIi\fR or whose name
 467 matches pattern \fIn\fR. Note that only one of the two options (-name or -inum)
 468 may be used at one time. Also, the -print is not needed or accepted.
 469 .RE
 470 
 471 .sp
 472 .ne 2
 473 .na
 474 \fB\fBfill\fR\fI=p\fR\fR
 475 .ad
 476 .sp .6
 477 .RS 4n
 478 fill an area of disk with pattern \fIp\fR. The area of disk is delimited by
 479 \fBdot\fR and \fBcount\fR.
 480 .RE
 481 
 482 .sp
 483 .ne 2
 484 .na
 485 \fB\fBfragment\fR\fR
 486 .ad
 487 .sp .6
 488 .RS 4n
 489 convert the value of \fIdot\fR to a fragment address. The only difference
 490 between the \fBfragment\fR command and the \fBblock\fR command is the amount
 491 that is able to be displayed.
 492 .RE
 493 
 494 .sp
 495 .ne 2
 496 .na
 497 \fB\fBinode\fR\fR
 498 .ad
 499 .sp .6
 500 .RS 4n
 501 convert the value of \fIdot\fR to an inode address. If successful, the current
 502 value of \fBinode\fR will be updated as well as the value of \fIdot\fR. As a
 503 convenient shorthand, if ':inode' appears at the beginning of the line, the
 504 value of \fIdot\fR is set to the current \fBinode\fR and that inode is
 505 displayed in inode format.
 506 .RE
 507 
 508 .sp
 509 .ne 2
 510 .na
 511 \fB\fBlog_chk\fR\fR
 512 .ad
 513 .sp .6
 514 .RS 4n
 515 run through the valid log entries without printing any information and verify
 516 the layout.
 517 .RE
 518 
 519 .sp
 520 .ne 2
 521 .na
 522 \fB\fBlog_delta\fR\fR
 523 .ad
 524 .sp .6
 525 .RS 4n
 526 count the number of deltas into the log, using the value of dot as an offset
 527 into the log. No checking is done to make sure that offset is within the
 528 head/tail offsets.
 529 .RE
 530 
 531 .sp
 532 .ne 2
 533 .na
 534 \fB\fBlog_head\fR\fR
 535 .ad
 536 .sp .6
 537 .RS 4n
 538 display the header information about the file system logging. This shows the
 539 block allocation for the log and the data structures on the disk.
 540 .RE
 541 
 542 .sp
 543 .ne 2
 544 .na
 545 \fB\fBlog_otodb\fR\fR
 546 .ad
 547 .sp .6
 548 .RS 4n
 549 return the physical disk block number, using the value of dot as an offset into
 550 the log.
 551 .RE
 552 
 553 .sp
 554 .ne 2
 555 .na
 556 \fB\fBlog_show\fR\fR
 557 .ad
 558 .sp .6
 559 .RS 4n
 560 display all deltas between  the beginning of the log (BOL) and the end of the
 561 log (EOL).
 562 .RE
 563 
 564 .sp
 565 .ne 2
 566 .na
 567 \fB\fBls\fR\fR
 568 .ad
 569 .sp .6
 570 .RS 4n
 571 [ \fB-R\fR ] [ \fB-l\fR ] \fIpat1 pat2\fR\|.\|.\|. list directories or files.
 572 If no file is specified, the current directory is assumed. Either or both of
 573 the options may be used (but, if used, \fImust\fR be specified before the
 574 filename specifiers). Also, as stated above, wild card characters are available
 575 and multiple arguments may be given. The long listing shows only the i-number
 576 and the name; use the \fBinode\fR command with '?i' to get more information.
 577 .RE
 578 
 579 .sp
 580 .ne 2
 581 .na
 582 \fB\fBoverride\fR\fR
 583 .ad
 584 .sp .6
 585 .RS 4n
 586 toggle the value of override. Some error conditions may be overriden if
 587 override is toggled on.
 588 .RE
 589 
 590 .sp
 591 .ne 2
 592 .na
 593 \fB\fBprompt\fR\fI p\fR\fR
 594 .ad
 595 .sp .6
 596 .RS 4n
 597 change the \fBfsdb\fR prompt to \fIp\fR. \fIp\fR must be surrounded by (")s.
 598 .RE
 599 
 600 .sp
 601 .ne 2
 602 .na
 603 \fB\fBpwd\fR\fR
 604 .ad
 605 .sp .6
 606 .RS 4n
 607 display the current working directory.
 608 .RE
 609 
 610 .sp
 611 .ne 2
 612 .na
 613 \fB\fBquit\fR\fR
 614 .ad
 615 .sp .6
 616 .RS 4n
 617 quit \fBfsdb\fR.
 618 .RE
 619 
 620 .sp
 621 .ne 2
 622 .na
 623 \fB\fBsb\fR\fR
 624 .ad
 625 .sp .6
 626 .RS 4n
 627 the value of \fIdot\fR is taken as a cylinder group number and then converted
 628 to the address of the superblock in that cylinder group. As a shorthand, ':sb'
 629 at the beginning of a line will set the value of \fIdot\fR to \fIthe\fR
 630 superblock and display it in superblock format.
 631 .RE
 632 
 633 .sp
 634 .ne 2
 635 .na
 636 \fB\fBshadow\fR\fR
 637 .ad
 638 .sp .6
 639 .RS 4n
 640 if the current inode is a shadow inode, then the value of \fIdot\fR is set to
 641 the beginning of the shadow inode data.
 642 .RE
 643 
 644 .sp
 645 .ne 2
 646 .na
 647 \fB\fB!\fR\fR
 648 .ad
 649 .sp .6
 650 .RS 4n
 651 escape to shell
 652 .RE
 653 
 654 .SS "Inode Commands"
 655 .sp
 656 .LP
 657 In addition to the above commands, there are several commands that deal with
 658 inode fields and operate directly on the current \fBinode\fR (they still
 659 require the ':'). They may be used to more easily display or change the
 660 particular fields. The value of \fIdot\fR is only used by the '\fB:db\fR'
 661 and '\fB:ib\fR' commands. Upon completion of the command, the value of \fIdot\fR is
 662 changed to point to that particular field. For example,
 663 .sp
 664 .LP
 665 \fB> :ln=+1\fR
 666 .sp
 667 .LP
 668 would increment the link count of the current \fBinode\fR and set the value of
 669 \fIdot\fR to the address of the link count field.
 670 .sp
 671 .ne 2
 672 .na
 673 \fB\fBat\fR\fR
 674 .ad
 675 .RS 7n
 676 access time.
 677 .RE
 678 
 679 .sp
 680 .ne 2
 681 .na
 682 \fB\fBbs\fR\fR
 683 .ad
 684 .RS 7n
 685 block size.
 686 .RE
 687 
 688 .sp
 689 .ne 2
 690 .na
 691 \fB\fBct\fR\fR
 692 .ad
 693 .RS 7n
 694 creation time.
 695 .RE
 696 
 697 .sp
 698 .ne 2
 699 .na
 700 \fB\fBdb\fR\fR
 701 .ad
 702 .RS 7n
 703 use the current value of \fIdot\fR as a direct block index, where direct blocks
 704 number from 0 - 11. In order to display the block itself, you need to 'pipe'
 705 this result into the \fBblock\fR or \fBfragment\fR command. For example,
 706 .sp
 707 .in +2
 708 .nf
 709 \fB     > 1:db:block,20/X\fR
 710 .fi
 711 .in -2
 712 .sp
 713 
 714 would get the contents of data block field 1 from the inode and convert it to a
 715 block address. 20 longs are then displayed in hexadecimal. See
 716 \fBFormatted\fROutput\fB\&.\fR
 717 .RE
 718 
 719 .sp
 720 .ne 2
 721 .na
 722 \fB\fBgid\fR\fR
 723 .ad
 724 .RS 7n
 725 group id.
 726 .RE
 727 
 728 .sp
 729 .ne 2
 730 .na
 731 \fB\fBib\fR\fR
 732 .ad
 733 .RS 7n
 734 use the current value of \fIdot\fR as an indirect block index where indirect
 735 blocks number from 0 - 2. This will only get the indirect block itself (the
 736 block containing the pointers to the actual blocks). Use the \fBfile\fR command
 737 and start at block 12 to get to the actual blocks.
 738 .RE
 739 
 740 .sp
 741 .ne 2
 742 .na
 743 \fB\fBln\fR\fR
 744 .ad
 745 .RS 7n
 746 link count.
 747 .RE
 748 
 749 .sp
 750 .ne 2
 751 .na
 752 \fB\fBmt\fR\fR
 753 .ad
 754 .RS 7n
 755 modification time.
 756 .RE
 757 
 758 .sp
 759 .ne 2
 760 .na
 761 \fB\fBmd\fR\fR
 762 .ad
 763 .RS 7n
 764 mode.
 765 .RE
 766 
 767 .sp
 768 .ne 2
 769 .na
 770 \fB\fBmaj\fR\fR
 771 .ad
 772 .RS 7n
 773 major device number.
 774 .RE
 775 
 776 .sp
 777 .ne 2
 778 .na
 779 \fB\fBmin\fR\fR
 780 .ad
 781 .RS 7n
 782 minor device number.
 783 .RE
 784 
 785 .sp
 786 .ne 2
 787 .na
 788 \fB\fBnm\fR\fR
 789 .ad
 790 .RS 7n
 791 although listed here, this command actually operates on the directory name
 792 field. Once poised at the desired directory entry (using the \fIdirectory\fR
 793 command), this command will allow you to change or display the directory name.
 794 For example,
 795 .sp
 796 \fB> 7:dir:nm="foo"\fR
 797 .sp
 798 will get the \fB7\fRth directory entry of the current \fBinode\fR and change
 799 its name to foo. Note that names cannot be made larger than the field is set up
 800 for. If an attempt is made, the string is truncated to fit and a warning
 801 message to this effect is displayed.
 802 .RE
 803 
 804 .sp
 805 .ne 2
 806 .na
 807 \fB\fBsi\fR\fR
 808 .ad
 809 .RS 7n
 810 shadow inode.
 811 .RE
 812 
 813 .sp
 814 .ne 2
 815 .na
 816 \fB\fBsz\fR\fR
 817 .ad
 818 .RS 7n
 819 file size.
 820 .RE
 821 
 822 .sp
 823 .ne 2
 824 .na
 825 \fB\fBuid\fR\fR
 826 .ad
 827 .RS 7n
 828 user id.
 829 .RE
 830 
 831 .SS "Formatted Output"
 832 .sp
 833 .LP
 834 There are two styles and many format types. The two styles are structured and
 835 unstructured. Structured output is used to display inodes, directories,
 836 superblocks and the like. Unstructured displays raw data. The following shows
 837 the different ways of displaying:
 838 .sp
 839 .ne 2
 840 .na
 841 \fB\fB?\fR\fR
 842 .ad
 843 .RS 5n
 844 .sp
 845 .ne 2
 846 .na
 847 \fB\fBc\fR\fR
 848 .ad
 849 .RS 5n
 850 display as cylinder groups
 851 .RE
 852 
 853 .sp
 854 .ne 2
 855 .na
 856 \fB\fBi\fR\fR
 857 .ad
 858 .RS 5n
 859 display as inodes
 860 .RE
 861 
 862 .sp
 863 .ne 2
 864 .na
 865 \fB\fBd\fR\fR
 866 .ad
 867 .RS 5n
 868 display as directories
 869 .RE
 870 
 871 .sp
 872 .ne 2
 873 .na
 874 \fB\fBs\fR\fR
 875 .ad
 876 .RS 5n
 877 display as superblocks
 878 .RE
 879 
 880 .sp
 881 .ne 2
 882 .na
 883 \fB\fBS\fR\fR
 884 .ad
 885 .RS 5n
 886 display as shadow inode data
 887 .RE
 888 
 889 .RE
 890 
 891 .sp
 892 .ne 2
 893 .na
 894 \fB\fB/\fR\fR
 895 .ad
 896 .RS 5n
 897 .sp
 898 .ne 2
 899 .na
 900 \fB\fBb\fR\fR
 901 .ad
 902 .RS 7n
 903 display as bytes
 904 .RE
 905 
 906 .sp
 907 .ne 2
 908 .na
 909 \fB\fBc\fR\fR
 910 .ad
 911 .RS 7n
 912 display as characters
 913 .RE
 914 
 915 .sp
 916 .ne 2
 917 .na
 918 \fB\fBo O\fR\fR
 919 .ad
 920 .RS 7n
 921 display as octal shorts or longs
 922 .RE
 923 
 924 .sp
 925 .ne 2
 926 .na
 927 \fB\fBd D\fR\fR
 928 .ad
 929 .RS 7n
 930 display as decimal shorts or longs
 931 .RE
 932 
 933 .sp
 934 .ne 2
 935 .na
 936 \fB\fBx X\fR\fR
 937 .ad
 938 .RS 7n
 939 display as hexadecimal shorts or longs
 940 .RE
 941 
 942 The format specifier immediately follows the '/' or '?' character. The values
 943 displayed by '/b' and all '?' formats are displayed in the current \fBbase\fR.
 944 Also, \fBtype\fR is appropriately updated upon completion.
 945 .RE
 946 
 947 .SH EXAMPLES
 948 .LP
 949 \fBExample 1 \fRDisplaying in Decimal
 950 .sp
 951 .LP
 952 The following command displays \fB2010\fR in decimal (use of \fBfsdb\fR as a
 953 calculator for complex arithmetic):
 954 
 955 .sp
 956 .in +2
 957 .nf
 958 > 2000+400%(20+20)=D
 959 .fi
 960 .in -2
 961 .sp
 962 
 963 .LP
 964 \fBExample 2 \fRDisplaying an i-number in Inode Format
 965 .sp
 966 .LP
 967 The following command displays i-number \fB386\fR in an inode format. This now
 968 becomes the current \fBinode\fR:
 969 
 970 .sp
 971 .in +2
 972 .nf
 973 > 386:ino?i
 974 .fi
 975 .in -2
 976 .sp
 977 
 978 .LP
 979 \fBExample 3 \fRChanging the Link Count
 980 .sp
 981 .LP
 982 The following command changes the link count for the current \fBinode\fR to
 983 \fB4\fR:
 984 
 985 .sp
 986 .in +2
 987 .nf
 988 > :ln=4
 989 .fi
 990 .in -2
 991 .sp
 992 
 993 .LP
 994 \fBExample 4 \fRIncrementing the Link Count
 995 .sp
 996 .LP
 997 The following command increments the link count by \fB1\fR:
 998 
 999 .sp
1000 .in +2
1001 .nf
1002 > :ln=+1
1003 .fi
1004 .in -2
1005 .sp
1006 
1007 .LP
1008 \fBExample 5 \fRDisplaying the Creation Time
1009 .sp
1010 .LP
1011 The following command displays the creation time as a hexadecimal long:
1012 
1013 .sp
1014 .in +2
1015 .nf
1016 > :ct=X
1017 .fi
1018 .in -2
1019 .sp
1020 
1021 .LP
1022 \fBExample 6 \fRDisplaying the Modification Time
1023 .sp
1024 .LP
1025 The following command displays the modification time in time format:
1026 
1027 .sp
1028 .in +2
1029 .nf
1030 > :mt=t
1031 .fi
1032 .in -2
1033 .sp
1034 
1035 .LP
1036 \fBExample 7 \fRDisplaying in ASCII
1037 .sp
1038 .LP
1039 The following command displays in \fBASCII,\fR block zero of the file
1040 associated with the current \fBinode\fR:
1041 
1042 .sp
1043 .in +2
1044 .nf
1045 > 0:file/c
1046 .fi
1047 .in -2
1048 .sp
1049 
1050 .LP
1051 \fBExample 8 \fRDisplaying the First Block's Worth of Directorty Entries
1052 .sp
1053 .LP
1054 The following command displays the first block's worth of directory entries for
1055 the root inode of this file system. It will stop prematurely if the \fBEOF\fR
1056 is reached:
1057 
1058 .sp
1059 .in +2
1060 .nf
1061 > 2:ino,*?d
1062 .fi
1063 .in -2
1064 .sp
1065 
1066 .LP
1067 \fBExample 9 \fRDisplaying Changes to the Current Inode
1068 .sp
1069 .LP
1070 The following command displays changes the current inode to that associated
1071 with the \fB5\fRth directory entry (numbered from zero) of the current
1072 \fBinode\fR. The first logical block of the file is then displayed in
1073 \fBASCII\fR:
1074 
1075 .sp
1076 .in +2
1077 .nf
1078 > 5:dir:inode; 0:file,*/c
1079 .fi
1080 .in -2
1081 .sp
1082 
1083 .LP
1084 \fBExample 10 \fRDisplaying the Superblock
1085 .sp
1086 .LP
1087 The following command displays the superblock of this file system:
1088 
1089 .sp
1090 .in +2
1091 .nf
1092 > :sb
1093 .fi
1094 .in -2
1095 .sp
1096 
1097 .LP
1098 \fBExample 11 \fRDisplaying the Cylinder Group
1099 .sp
1100 .LP
1101 The following command displays cylinder group information and summary for
1102 cylinder group \fB1\fR:
1103 
1104 .sp
1105 .in +2
1106 .nf
1107 > 1:cg?c
1108 .fi
1109 .in -2
1110 .sp
1111 
1112 .LP
1113 \fBExample 12 \fRChanging the i-number
1114 .sp
1115 .LP
1116 The following command changes the i-number for the seventh directory slot in
1117 the root directory to \fB3\fR:
1118 
1119 .sp
1120 .in +2
1121 .nf
1122 > 2:inode; 7:dir=3
1123 .fi
1124 .in -2
1125 .sp
1126 
1127 .LP
1128 \fBExample 13 \fRDisplaying as Directory Entries
1129 .sp
1130 .LP
1131 The following command displays the third block of the current \fBinode\fR as
1132 directory entries:
1133 
1134 .sp
1135 .in +2
1136 .nf
1137 > 2:db:block,*?d
1138 .fi
1139 .in -2
1140 .sp
1141 
1142 .LP
1143 \fBExample 14 \fRChanging the Name Field
1144 .sp
1145 .LP
1146 The following command changes the name field in the directory slot to
1147 \fIname\fR:
1148 
1149 .sp
1150 .in +2
1151 .nf
1152 > 7:dir:nm="name"
1153 .fi
1154 .in -2
1155 .sp
1156 
1157 .LP
1158 \fBExample 15 \fRGetting and Filling Elements
1159 .sp
1160 .LP
1161 The following command gets fragment \fB3c3\fR and fill \fB20\fR \fBtype\fR
1162 elements with \fB0x20\fR:
1163 
1164 .sp
1165 .in +2
1166 .nf
1167 > 3c3:fragment,20:fill=0x20
1168 .fi
1169 .in -2
1170 .sp
1171 
1172 .LP
1173 \fBExample 16 \fRSetting the Contents of an Address
1174 .sp
1175 .LP
1176 The following command sets the contents of address \fB2050\fR to
1177 \fB0xffffffff\fR. \fB0xffffffff\fR may be truncated depending on the current
1178 \fBtype\fR:
1179 
1180 .sp
1181 .in +2
1182 .nf
1183 > 2050=0xffff
1184 .fi
1185 .in -2
1186 .sp
1187 
1188 .LP
1189 \fBExample 17 \fRPlacing ASCII
1190 .sp
1191 .LP
1192 The following command places the \fBASCII\fR for the string at \fB1c92434\fR:
1193 
1194 .sp
1195 .in +2
1196 .nf
1197 > 1c92434="this is some text"
1198 .fi
1199 .in -2
1200 .sp
1201 
1202 .LP
1203 \fBExample 18 \fRDisplaying Shadow Inode Data
1204 .sp
1205 .LP
1206 The following command displays all of the shadow inode data in the shadow inode
1207 associated with the root inode of this file system:
1208 
1209 .sp
1210 .in +2
1211 .nf
1212 > 2:ino:si:ino;0:shadow,*?S
1213 .fi
1214 .in -2
1215 .sp
1216 
1217 .SH SEE ALSO
1218 .sp
1219 .LP
1220 \fBclri\fR(1M), \fBfsck_ufs\fR(1M), \fBdir_ufs\fR(4), \fBattributes\fR(5),
1221 \fBufs\fR(7FS)
1222 .SH WARNINGS
1223 .sp
1224 .LP
1225 Since \fBfsdb\fR reads the disk raw, extreme caution is advised in determining
1226 its availability of \fBfsdb\fR on the system. Suggested permissions are 600 and
1227 owned by bin.
1228 .SH NOTES
1229 .sp
1230 .LP
1231 The old command line syntax for clearing i-nodes using the ufs-specific
1232 \fB\&'-z i-number'\fR option is still supported by the new debugger, though it
1233 is obsolete and will be removed in a future release. Use of this flag will
1234 result in correct operation, but an error message will be printed warning of
1235 the impending obsolesence of this option to the command. The equivalent
1236 functionality is available using the more flexible \fBclri\fR(1M) command.