|
|
1.1 root 1: .TH FSDB 1M
2: .SH NAME
3: fsdb \- file system debugger
4: .SH SYNOPSIS
5: .B /etc/fsdb
6: .RB [ options ]
7: special
8: .SH OPTIONS
9: The options available to
10: .I fsdb\^
11: are:
12: .RS
13: .PD 0
14: .TP 13
15: .B -?
16: display usage
17: .TP 13
18: .B -o
19: override some error conditions
20: .TP 13
21: .B "-p'string'\^"
22: set prompt to string
23: .TP 13
24: .B -w
25: open for write
26: .PD
27: .RE
28: .SH DESCRIPTION
29: Since
30: .I fsdb
31: reads the disk raw,
32: it is able to circumvent normal
33: file system security.
34: Extreme caution is advised
35: in determining its availability
36: on the system.
37: Suggested permissions are 600
38: and owned by bin.
39: .PP
40: .I Fsdb\^
41: can be used
42: to patch up
43: a damaged file system
44: after a crash.
45: It has conversions
46: to translate block and i-numbers
47: into their corresponding disk addresses.
48: Also included are mnemonic offsets
49: to access different parts
50: of an inode.
51: These greatly simplify the process
52: of correcting control block entries
53: or descending the file system tree.
54: .PP
55: .I Fsdb\^
56: contains several error-checking routines
57: to verify inode and block addresses.
58: These can be disabled if necessary
59: by invoking
60: .I fsdb\^
61: with the
62: .IR \-o
63: option
64: or by the use of the
65: .IR o
66: command.
67: .PP
68: .I Fsdb\^
69: reads a block at a time
70: and will therefore work with raw as well as block
71: I/O.
72: A buffer management routine
73: is used to retain commonly used
74: blocks of data
75: in order to reduce the number of read system calls.
76: All assignment operations result
77: in an immediate write-through
78: of the corresponding block.
79: Note that in order to modify
80: any portion of the disk,
81: .IR fsdb
82: must be invoked with the
83: .IR -w
84: option.
85: .PP
86: Wherever possible,
87: .IR adb- like
88: syntax was adopted
89: to promote the use
90: of
91: .IR fsdb
92: through familiarity.
93: .PP
94: Numbers are considered hexadecimal by default.
95: However, the user has control over how data is
96: to be displayed
97: or accepted.
98: The
99: .IR base
100: command will display
101: or set the input/output base.
102: Once set,
103: all input will default to this base
104: and all output will be shown in this base.
105: The base can be overriden temporarily for input by
106: preceding hexadecimal numbers with '0x', preceding
107: decimal numbers with '0t', or
108: octal numbers with '0'.
109: Hexadecimal numbers beginning with a-f or A-F must
110: be preceded with '0x'
111: to distinguish them from commands.
112: .PP
113: Disk addressing by
114: .IR fsdb
115: is at the byte level.
116: However,
117: .IR fsdb
118: offers many commands to convert
119: a desired inode, directory entry,
120: block, superblock etc. to a
121: byte address.
122: Once the address has been calculated,
123: .IR fsdb
124: will record the result in
125: .IR dot
126: (see next paragraph).
127: .PP
128: Several global values are maintained by
129: .IR fsdb :
130: the current base (referred to as
131: .IR base ),
132: the current address (referred to as
133: .IR dot ),
134: the current inode (referred to as
135: .IR inode ),
136: the current count (referred to as
137: .IR count ),
138: and the current type (referred to as
139: .IR type ).
140: Most commands use the preset value of
141: .IR dot
142: in
143: their execution.
144: For example,
145: .RS
146: .PD 0
147: .TP 7.2n
148: > 2:inode
149: .PD
150: .RE
151: will first set the value of
152: .IR dot
153: to 2, ':' will alert the start of a command,
154: and the
155: .IR inode
156: command will set
157: .IR inode
158: to 2.
159: A count is specified after a ','.
160: Once set,
161: .IR count
162: will remain at this value
163: until a new command is encountered
164: which will then reset the value back to 1 (the default).
165: So, if
166: .RS
167: .PD 0
168: .TP 7.2n
169: > 2000,400/X
170: .PD
171: .RE
172: is typed,
173: 400 hex longs are listed
174: from 2000,
175: and when completed,
176: the value of
177: .IR dot
178: will be 2000 + 400 * sizeof (long).
179: If a carriage-return is then typed,
180: the output routine will use the
181: current values of
182: .IR dot ,
183: .IR count ,
184: and
185: .IR type
186: and display 400 more hex longs.
187: A '*' will cause the entire block to
188: be displayed.
189: .PP
190: End of fragment, block and file are maintained by
191: .IR fsdb.
192: When displaying data as fragments or blocks,
193: an error message will be displayed when the end of fragment
194: or block is reached.
195: When displaying data using the
196: .IR db,
197: .IR ib,
198: .IR directory,
199: or
200: .IR file
201: commands an error message is displayed if the
202: end of file is reached.
203: This is mainly needed
204: to avoid passing the
205: end of a directory or file
206: and getting unknown and unwanted results.
207: .PP
208: An example showing several commands and
209: the use of carriage-return would be:
210: .RS
211: .PD 0
212: .TP 7.2n
213: > 2:ino; 0:dir?d
214: .br
215: or
216: .PD
217: .RE
218: .RS
219: .PD 0
220: .TP 7.2n
221: > 2:ino; 0:db:block?d
222: .PD
223: .RE
224: The two examples are synonymous for getting to the first
225: directory entry of the root of the file system.
226: Once there,
227: subsequent carriage-returns (or +, -) will advance to subsequent
228: entries.
229: Note that
230: .RS
231: .PD 0
232: .TP 7.2n
233: > 2:inode; :ls
234: .br
235: or
236: .PD
237: .RE
238: .RS
239: .PD 0
240: .TP 7.2n
241: > :ls /
242: .PD
243: .RE
244: is again synonymous.
245: .SH EXPRESSIONS
246: .PP
247: The symbols recognized by
248: .I fsdb\^
249: are:
250: .TP 7.2n
251: .B carriage-return
252: update the value of
253: .IR dot
254: by the current value of
255: .IR type
256: and display using the current value of
257: .IR count .
258: .TP 7.2n
259: .B #
260: numeric expressions may be composed of +, -, *, and % operators
261: (evaluated left to right) and may use parentheses. Once evaluated,
262: the value of
263: .IR dot
264: is updated.
265: .TP 7.2n
266: .BI , " count"\^
267: count indicator. The global value of
268: .IR count
269: will be updated to
270: .IR count .
271: The value of
272: .IR count
273: will remain until a new command is run.
274: A count specifier of '*' will attempt to show a
275: .IR blocks's
276: worth of information.
277: The default for
278: .IR count
279: is 1.
280: .TP 7.2n
281: .BI ? " f\^"
282: display in structured style with format
283: specifier
284: .IR f
285: (see FORMATTED OUTPUT section).
286: .TP 7.2n
287: .BI / " f\^"
288: display in unstructured style with format
289: specifier
290: .IR f
291: (see FORMATTED OUTPUT section).
292: .TP 7.2n
293: .B .
294: the value of
295: .IR dot .
296: .TP 7.2n
297: .BI + "e\^"
298: increment the value of
299: .IR dot
300: by the expression
301: .IR e.
302: The amount actually incremented is dependent
303: on the size of
304: .IR type :
305: .br
306: .nf
307: dot = dot + e * sizeof (type)
308: .fi
309: The default for
310: .IR e
311: is 1.
312: .TP 7.2n
313: .BI - "e\^"
314: decrement the value of
315: .IR dot
316: by the expression
317: .IR e
318: (see +).
319: .TP 7.2n
320: .BI * "e\^"
321: multiply the value of
322: .IR dot
323: by the expression
324: .IR e.
325: Multiplication and division don't
326: use
327: .IR type.
328: In the above calculation of
329: .IR dot ,
330: consider the
331: sizeof (
332: .IR type )
333: to be 1.
334: .TP 7.2n
335: .BI % "e\^"
336: divide the value of
337: .IR dot
338: by the expression
339: .IR e
340: (see *).
341: .TP 7.2n
342: .BI < " name\^"
343: restore an address saved in register
344: .IR name .
345: .IR name
346: must be a single letter or digit.
347: .TP 7.2n
348: .BI > " name\^"
349: save an address in register
350: .IR name .
351: .IR name
352: must be a single letter or digit.
353: .TP 7.2n
354: .BI = " f"
355: display indicator.
356: If
357: .IR f
358: is a legitimate format specifier
359: (see FORMATTED OUTPUT
360: section),
361: then the value of
362: .IR dot
363: is displayed using
364: format specifier
365: .IR f .
366: Otherwise,
367: assignment is assumed
368: (see next item).
369: .TP 7.2n
370: .BI = " [s] [e]\^"
371: assignment indicator.
372: The address pointed to by
373: .IR dot
374: has its contents changed to the value of the
375: expression
376: .IR e
377: or to the
378: .IR ASCII
379: representation of the
380: quoted (") string
381: .IR s.
382: This may be useful for changing
383: directory names or
384: .IR ASCII
385: file information.
386: .TP 7.2n
387: .BI =+ " e\^"
388: incremental assignment.
389: The address pointed to by
390: .IR dot
391: has its contents incremented by expression
392: .IR e .
393: .TP 7.2n
394: .BI =- " e\^"
395: decremental assignment.
396: The address pointed to by
397: .IR dot
398: has its contents decremented by expression
399: .IR e .
400: .SH COMMANDS
401: .PP
402: A command must be prefixed by a ':' character.
403: Only enough letters of the command
404: to uniquely
405: distinguish it are needed.
406: Multiple commands may be entered
407: on one line by separating
408: them by a space, tab or ';'.
409: .PP
410: In order to view a potentially
411: unmounted disk in a reasonable
412: manner,
413: .I fsdb\^
414: offers the
415: .IR cd ,
416: .IR pwd ,
417: .IR ls
418: and
419: .IR find
420: commands.
421: The functionality of these
422: commands substantially matches those of
423: its
424: .IR UNIX
425: counterparts
426: (see individual command for details).
427: The '*', '?', and '[-]' wild card
428: characters are available.
429: .TP 7.2n
430: .BI base=b
431: display or set base. As stated above,
432: all input and output is governed by
433: the current
434: .IR base .
435: If the '=b' is left off,
436: the current
437: .IR base
438: is displayed.
439: Otherwise, the current
440: .IR base
441: is set
442: to
443: .IR b.
444: Note that this is interpreted
445: using the old value of
446: .IR base ,
447: so to ensure correctness use the '0', '0t', or '0x'
448: prefix when changing the
449: .IR base.
450: The default for
451: .IR base
452: is hexadecimal.
453: .TP 7.2n
454: .B block
455: convert the value of
456: .IR dot
457: to a block address.
458: .TP 7.2n
459: .B cd dir
460: change the current directory
461: to directory
462: .IR dir.
463: The current values of
464: .IR inode
465: and
466: .IR dot
467: are also updated.
468: If no
469: .IR dir
470: is specified,
471: then change directories to
472: inode 2 ("/").
473: .TP 7.2n
474: .B cg
475: convert the value of
476: .IR dot
477: to a cylinder group.
478: .TP 7.2n
479: .B directory
480: If the current
481: .IR inode
482: is a directory,
483: then the value of
484: .IR dot
485: is converted to a directory
486: slot offset in that directory
487: and
488: .IR dot
489: now points to
490: this entry.
491: .TP 7.2n
492: .B file
493: the value of
494: .IR dot
495: is taken as
496: a relative block count from the
497: beginning of the file.
498: The value of
499: .IR dot
500: is updated to the first byte
501: of this block.
502: .IR
503: .TP 7.2n
504: .BI find " dir [-name n] [-inum i]\^"
505: find files by name or i-number.
506: .IR find
507: recursively searches
508: directory
509: .IR dir
510: and below for filenames whose
511: i-number matches
512: .IR i
513: or whose name
514: matches pattern
515: .IR n .
516: Note that only one of the two options
517: (-name or -inum)
518: may be used at one time.
519: Also, the -print is not needed or
520: accepted.
521: .TP 7.2n
522: .BI fill "=p\^"
523: fill an area of disk with pattern
524: .IR p.
525: The area of disk
526: is delimited by
527: .IR dot
528: and
529: .IR count .
530: .TP 7.2n
531: .B fragment
532: convert the value of
533: .IR dot
534: to
535: a fragment address.
536: The only difference between the
537: .IR fragment
538: command and the
539: .IR block
540: command is the amount that
541: is able to be displayed.
542: .TP 7.2n
543: .B inode
544: convert the value of
545: .IR dot
546: to an inode address.
547: If successful,
548: the current value of
549: .IR inode
550: will be updated as well as
551: the value of
552: .IR dot.
553: As a convenient shorthand,
554: if ':inode' appears at the
555: beginning of the line,
556: the value of
557: .IR dot
558: is set to the current
559: .IR inode
560: and that inode is displayed
561: in inode format.
562: .TP 7.2n
563: .BI ls " [-R] [-l] pat1 pat2 ...\^"
564: list directories or files.
565: If no file is specified,
566: the current directory is assumed.
567: Either or both of the
568: options may be used (but, if used,
569: .IR must
570: be specified before the
571: filename specifiers).
572: Also, as stated above,
573: wild card characters are
574: available and multiple
575: arguments may be given.
576: The long listing shows only
577: the i-number and the name;
578: use the
579: .IR inode
580: command with '?i'
581: to get more information.
582: .TP 7.2n
583: .B override
584: toggle the value of override.
585: Some error conditions may be
586: overriden
587: if override is toggled on.
588: .TP 7.2n
589: .BI prompt " p\^"
590: change the fsdb prompt to
591: .IR p.
592: .IR p
593: must be surrounded by (")s.
594: .TP 7.2n
595: .B pwd
596: display the current working directory.
597: .TP 7.2n
598: .B quit
599: quit
600: .IR fsdb .
601: .TP 7.2n
602: .B sb
603: the value of
604: .IR dot
605: is taken as a cylinder group
606: number and then converted to
607: the address of the superblock
608: in that cylinder group.
609: As a shorthand, ':sb' at
610: the beginning of a line
611: will set the value of
612: .IR dot
613: to
614: .IR the
615: superblock and display it
616: in superblock format.
617: .TP 7.2n
618: .B !
619: escape to shell
620: .SH INODE COMMANDS
621: In addition to the above commands,
622: there are several commands that deal with inode
623: fields and operate directly on the current
624: .IR inode
625: (they still require the ':').
626: They may be used to more easily display
627: or change the particular fields.
628: The value of
629: .IR dot
630: is only used by the ':db'
631: and ':ib' commands.
632: Upon completion of the command,
633: the value of
634: .IR dot
635: is changed to point to
636: that particular field.
637: For example,
638: .RS
639: .PD 0
640: .TP 7.2n
641: > :ln=+1
642: .PD
643: .RE
644: would
645: increment the link count of the current
646: .IR inode
647: and set the value of
648: .IR dot
649: to the address of the link
650: count field.
651: .TP 7.2n
652: .B at
653: access time.
654: .TP 7.2n
655: .B bs
656: block size.
657: .TP 7.2n
658: .B ct
659: creation time.
660: .TP 7.2n
661: .B db
662: use the current value of
663: .IR dot
664: as a direct block index,
665: where direct blocks number from
666: 0 - 11.
667: In order to display the block
668: itself, you need to 'pipe' this
669: result into the
670: .IR block
671: or
672: .IR fragment
673: command.
674: For example,
675: .br
676: .nf
677: > 1:db:block,20/X
678: .fi
679: would get the contents of
680: data block field 1 from the inode and
681: convert it to a block address.
682: 20 longs are then displayed in hexadecimal
683: (see FORMATTED OUTPUT section).
684: .TP 7.2n
685: .B gid
686: group id.
687: .TP 7.2n
688: .B ib
689: use the current value of
690: .IR dot
691: as an indirect block index
692: where indirect blocks number from
693: 0 - 2.
694: This will only get the indirect block itself
695: (the block containing the pointers to the actual blocks).
696: Use the
697: .IR file
698: command and start at block 12 to get to the actual
699: blocks.
700: .TP 7.2n
701: .B ln
702: link count.
703: .TP 7.2n
704: .B mt
705: modification time.
706: .TP 7.2n
707: .B md
708: mode.
709: .TP 7.2n
710: .B maj
711: major device number.
712: .TP 7.2n
713: .B min
714: minor device number.
715: .TP 7.2n
716: .B nm
717: although listed here,
718: this command actually
719: operates on the directory
720: name field.
721: Once poised at the desired
722: directory entry (using the
723: .IR directory
724: command),
725: this command will allow
726: you to change or display
727: the directory name.
728: For example,
729: .br
730: .nf
731: > 7:dir:nm="foo"
732: .fi
733: will get the 7th directory
734: entry of the current
735: .IR inode
736: and change its name to foo.
737: Note that names
738: cannot be made larger than the
739: field is set up for.
740: If an attempt is made,
741: the string is truncated to fit
742: and a warning message to this
743: effect is displayed.
744: .TP 7.2n
745: .B sz
746: file size.
747: .TP 7.2n
748: .B uid
749: user id.
750: .SH FORMATTED OUTPUT
751: .PP
752: There are two styles
753: and many format types.
754: The two styles are structured and
755: unstructured.
756: Structured output is used to display
757: inodes, directories, superblocks and the
758: like.
759: Unstructured just displays
760: raw data.
761: The following table shows the
762: different ways of displaying:
763: .TP 7.2n
764: .B ?
765: .RS
766: .PD 0
767: .TP 13
768: .B c
769: display as cylinder groups
770: .TP 13
771: .B i
772: display as inodes
773: .TP 13
774: .B d
775: display as directories
776: .TP 13
777: .B s
778: display as superblocks
779: .PD
780: .RE
781: .TP 7.2n
782: .B /
783: .RS
784: .PD 0
785: .TP 13
786: .B b
787: display as bytes
788: .TP 13
789: .B c
790: display as characters
791: .TP 13
792: .B o O
793: display as octal shorts or longs
794: .TP 13
795: .B d D
796: display as decimal shorts or longs
797: .TP 13
798: .B x X
799: display as hexadecimal shorts or longs
800: .PD
801: .RE
802: .PP
803: The format specifier immediately follows
804: the '/' or '?' character.
805: The values displayed by '/b' and all '?'
806: formats are displayed in the current
807: .IR base .
808: Also,
809: .IR type
810: is appropriately updated
811: upon completion.
812: .SH EXAMPLES
813: .TP 16
814: > 2000+400%(20+20)=D
815: will display 2010 in decimal (use of
816: .IR fsdb
817: as a calculator
818: for complex arithmetic).
819: .TP 16
820: > 386:ino?i
821: display i-number 386 in an inode format.
822: This now becomes the current
823: .IR inode .
824: .TP 16
825: > :ln=4
826: changes the link count for the
827: current
828: .IR inode
829: to 4.
830: .TP 16
831: > :ln=+1
832: increments the link count by 1.
833: .TP 16
834: > :ct=X
835: display the creation time as a hexadecimal long.
836: .TP 16
837: > :mt=t
838: display the modification time in time format.
839: .TP 16
840: > 0:file/c
841: displays, in
842: .IR ASCII ,
843: block zero of the file associated
844: with the
845: current
846: .IR inode .
847: .TP 16
848: > 2:ino,*?d
849: displays the first blocks worth of directory entries for
850: the root inode of this file system.
851: It will stop prematurely if the eof is reached.
852: .TP 16
853: > 5:dir:inode; 0:file,*/c
854: changes the current inode to that
855: associated with the 5th directory entry
856: (numbered from zero)
857: of the current
858: .IR inode.
859: The first logical block of the file
860: is then displayed in
861: .IR ASCII .
862: .TP 16
863: > :sb
864: displays the superblock of this file system.
865: .TP 16
866: > 1:cg?c
867: displays cylinder group information and summary
868: for cylinder group 1.
869: .TP 16
870: > 2:inode; 7:dir=3
871: changes the i-number for the
872: seventh directory slot in the root directory to 3.
873: .TP 16
874: > 7:dir:nm="name"
875: changes the name field
876: in the directory slot to
877: .IR name .
878: .TP 16
879: > 2:db:block,*?d
880: displays the third block of the current
881: .IR inode
882: as directory entries.
883: .TP 16
884: > 3c3:fragment,20:fill=0x20
885: get fragment 3c3 and fill 20
886: .IR type
887: elements
888: with 0x20.
889: .TP 16
890: > 2050=0xffff
891: set the contents of address 2050 to 0xffffffff.
892: 0xffffffff may be truncated depending on the current
893: .IR type.
894: .TP 16
895: > 1c92434="this is some text"
896: will place the
897: .IR ASCII
898: for the string at
899: 1c92434.
900: .SH SEE ALSO
901: fsck(1M), dir(4), fs(4).
902: .SH BUGS
903: .PP
904: Extreme caution is advised in
905: determining the availability
906: of
907: .IR fsdb
908: on the system.
909: Suggested permissions are 600 and
910: owned by bin.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.