debugvmfs(8)
============

NAME
----
debugvmfs - VMFS file system debugger


SYNOPSIS
--------
*debugvmfs* 'VOLUME'... 'COMMAND' [ 'OPTIONS' ]


DESCRIPTION
-----------
The *debugvmfs* program allows to display various informations about VMFS
file systems, and to access data within the file systems.

The 'VOLUME' to be opened can be either a block device or an image file.
When the VMFS spreads accross several extents, all extents must be given.

Please note that most commands are still likely to change in future versions.

COMMANDS
--------
*cat* 'file' [ ... ]::
Outputs the content of the given files from the VMFS.

*ls* [ *-l* ] 'path'::
Lists files contained at the given location within the VMFS.
+
With *-l*, gives some more information, much like the output from *ls*(1)
when given the *-l* option.

*truncate* 'path' 'length'::
Truncate the file to the specified length. R/W support must be enabled.

*df*::
Outputs information about file system size.

*show_file_blocks* 'file'::
Outputs block_ids for the given file's content blocks.

*get_file_block* 'file' 'position'::
Get file block corresponding to position in the specified file.

*check_file_blocks* 'file'::
Check that all blocks used by a file are correctly allocated.

*check_vol_bitmaps*::
Checks volume bitmaps consistency.

*show_heartbeats*::
Outputs active heartbeats on the file system.

*read_block* 'block_id' [ ... ]::
Outputs content within the specified block_id in binary

*dump_block* 'block_id' [ ... ]::
Outputs content within the specified block_id in hex

*get_block_status* 'block_id'::
Get status (allocated or free) of the specified block_id.

*alloc_block_fixed* 'block_id'::
Allocate the specified block_id. R/W support must be enabled.

*alloc_block* 'block_type'::
Allocate a block of the specified type. R/W support must be enabled.
+
Allowed block types are: 1 (File Block), 2 (Sub-Block), 3 (Pointer Block) 
and 4 (File Descriptor / Inode).

*free_block* 'block_id'::
Free the specified block_id. R/W support must be enabled.
+
Warning: can cause damage since no heartbeat is used at this time and a block
used by a file can be freed.

*show_bitmap_item* 'block_id'::
Outputs raw content for the bitmap item corresponding to the given block_id.

*show*::
Display value(s) of the given variable. See the *VARIABLES* section for more
details.

*shell*::
Starts an interactive session. All of the above commands can be executed from
within the interactive session.
+
The current working directory can be changed with the *cd* command,
followed by a path.
+
The following output redirections are supported within the shell:
+
- 'cmd' > 'output'
+
Puts the output of 'cmd' in the 'output' file.
+
- 'cmd' >> 'output'
+
Appends the output of 'cmd' to the 'output' file.
+
- 'cmd' | 'external command'
+
Sends the output of 'cmd' to the input of 'external command'.
The 'external command' itself can contain output redirection.
+
Examples:
+
** read_block 0x00000681 | less
** cat /.fdc.sf | hexdump -C
** cat /.fdc.sf | hexdump -C > /tmp/fdc.hex
** cat /.fdc.sf | hexdump -C | less


VARIABLES
---------

Variables in debugvmfs represent structures on the filesystem. The currently
supported top-level variables are the following:

- *fbb*

- *fdc*

- *pbc*

- *sbc*

- *fs*

- *lvm*

- *blkid*['blk']

- *dirent*['path']

- *inode*['path']

The *fbb*, *fdc*, *pbc* and *sbc* variables are bitmaps. Running them through
the *show* command will display all the bitmaps header fields. Each of these
fields can also be displayed individually:

- 'bitmap'.*items_per_bitmap_entry*

- 'bitmap'.*bmp_entries_per_area*

- 'bitmap'.*hdr_size*

- 'bitmap'.*data_size*

- 'bitmap'.*area_size*

- 'bitmap'.*area_count*

- 'bitmap'.*total_items*

- 'bitmap'.*used_items*

- 'bitmap'.*free_items*

- 'bitmap'.*entry*['n']

e.g. to display the data size of the fdc bitmap, type *show fdc.data_size*.

Each 'bitmap'.*entry*['n'] (where 0 ≤ 'n' < 'bitmap'.*bmp_entries_per_area*
* 'bitmap'.*area_count*) contains information about each entry in the bitmap.
The available fields are:

- 'bitmap'.*entry*['n'].id

- 'bitmap'.*entry*['n'].total

- 'bitmap'.*entry*['n'].free

- 'bitmap'.*entry*['n'].ffree

- 'bitmap'.*entry*['n'].mdh

- 'bitmap'.*entry*['n'].item['m']

The 'bitmap'.*entry*['n'].mdh is a metadata header. See further below for
more details about metadata headers.

Each 'bitmap'.*entry*['n'].item['m'] (where 0 ≤ 'm' <
'bitmap'.*items_per_bitmap_entry*) contains information about a given item
in the given entry. The available fields are:

- 'bitmap'.*entry*['n'].item['m'].used

The *fs* variable contains low-level information about the filesystem. The
available fields are:

- *fs*.*vol_version*

- *fs*.*version*

- *fs*.*label*

- *fs*.*mode*

- *fs*.*uuid*

- *fs*.*ctime*

- *fs*.*block_size*

- *fs*.*subblock_size*

- *fs*.*fdc_header_size*

- *fs*.*fdc_bitmap_count*

The *lvm* variable contains low-level information about the physical and
 logical volumes. The available fields are:

- *lvm*.*uuid*

- *lvm*.*size*

- *lvm*.*blocks*

- *lvm*.*num_extents*

- *lvm*.*extent*['n']

Each *lvm*.*extent*['n'] (where 0 ≤ 'n' < *lvm*.*num_extents*) contains
low-level information about the physical volumes. The available fields are:

- *lvm*.*extent*['n'].device

- *lvm*.*extent*['n'].uuid

- *lvm*.*extent*['n'].lun

- *lvm*.*extent*['n'].version

- *lvm*.*extent*['n'].name

- *lvm*.*extent*['n'].size

- *lvm*.*extent*['n'].num_segments

- *lvm*.*extent*['n'].first_segment

- *lvm*.*extent*['n'].last_segment

Each *blkid*['blk'] (where 'blk' is a block id) contains information on
the given block id. The available fields are:

- *blkid*['blk'].item

- *blkid*['blk'].flags

Each *dirent*['path'] (where 'path' is a path relative to the current
directory in the shell or / outside the shell) contains information on
the directory entry corresponding to the given path. The available fields
are:

- *dirent*['path'].type

- *dirent*['path'].block_id

- *dirent*['path'].record_id

- *dirent*['path'].name

Each *inode*['path'] (where 'path' is a path relative to the current
directory in the shell or / outside the shell) contains information on
the inode corresponding to the given path. The available fields are:

- *inode*['path'].id

- *inode*['path'].id2

- *inode*['path'].nlink

- *inode*['path'].type

- *inode*['path'].flags

- *inode*['path'].size

- *inode*['path'].blk_size

- *inode*['path'].blk_count

- *inode*['path'].uid

- *inode*['path'].gid

- *inode*['path'].mode

- *inode*['path'].zla

- *inode*['path'].tbz

- *inode*['path'].cow

- *inode*['path'].atime

- *inode*['path'].mtime

- *inode*['path'].ctime

- *inode*['path'].rdm_id

- *inode*['path'].mdh

Metadata headers are being used in several places, such as
'bitmap'.*entry*['n'].mdh and *inode*['path'].mdh. They mostly contain
information about clustered accesses to metadata on the filesystem.
 The available fields are:

- 'mdh'.magic

- 'mdh'.pos

- 'mdh'.hb_pos

- 'mdh'.hb_lock

- 'mdh'.hb_uuid

- 'mdh'.hb_seq

- 'mdh'.obj_seq

- 'mdh'.mtime


AUTHORS
-------
include::../AUTHORS[]


SEE ALSO
--------
vmfs-fuse(8)
