在Linux中, 一切皆文件,不论是目录,设备,套接字等都可以看成文件,而且每一个文件对应一个inode号,这是一一对应的关系。
[root@oracle ~]# ls -il
总用量 2624
这个就是文件的inode号
539657 -rw-------. 1 root root 1835 3月 9 2013 anaconda-ks.cfg
539664 drwxr-xr-x. 2 root root 4096 10月 26 01:44 c-project
539670 drwxr-xr-x. 2 root root 4096 5月 12 00:39 Desktop
540968 drwxr-xr-x. 2 root root 4096 5月 12 00:39 Documents
540965 drwxr-xr-x. 2 root root 4096 5月 12 00:39 Downloads
523267 -rw-r--r--. 1 root root 58132 3月 9 2013 install.log
523268 -rw-r--r--. 1 root root 10731 3月 9 2013 install.log.syslog
539809 -rwxr-xr-x. 1 root root 161 5月 16 06:33 iptables.sh
539839 -rw-r--r--. 1 root root 116172 2月 24 2013 libblkid-2.17.2-12.9.el6.x86_64.rpm
539838 -rw-r--r--. 1 root root 136420 2月 24 2013 libblkid-devel-2.17.2-12.9.el6.x86_64.rpm
539840 -rw-r--r--. 1 root root 68152 2月 24 2013 libuuid-2.17.2-12.9.el6.x86_64.rpm
539837 -rw-r--r--. 1 root root 84968 2月 24 2013 libuuid-devel-2.17.2-12.9.el6.x86_64.rpm
540969 drwxr-xr-x. 2 root root 4096 5月 12 00:39 Music
540970 drwxr-xr-x. 2 root root 4096 5月 12 00:39 Pictures
540967 drwxr-xr-x. 2 root root 4096 5月 12 00:39 Public
539817 drwxr-xr-x. 8 root root 4096 10月 12 06:47 rpmbuild
540966 drwxr-xr-x. 2 root root 4096 5月 12 00:39 Templates
540971 drwxr-xr-x. 2 root root 4096 5月 12 00:39 Videos
539788 -rw-r--r--. 1 root root 741004 10月 12 06:42 xfsprogs-3.1.1-4.1.x86_64.rpm
539815 -rw-r--r--. 1 root root 1400894 10月 12 06:46 xfsprogs-3.1.1-4.el6.src.rpm
通过stat命令,查看文件的具体信息
[root@oracle ~]# stat anaconda-ks.cfg
File: "anaconda-ks.cfg"
Size: 1835 Blocks: 8 IO Block: 4096 普通文件
Device: fd00h/64768dInode: 539657 这个inode信息与上面一样 Links: 1
Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-03-09 10:34:37.821819313 +0800 文件访问时间
Modify: 2013-03-09 10:34:37.945351959 +0800 文件修改时间
Change: 2013-03-09 10:34:46.132781083 +0800
通过tunefs -l /dev/sda1 命令,查看磁盘的详细信息
#tune2fs -l /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name: <none>
Last mounted on: /boot
Filesystem UUID: a9775a08-356f-456e-9ec1-50ae0121ff79
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 128016
Block count: 512000
Reserved block count: 25600
Free blocks: 462962
Free inodes: 127978
First block: 1
Block size: 1024
Fragment size: 1024
Reserved GDT blocks: 256
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 2032
Inode blocks per group: 254
Flex block group size: 16
Filesystem created: Sat Mar 9 10:22:43 2013
Last mount time: Tue Oct 29 05:30:19 2013
Last write time: Tue Oct 29 05:30:19 2013
Mount count: 18
Maximum mount count: -1
Last checked: Sat Mar 9 10:22:43 2013
Check interval: 0 (<none>)
Lifetime writes: 46 MB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128 #i节点大小
Journal inode: 8
Default directory hash: half_md4
Directory Hash Seed: b248bf99-3a1f-4b85-ab51-49701e6d8490
Journal backup: inode blocks