iノードについて
iノードとは
Linuxのファイルシステムでは、「ファイルの中身(データ)」と 「ファイルの属性や管理情報」 は別々に保存される。 「ファイルの属性や管理情報」を格納する記憶領域をiノードと呼ぶ。 全てのファイルにはiノード番号が振られ対応するiノードと紐づけられる。
iノード番号の確認方法
ls -i
で確認可能
[oracle@localhost ~]$ ls -i test.txt 67648997 test.txt [oracle@localhost ~]$
stat
でも確認可能
[oracle@localhost ~]$ stat test.txt File: 'test.txt' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: f900h/63744d Inode: 67648997 Links: 1 Access: (0644/-rw-r--r--) Uid: (54321/ oracle) Gid: (54321/oinstall) Access: 2022-07-20 22:52:03.048300620 +0900 Modify: 2022-07-20 22:52:03.048300620 +0900 Change: 2022-07-20 22:52:03.048300620 +0900 Birth: - [oracle@localhost ~]$
cpとmvでのiノード番号の変化
cpではiノード番号は変わる
[oracle@localhost ~]$ ls -i test.txt 67648997 test.txt [oracle@localhost ~]$ cp -p test.txt test_01.txt [oracle@localhost ~]$ ls -li test* 67648997 -rw-r--r-- 1 oracle oinstall 212 Jul 20 22:32 test.txt 67183839 -rw-r--r-- 1 oracle oinstall 212 Jul 20 22:32 test_01.txt
mvではiノード番号は変わらない
[oracle@localhost ~]$ ls -li test.txt 67183839 -rw-r--r-- 1 oracle oinstall 0 Jul 20 22:50 test.txt [oracle@localhost ~]$ mv test.txt test_01.txt [oracle@localhost ~]$ ls -li test* 67183839 -rw-r--r-- 1 oracle oinstall 0 Jul 20 22:50 test_01.txt [oracle@localhost ~]$ 67648997 test.txt