guixingyi said:I know that there is one command which is istat on AIX to get inode information, does anyone know is there any similar tool on FreeBSD, seems no info found via google.
> istat /usr/bin/ksh
Inode 10360 on device 10/6 File Protection: r-xr-xr-x
Owner: 2(bin) Group: 2(bin)
Link count: 2 Length 372298 bytes
Last updated: Wed May 13 14:08:13 1992
Last modified: Wed May 13 13:57:00
>istat 10360 /dev/hd2
Inode 10360 on device 10/6 File Protection: r-xr-xr-x
Owner: 2(bin) Group: 2(bin)
Link count: 2 Length 372298 bytes
Last updated: Wed May 13 14:08:13 1992
Last modified: Wed May 13 13:57:00
Block pointers (hexadecimal):
2a9a 2a9b 2a9c 2a9d 2a9e 2a9f 2aa0 2aa1
> stat -x /bin/sh
File: "/bin/sh"
Size: 112288 FileType: Regular File
Mode: (0555/-r-xr-xr-x) Uid: ( 0/ root) Gid: ( 0/ wheel)
Device: 0,91 Inode: 49057 Links: 1
Access: Fri Nov 28 17:50:03 2008
Modify: Tue Jun 3 16:13:27 2008
Change: Tue Jun 3 16:13:27 2008
# fsdb -r /dev/ad14s1a
(...)
fsdb (inum: 2)> inode 49057
current inode: regular file
I=49057 MODE=100555 SIZE=112288
BTIME=Jun 3 16:13:27 2008 [0 nsec]
MTIME=Jun 3 16:13:27 2008 [0 nsec]
CTIME=Jun 3 16:13:27 2008 [0 nsec]
ATIME=Nov 28 17:50:03 2008 [0 nsec]
OWNER=root GRP=wheel LINKCNT=1 FLAGS=0 BLKCNT=dc GEN=2d96bb57
fsdb (inum: 49057)> blocks
Blocks for inode 49057:
Direct blocks:
194536, 194544, 194552, 194560, 194568, 194576, 194632 (7 frags)
fsdb (inum: 49057)> ^D
c2d#
> find -x / -inum 49057 -exec stat -x {} \;
File: "/bin/sh"
Size: 112288 FileType: Regular File
Mode: (0555/-r-xr-xr-x) Uid: ( 0/ root) Gid: ( 0/ wheel)
Device: 0,91 Inode: 49057 Links: 1
Access: Fri Nov 28 18:05:57 2008
Modify: Tue Jun 3 16:13:27 2008
Change: Tue Jun 3 16:13:27 2008
(And a whole slew of Permission Denied warnings.)
... because I'm using nftw(3). Nonetheless, my sadness remains; nftw etc. have no way to do the equivalent of istat(), so they, too, wind up walking lots of paths for stat() unnecessarily. The tool I've built winds up walking several million files across 400+GB of storage. Performance actually matters, and reducing the number of times through the pathname parsing code in the kernel would actually help.Mel_Flynn said:And you're not using fts(3) because?