LinuxCommandLibrary

xfs_ncheck

Find XFS filesystem inodes by inode number

SYNOPSIS

xfs_ncheck [-i inode#]... [-f file] [-s] [-v] [-l logdev] filesystem

PARAMETERS

-i inode#
    Check only the specified inode number(s).

-f file
    Read inode numbers from file, one number per line. Numbers can be separated by spaces or tabs.

-s
    Print only special device files (block and character devices), FIFOs, and sockets.

-v
    Verbose mode. Prints extra information during the scan.

-l logdev
    Specifies the device where the XFS transaction log resides. Useful if the log is not in the standard location.

filesystem
    The path to the XFS filesystem device (e.g., /dev/sda1).

DESCRIPTION

xfs_ncheck is a command-line utility used to generate a list of pathnames corresponding to specified inode numbers on an XFS filesystem.

It scans the specified XFS filesystem or a file containing a list of inode numbers and outputs the pathname associated with each inode. This is useful for identifying files that might have been orphaned or corrupted, or for correlating inode numbers from filesystem logs to actual file paths.

It is crucial for filesystem recovery and debugging, providing a way to link numerical inode identifiers back to their human-readable file paths. Its main application is filesystem forensics and data recovery when you need to find the names of files with given inode numbers.

CAVEATS

xfs_ncheck requires read-only access to the filesystem. Running it on a mounted filesystem can cause inconsistencies, especially if the filesystem is being actively modified. It should ideally be run on an unmounted filesystem or a read-only snapshot.

EXIT STATUS

The xfs_ncheck command returns 0 on successful completion. A non-zero exit status indicates an error.

EXAMPLES

1. To find the pathname associated with inode number 12345 on /dev/sda1:
xfs_ncheck -i 12345 /dev/sda1

2. To read inode numbers from a file named 'inodes.txt' and find their corresponding pathnames:
xfs_ncheck -f inodes.txt /dev/sda1

HISTORY

xfs_ncheck has been a part of the XFS filesystem utilities suite since its inception. XFS was initially developed by SGI in the early 1990s and later open-sourced. The tool's purpose has always been to assist in filesystem diagnostics and recovery by mapping inode numbers to file paths. Its functionality remains relatively unchanged over time, focusing on its core task of inode number lookup.

SEE ALSO

xfsdump(8), xfsrestore(8), xfs(5), find(1)

Copied to clipboard