1fsdb_udfs(1M)           System Administration Commands           fsdb_udfs(1M)
2
3
4

NAME

6       fsdb_udfs - udfs file system debugger
7

SYNOPSIS

9       fsdb  [-F] udfs [generic_option] [-o specific_option] special
10
11

DESCRIPTION

13       The  fsdb_udfs command is an interactive tool that can be used to patch
14       up a damaged udfs file system. fsdb_udfs has conversions  to  translate
15       block  and  i-numbers into their corresponding disk addresses. Mnemonic
16       offsets to access different  parts  of  an  inode  are  also  included.
17       Mnemonic  offsets  greatly  simplify  the process of correcting control
18       block entries or descending the file system tree.
19
20
21       fsdb contains several error-checking routines to verify inode and block
22       addresses. These can be disabled if necessary by invoking fsdb with the
23       -o option or by using the o command.
24
25
26       fsdb reads one block at a time, and therefore works with raw as well as
27       block  I/O  devices. A buffer management routine is used to retain com‐
28       monly used blocks of data in order to reduce the number of read  system
29       calls.  All  assignment operations result in an immediate write-through
30       of the corresponding block. In order to modify any portion of the disk,
31       fsdb must be invoked with the -w option.
32
33
34       Wherever  possible, adb-like syntax has been adopted to promote the use
35       of fsdb through familiarity.
36

OPTIONS

38       The following options are supported:
39
40       -o specific_option    Specify udfs file system specific  options  in  a
41                             comma-separated  list with no intervening spaces.
42                             The following specific options are supported:
43
44                             o           Override some error conditions.
45
46
47                             p=string    Set prompt to string.
48
49
50                             w           Open for write.
51
52
53                             ?           Display usage.
54
55
56

USAGE

58       Numbers are considered hexadecimal by default.  The  user  has  control
59       over how data is to be displayed or accepted. The base command displays
60       or sets the input and output base. Once set, all input defaults to this
61       base  and  all  output displays in this base. The base can be overriden
62       temporarily for input by preceding hexadecimal numbers by 0x, preceding
63       decimal  numbers with a 0t, or octal numbers with a 0. Hexadecimal num‐
64       bers beginning with a-f or A -F must be preceded with a 0x  to  distin‐
65       guish them from commands.
66
67
68       Disk addressing by fsdb is at the byte level. However, fsdb offers many
69       commands to convert a desired inode, directory  entry,  block,  and  so
70       forth,  to  a byte address. After the address has been calculated, fsdb
71       records the result in the current address (dot).
72
73
74       Several global values are maintained by fsdb:
75
76           o      Current base (referred to as base)
77
78           o      Current address (referred to as dot)
79
80           o      Current inode (referred to as inode)
81
82           o      Current count (referred to as count)
83
84           o      Current type (referred to as type)
85
86
87       Most commands use the preset value of dot in their execution. For exam‐
88       ple,
89
90          > 2:inode
91
92
93
94
95       first sets the value of dot (.) to 2, colon (:), signifies the start of
96       a command, and the inode command sets inode to 2. A count is  specified
97       after  a  comma  (,). Once set, count remains at this value until a new
98       command is encountered that resets the value back to 1 (the default).
99
100
101       So, if
102
103         > 2000,400/X
104
105
106
107
108       is entered, 400 hex longs are listed from 2000, and when completed, the
109       value  of  dot  is   2000  +  400  * sizeof (long). If a RETURN is then
110       entered, the output routine uses the current values of dot, count,  and
111       type and displays 400 more hex longs. An asterisk (*) causes the entire
112       block to be displayed. An example showing several commands and the  use
113       of RETURN would be:
114
115         > 2:ino; 0:dir?d
116
117
118
119
120       or
121
122         > 2:ino; 0:db:block?d
123
124
125
126
127       The  two  examples  are  synonymous  for getting to the first directory
128       entry of the root of the file system. Once there, subsequently entering
129       a  RETURN,  plus  (+),  or  minus  (-)  advances to subsequent entries.
130       Notice that
131
132         > 2:inode; :ls
133
134
135
136
137       or
138
139         > :ls /
140
141
142
143
144       is again synonymous.
145
146   Expressions
147       The following symbols are recognized by fsdb:
148
149       RETURN       Update the value of dot by the current value of  type  and
150                    display using the current value of count.
151
152
153       #            Update  the  value  of dot by specifying a numeric expres‐
154                    sion. Specify numeric expressions using addition, subtrac‐
155                    tion,  mulitiplication,  and division operators ( +, -, *,
156                    and %). Numeric expressions are  evaluated  from  left  to
157                    right and can use parentheses. After evaluation, the value
158                    of dot is updated.
159
160
161       , count      Update the count indicator. The global value of  count  is
162                    updated  to  count. The value of count remains until a new
163                    command is run. A count specifier of * attempts to show  a
164                    blocks's worth of information. The default for count is 1.
165
166
167       ?  f         Display  in  structured style with format specifier f. See
168                    Formatted Output.
169
170
171       / f          Display in unstructured style with format specifier f. See
172                    Formatted Output.
173
174
175       .            Display the value of dot.
176
177
178       +e           Increment the value of dot by the expression e. The amount
179                    actually incremented is dependent on the size of type: dot
180                    = dot + e * sizeof (type) The default for e is 1.
181
182
183       e           Decrement the value of dot by the expression e . See +.
184
185
186       *e           Multiply the value of dot by the expression e. Multiplica‐
187                    tion and division don't use type. In the above calculation
188                    of dot, consider the sizeof (type) to be 1.
189
190
191       %e           Divide the value of dot by the expression e. See *.
192
193
194       < name       Restore  an address saved in register name. name must be a
195                    single letter or digit.
196
197
198       > name       Save an address in register name. name must  be  a  single
199                    letter or digit.
200
201
202       = f          Display  indicator.  If f is a legitimate format specifier
203                    (see Formatted Output), then the value of dot is displayed
204                    using   format   specifier  f.  Otherwise,  assignment  is
205                    assumed. See = [s] [e].
206
207
208       = [s] [e]    Change the value of dot using an assignment indicator. The
209                    address  pointed to by dot has its contents changed to the
210                    value of the expression e or to the  ASCII  representation
211                    of  the quoted (") string s. This can be useful for chang‐
212                    ing directory names or ASCII file information.
213
214
215       =+ e         Change the value of dot using an  incremental  assignment.
216                    The address pointed to by dot has its contents incremented
217                    by expression e.
218
219
220       =- e         Change the value of dot using  a  decremental  assignment.
221                    Decrement the contents of the address pointed to by dot by
222                    expression e.
223
224
225   Commands
226       A command must be prefixed by a colon (:). Only enough letters  of  the
227       command to uniquely distinguish it are needed. Multiple commands can be
228       entered on one line by  separating them by a SPACE, TAB,  or  semicolon
229       (;).
230
231
232       To  view a potentially unmounted disk in a reasonable manner, fsdb sup‐
233       ports the cd, pwd, ls, and find commands. The functionality of each  of
234       these  commands  basically  matches  that  of its UNIX counterpart. See
235       cd(1), pwd(1),ls(1), andfind(1) for details. The *, ,, ?, and  -  wild‐
236       card characters are also supported.
237
238
239       The following commands are supported:
240
241       base[=b]
242
243           Display  or  set  the base. All input and output is governed by the
244           current base. Without the = b, displays the  current  base.  Other‐
245           wise, sets the current base to b. Base is interpreted using the old
246           value of base, so to ensure correctness use the 0, 0t, or 0x prefix
247           when changing the base. The default for base is hexadecimal.
248
249
250       block
251
252           Convert the value of dot to a block address.
253
254
255       cd [dir]
256
257           Change  the current directory to directory  dir. The current values
258           of inode and dot are also updated. If dir is not specified, changes
259           directories to inode 2, root (/).
260
261
262       directory
263
264           If the current inode is a directory, converts the value of dot to a
265           directory slot offset in that directory, and dot now points to this
266           entry.
267
268
269       file
270
271           Set  the  value of dot as a relative block count from the beginning
272           of the file. The value of dot is updated to the first byte of  this
273           block.
274
275
276       find dir [-name n] | [-inum i]
277
278           Find  files by name or i-number. Recursively searches directory dir
279           and below for file names whose i-number matches  i  or  whose  name
280           matches pattern n. Only one of the two options (-name or -inum) can
281           be used at one time. The find -print is not necessary or accepted.
282
283
284       fill=p
285
286           Fill an area of disk with pattern p. The area of disk is  delimited
287           by dot and count.
288
289
290       inode
291
292           Convert  the  value  of dot to an inode address. If successful, the
293           current value of inode is updated as well as the value of dot. As a
294           convenient  shorthand,  if  :inode  appears at the beginning of the
295           line, the value of dot is set to the current inode and  that  inode
296           is displayed in inode format.
297
298
299       ls [ -R ] [-l ] pat1 pat2...
300
301           List  directories  or  files.  If no file is specified, the current
302           directory is assumed. Either or both of the  options  can  be  used
303           (but,  if  used, must be specified before the filename specifiers).
304           Wild card characters  are  available  and  multiple  arguments  are
305           acceptable.  The long listing shows only the i-number and the name;
306           use the inode command with ?i to get more information.
307
308
309       override
310
311           Toggle the value of override. Some error conditions might be  over‐
312           ridden if override is toggled to on.
313
314
315       prompt "p"
316
317           Change the fsdb prompt to p. p must be enclosed in quotes.
318
319
320       pwd
321
322           Display the current working directory.
323
324
325       quit
326
327           Quit fsdb.
328
329
330       tag
331
332           Convert the value of dot and if this is a valid tag, print the vol‐
333           ume structure according to the tag.
334
335
336       !
337
338           Escape to the shell.
339
340
341   Inode Commands
342       In addition to the above commands, several  other  commands  deal  with
343       inode  fields  and  operate  directly  on the current inode (they still
344       require the colon (:). They can be  used  to  more  easily  display  or
345       change  the particular fields. The value of dot is only used by the :db
346       and :ib commands. Upon completion of the command, the value of  dot  is
347       changed so that it points to that particular field. For example,
348
349         > :ln=+1
350
351
352
353
354       increments  the  link  count of the current inode and sets the value of
355       dot to the address of the link count field.
356
357
358       The following inode commands are supported:
359
360       at      Access time
361
362
363       bs      Block size
364
365
366       ct      Creation time
367
368
369       gid     Group id
370
371
372       ln      Link number
373
374
375       mt      Modification time
376
377
378       md      Mode
379
380
381       maj     Major device number
382
383
384       min     Minor device number
385
386
387       nm      This command actually operates on  the  directory  name  field.
388               Once       poised  at  the  desired  directory entry (using the
389               directory command), this command allows you to change  or  dis‐
390               play the directory name. For example,
391
392                  > 7:dir:nm="foo"
393
394
395               gets  the  7th directory entry of the current inode and changes
396               its name to foo. Directory names cannot be made larger than the
397               field  allows.  If  an attempt is made to make a directory name
398               larger than the field allows,, the string is truncated  to  fit
399               and a warning message is displayed.
400
401
402       sz      File size
403
404
405       uid     User ID
406
407
408       uniq    Unique ID
409
410
411   Formatted Output
412       Formatted  output  comes  in  two styles and many format types. The two
413       styles of formatted output are: structured and unstructured. Structured
414       output  is  used to display inodes, directories, and so forth. Unstruc‐
415       tured output displays raw data.
416
417
418       Format specifiers are preceded by the slash (/) or  question  mark  (?)
419       character. type is updated as necessary upon completion.
420
421
422       The following format specifiers are preceded by the ? character:
423
424       i    Display as inodes in the current base.
425
426
427       d    Display as directories in the current base.
428
429
430
431       The following format specifiers are preceded by the / character:
432
433       b        Display as bytes in the current base.
434
435
436       c        Display as characters.
437
438
439       o | O    Display as octal shorts or longs.
440
441
442       d | D    Display as decimal shorts or longs.
443
444
445       x | X    Display as hexadecimal shorts or longs.
446
447

EXAMPLES

449       Example 1 Using fsdb as a calculator for complex arithmetic
450
451
452       The  following command displays 2010 in decimal format, and is an exam‐
453       ple of using fsdb as a calculator for complex arithmetic.
454
455
456         > 2000+400%(20+20)=D
457
458
459
460       Example 2 Using fsdb to display an i-number in idode fomat
461
462
463       The following command displays the i-number  386  in  inode  format.386
464       becomes the current inode.
465
466
467         > 386:ino?i
468
469
470
471       Example 3 Using fsdb to change the link count
472
473
474       The  following  command changes the link count for the current inode to
475       4.
476
477
478         > :ln=4
479
480
481
482       Example 4 Using fsdb to increment the link count
483
484
485       The following command increments the link count by 1.
486
487
488         > :ln=+1
489
490
491
492       Example 5 Using fsdb to display the creation time as a hexadecimal long
493
494
495       The following command displays the creation time as a hexadecimal long.
496
497
498         > :ct=X
499
500
501
502       Example 6 Using fsdb to display the modification time in time format
503
504
505       The following command displays the modification time in time format.
506
507
508         > :mt=t
509
510
511
512       Example 7 Using fsdb to display in ASCII
513
514
515       The following command displays, in ASCII, block 0 of the  file  associ‐
516       ated with the current inode.
517
518
519         > 0:file/c
520
521
522
523       Example  8  Using  fsdb  to display the directory enteries for the root
524       inode
525
526
527       The following command displays the first block's directory entries  for
528       the  root  inode of this file system. This command stops prematurely if
529       the EOF is reached.
530
531
532         > 2:ino,*?d
533
534
535
536       Example 9 Using fsdb to change the current inode
537
538
539        The following command changes the current  inode  to  that  associated
540       with  the  5th  directory entry (numbered from 0) of the current inode.
541       The first logical block of the file is then displayed in ASCII.
542
543
544         > 5:dir:inode; 0:file,*/c
545
546
547
548       Example 10 Using fsdb to change the i-number
549
550
551        The following command changes the i-number for the 7th directory  slot
552       in the root directory to 3.
553
554
555         > 2:inode; 7:dir=3
556
557
558
559       Example 11 Using fsdb to change the name field
560
561
562       The  following  command changes the name field in the directory slot to
563       name.
564
565
566          > 7:dir:nm="name"
567
568
569
570       Example 12 Using fsdb to display the a block
571
572
573       The following command displays the 3rd block of the  current  inode  as
574       directory entries.
575
576
577       Example 13 Using fsdb to set the contents of address
578
579
580       The  following command sets the contents of address 2050 to 0xffffffff.
581       0xffffffff can be truncated, depending on the current type.
582
583
584         > 2050=0xffff
585
586
587
588       Example 14 Using fsdb to place an ASCII string at an address
589
590
591       The following command places the ASCII string  this  is  some  text  at
592       address 1c92434.
593
594
595         > 1c92434="this is some text"
596
597
598

ATTRIBUTES

600       See attributes(5) for descriptions of the following attributes:
601
602
603
604
605       ┌─────────────────────────────┬─────────────────────────────┐
606       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
607       ├─────────────────────────────┼─────────────────────────────┤
608       │Availability                 │SUNWudf                      │
609       └─────────────────────────────┴─────────────────────────────┘
610

SEE ALSO

612       clri(1M), fsck_udfs(1M), dir(4),  attributes(5)
613
614
615
616SunOS 5.11                        11 Jun 1999                    fsdb_udfs(1M)
Impressum