Obtain file system information

To obtain information about your ext2, ext3 or ext4 file system, you can use the dumpe2fs command. This command is most often used with the -h option, which causes the utility to omit information about group descriptors. dumpe2fs shows some useful information about the file system, such as:

  • the mount point.
  • the last time the file system was checked.
  • file system OS type.
  • number of inodes.
  • journal information.

The syntax of the dumpe2fs is simple, you just type dumpe2fs, followed by the file system device name. Here is an example output:

linux dumpe2fs command

Unlike many low-level disk utilities (such as fsck), you can safely run dumpe2fs on a mounted file system.

 

An equivalent to dumpe2fs for XFS file systems is called xfs_info. Like dumpe2fs, this command provides useful information about the file system. To invoke the command, just type xfs_info, followed by the file system device name:

linux xfs_info command

xfs_info requires that the file system is mounted.

 

Another useful tool for XFS file systems is xfs_metadump. This program copies the file system’s metadata (filenames, file sizes, and so on) to a file. For example, xfs_metadump /dev/sda3 /xfs/xfs_dump copies the metadata to /xfs/xfs_dump:

linux xfs_metadump command

xfs_metadump should only be used to copy unmounted filesystems or read-only mounted file systems. The file generated by xfs_metadump can be restored to filesystem image (minus the data) using the xfs_mdrestore tool.

Subscribe to our Newsletter

Like us on Facebook

top
Geek University 2019