Изучение свойств файла - efanov/mephi GitHub Wiki
Изучение свойств файла Изучение полей структуры ext4_inode
Выводим время, создаём файл f1, определяем номер inode файла f1, определяем раздел с файловой системой.
$ date
Вс сен 30 01:41:05 MSK 2018
$ >f1
$ ls -i ./f1
1972911 ./f1
$ mount | grep ' / '
/dev/sda3 on / type ext4 (rw,relatime,seclabel,data=ordered)
Выводим содержимое inode с номером 1972911.
# debugfs -R 'stat <1972911>' /dev/sda3
debugfs 1.42.9 (28-Dec-2013)
Inode: 1972911 Type: regular Mode: 0664 Flags: 0x80000
Generation: 2879351720 Version: 0x00000000:00000001
User: 1000 Group: 1000 Size: 0
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 0
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5bafff85:e75ee134 -- Sun Sep 30 01:41:09 2018
atime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
mtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
crtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
Size of extra inode fields: 28
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:user_home_t:s0\000" (37)
EXTENTS:
crtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018 - время создания файла.
Записываем данные в файл.
# cat >./f1
Hello, world!
Выводим содержимое inode с номером 1972911.
# debugfs -R 'stat <1972911>' /dev/sda3
debugfs 1.42.9 (28-Dec-2013)
Inode: 1972911 Type: regular Mode: 0664 Flags: 0x80000
Generation: 2879351720 Version: 0x00000000:00000001
User: 1000 Group: 1000 Size: 14
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 8
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5bb000e4:b1deeab4 -- Sun Sep 30 01:47:00 2018
atime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
mtime: 0x5bb000e4:b1deeab4 -- Sun Sep 30 01:47:00 2018
crtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
Size of extra inode fields: 28
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:user_home_t:s0\000" (37)
EXTENTS:
(0):8117799
Изменились: ctime: 0x5bb000e4:b1deeab4 -- Sun Sep 30 01:47:00 2018 - время модификации файла mtime: 0x5bb000e4:b1deeab4 -- Sun Sep 30 01:47:00 2018 - время модификации inode файла
# cat ./f1
Hello, world!
# debugfs -R 'stat <1972911>' /dev/sda3
debugfs 1.42.9 (28-Dec-2013)
Inode: 1972911 Type: regular Mode: 0664 Flags: 0x80000
Generation: 2879351720 Version: 0x00000000:00000001
User: 1000 Group: 1000 Size: 14
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 8
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5bb000e4:b1deeab4 -- Sun Sep 30 01:47:00 2018
atime: 0x5bb0012d:24a6a1d4 -- Sun Sep 30 01:48:13 2018
mtime: 0x5bb000e4:b1deeab4 -- Sun Sep 30 01:47:00 2018
crtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
Size of extra inode fields: 28
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:user_home_t:s0\000" (37)
EXTENTS:
(0):8117799
$ ln f1 f11
# debugfs -R 'stat <1972911>' /dev/sda3
debugfs 1.42.9 (28-Dec-2013)
Inode: 1972911 Type: regular Mode: 0664 Flags: 0x80000
Generation: 2879351720 Version: 0x00000000:00000001
User: 1000 Group: 1000 Size: 14
File ACL: 0 Directory ACL: 0
Links: 2 Blockcount: 8
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5bb0015e:30d5ec1c -- Sun Sep 30 01:49:02 2018
atime: 0x5bb0012d:24a6a1d4 -- Sun Sep 30 01:48:13 2018
mtime: 0x5bb000e4:b1deeab4 -- Sun Sep 30 01:47:00 2018
crtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
Size of extra inode fields: 28
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:user_home_t:s0\000" (37)
EXTENTS:
(0):8117799
# >./f1
# debugfs -R 'stat <1972911>' /dev/sda3
debugfs 1.42.9 (28-Dec-2013)
Inode: 1972911 Type: regular Mode: 0664 Flags: 0x80000
Generation: 2879351720 Version: 0x00000000:00000001
User: 1000 Group: 1000 Size: 0
File ACL: 0 Directory ACL: 0
Links: 2 Blockcount: 0
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5bb0018c:e611af7c -- Sun Sep 30 01:49:48 2018
atime: 0x5bb0012d:24a6a1d4 -- Sun Sep 30 01:48:13 2018
mtime: 0x5bb0018c:e611af7c -- Sun Sep 30 01:49:48 2018
crtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
Size of extra inode fields: 28
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:user_home_t:s0\000" (37)
EXTENTS:
# rm ./f1
# debugfs -R 'stat <1972911>' /dev/sda3
debugfs 1.42.9 (28-Dec-2013)
Inode: 1972911 Type: regular Mode: 0664 Flags: 0x80000
Generation: 2879351720 Version: 0x00000000:00000001
User: 1000 Group: 1000 Size: 0
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 0
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5bb001ba:b3164a14 -- Sun Sep 30 01:50:34 2018
atime: 0x5bb0012d:24a6a1d4 -- Sun Sep 30 01:48:13 2018
mtime: 0x5bb0018c:e611af7c -- Sun Sep 30 01:49:48 2018
crtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
Size of extra inode fields: 28
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:user_home_t:s0\000" (37)
EXTENTS:
# date
Вс сен 30 01:51:00 MSK 2018
# \rm ./f11
[root@dimix Work]# debugfs -R 'stat <1972911>' /dev/sda3
debugfs 1.42.9 (28-Dec-2013)
Inode: 1972911 Type: regular Mode: 0664 Flags: 0x80000
Generation: 2879351720 Version: 0x00000000:00000001
User: 1000 Group: 1000 Size: 0
File ACL: 0 Directory ACL: 0
Links: 0 Blockcount: 0
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5bb001db:34d296d0 -- Sun Sep 30 01:51:07 2018
atime: 0x5bb0012d:24a6a1d4 -- Sun Sep 30 01:48:13 2018
mtime: 0x5bb0018c:e611af7c -- Sun Sep 30 01:49:48 2018
crtime: 0x5bafff85:d2ddf3ac -- Sun Sep 30 01:41:09 2018
dtime: 0x5bb001db -- Sun Sep 30 01:51:07 2018
Size of extra inode fields: 28
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:user_home_t:s0\000" (37)
EXTENTS:
dtime: 0x5bb001db -- Sun Sep 30 01:51:07 2018 - время удаления файла