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