Find a file’s information for inode or block
Find a file based on inode or block info#find a file’s inode id by ls, the sample file’s inode number is 12
$ls -li /boot/message12 -rw-r--r-- 1 root root 80032 Mar 13 2009 /boot/message#find a file’s inode or block info by debugfs
$echo "stat message" | debugfs /dev/sda1
debugfs 1.39 (29-May-2006)debugfs: Inode: 12 Type: regular Mode: 0644 Flags: 0x0 Generation: 3354433043User: 0 Group: 0 Size: 80032File ACL: 4640 Directory ACL: 0Links: 1 Blockcount: 162Fragment: Address: 0 Number: 0 Size: 0ctime: 0x4e2371f6 -- Mon Jul 18 09:36:22 2011atime: 0x49b95d4d -- Fri Mar 13 06:06:53 2009mtime: 0x49b95d4d -- Fri Mar 13 06:06:53 2009BLOCKS:(0-11):7681-7692, (IND):7693, (12-78):7694-7760TOTAL: 80
#find a file based on inode number by find, but it may take long time to search
$find /boot/ -inum 12/boot/message#find a file based on inode number by debugfs
$echo -e "ncheck 12" | debugfs /dev/sda1
debugfs: Inode Pathname12 /message##find a file based on block number by debugfs
#use icheck to find inode number based on block number first
$echo -e "icheck 7693 " | debugfs /dev/sda1
debugfs: Block Inode number7693 12#then use ncheck find the file by inode number
$echo -e "ncheck 12 " | debugfs /dev/sda1
debugfs: Inode Pathname12 /message