Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.
System administration command. Provide direct access to data structure of an ext2 or ext3 filesystem in order to debug problems with the device. device is the special file corresponding to the device containing the filesystem (e.g., /dev/hda3). debugfs may be used on a mounted filesystem device.
Option
-bblocksize
Use the specified blocksize for the filesystem.
-c
Catastrophic mode. Open the filesystem in read-only mode; do not read the inode and group bitmaps initially.
-ffile
Read commands from file. Exit when done executing commands.
-i
Specify filesystem device is an ext2 image file created by e2image.
-sblock
Read the superblock from the specified block.
-w
Open the filesystem in read-write mode.
-Rrequest
Execute the given request (see list below) then exit.
-V
Print version number, then exit.
Requests
bmapfile logicalblock
Given the logicalblock of inode file, print the corresponding physical block.
catfile
Dump the contents of an inode to standard output.
cddirectory
Change the current working directory to directory.
chrootdirectory
Change the root directory to be the specified inode.
close
Close the currently open filesystem.
clrifile
Clear the contents of the inode corresponding to file.
dump [-p] fileout_file
Dump the contents of inode file to out_file. Change ownership and permissions of out_file to match file if -p is specified.
expand_dirdirectory
Expand directory.
feature [[-] feature]
Set filesystem feature listed on the command line, then print current feature settings. Use - to clear a feature.
find_free_block [[n] goal]
Find and allocate first n free blocks starting from goal (if specified).
find_free_inode [dir [mode] ]
Find a free inode and allocate it.
freebblock [n]
Free n blocks beginning from block. Default is 1 block.
freeifile
Free the inode corresponding to file.
help
Print a list of commands understood by debugfs.
icheckblock
Do block-to-inode translation.
imapfile
Print the location of the inode data structure for file.
init_filesysdeviceblocksize
Create an ext2 filesystem on device.
kill_filefile
Remove file and deallocate its blocks.
lcddirectory
Change current working directory on native filesystem.
Print the ext3 journal contents to screen or to the specified out_file. Prints the superblock journal by default. Specify other journal information by block or inode. You can also specify a journal_file containing journal data. Use -a to print the contents of descriptor blocks. Use -b to print records referring to a specified block. Use -c to print the hexadecimal and ASCII contents of blocks referenced by the logdump.
ls [-l] [-d] [pathname]
Emulate the ls command. Use -l for verbose format and -d to list deleted entries.
modify_inodefile
Modify the contents of the inode corresponding to file.
mkdirdirectory
Make directory.
mknodfile [p|[[c|b] majorminor] ]
Create a special device file.
ncheckinode
Do inode-to-name translation.
open [-b blocksize] [-c] [-f] [-i] [-w] [-s block] device
Open a filesystem. The options are identical to options for debugfs.
pwd
Print the current working directory.
quit
Quit debugfs.
rdumpdirectorydest_directory
Recursively dump directory and its contents to dest_directory on the native filesystem.
rmfile
Remove file.
rmdirdirectory
Remove directory.
setbblock [n]
Mark n blocks as allocated, beginning from block. Default is 1 block.
setifile
Mark in use the inode corresponding to file.
set_super_value [-l] fieldvalue
Set superblock field to value. Use -l to print a list of valid fields.
show_super_stats [-h]
List the contents of the superblock and block group descriptors. Use -h to list only the superblock contents.
statfile
Dump the contents of the inode corresponding to file.
testbblock [n]
Print whether each of n blocks is in use, beginning with block. By default, just check the specified block.
testifile
Test whether the inode corresponding to file is marked as allocated.
unlinkfile
Remove a link.
writesource_filefile
Create a file in the filesystem named file, and copy the contents of source_file into the destination file.