oreilly.comSafari Books Online.Conferences.

Linux in a Nutshell



Buy it now, or read it online on Safari Bookshelf.


debugfs [[option] device]

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.


-b blocksize

Use the specified blocksize for the filesystem.


Catastrophic mode. Open the filesystem in read-only mode; do not read the inode and group bitmaps initially.

-f file

Read commands from file. Exit when done executing commands.


Specify filesystem device is an ext2 image file created by e2image.

-s block

Read the superblock from the specified block.


Open the filesystem in read-write mode.

-R request

Execute the given request (see list below) then exit.


Print version number, then exit.


bmapfile logicalblock

Given the logicalblock of inode file, print the corresponding physical block.

cat file

Dump the contents of an inode to standard output.

cd directory

Change the current working directory to directory.

chroot directory

Change the root directory to be the specified inode.


Close the currently open filesystem.

clri file

Clear the contents of the inode corresponding to file.

dump [-p] file out_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_dir directory

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.

freeb block [n]

Free n blocks beginning from block. Default is 1 block.

freei file

Free the inode corresponding to file.


Print a list of commands understood by debugfs.

icheck block

Do block-to-inode translation.


Print the location of the inode data structure for file.

init_filesys device blocksize

Create an ext2 filesystem on device.

kill_file file

Remove file and deallocate its blocks.

lcd directory

Change current working directory on native filesystem.

ln source_file dest_file

Create a link.

logdump [-acs] [-bblock] [-iinode] [-fjournal_file] [out_file]

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_inode file

Modify the contents of the inode corresponding to file.

mkdir directory

Make directory.

mknod file [p|[[c|b] major minor] ]

Create a special device file.

ncheck inode

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.


Print the current working directory.


Quit debugfs.

rdump directory dest_directory

Recursively dump directory and its contents to dest_directory on the native filesystem.

rm file

Remove file.

rmdir directory

Remove directory.

setb block [n]

Mark n blocks as allocated, beginning from block. Default is 1 block.

seti file

Mark in use the inode corresponding to file.

set_super_value [-l] field value

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.

stat file

Dump the contents of the inode corresponding to file.

testb block [n]

Print whether each of n blocks is in use, beginning with block. By default, just check the specified block.

testi file

Test whether the inode corresponding to file is marked as allocated.

unlink file

Remove a link.

write source_file file

Create a file in the filesystem named file, and copy the contents of source_file into the destination file.