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