I wonder if it's because of different distro's. But output appears to be different on some commands.
~]# du --inodes -s /root
406 /root
~]# ls -ahl /root
total 7.9M
dr-xr-x---. 1 root root 836 Sep 17 08:09 .
dr-xr-xr-x. 1 root root 192 Apr 18 08:35 ..
-rw-------. 1 root root 1.4K Jan 5 2023 anaconda-ks.cfg
drwxr-xr-x 1 root root 6 Mar 22 09:30 .ansible
drwxr-xr-x 1 root root 276 Aug 29 15:04 .azure
-rw------- 1 root root 19K Sep 16 20:01 .bash_history
-rw-r--r--. 1 root root 18 Jan 19 2023 .bash_logout
-rw-r--r--. 1 root root 141 Jan 19 2023 .bash_profile
-rw-r--r--. 1 root root 429 Jan 19 2023 .bashrc
The size values in your root's home directory certainly differ from those in this debian installation here. The output you provide looks like it is indeed indicating the size of the inode data within the directory file, but I can't confirm that.
On this debian system where the directory files have been allocated the default 4.0K size, there is no indication of the actual number of bytes consumed within that 4K by the inode data:
Code:
[root@flop ~]# ls -alh
total 148K
drwx------ 9 root root 4.0K Sep 18 06:31 .
drwxr-xr-x 19 root root 4.0K Sep 17 17:28 ..
-rw-r--r-- 1 root root 110 Sep 4 13:46 99-msKey.hwdb
-rw------- 1 root root 7.1K Sep 18 06:31 .bash_history
-rw-r--r-- 1 root root 720 Jun 29 11:16 .bashrc
drwx------ 3 root root 4.0K Sep 23 2022 .cache
drwx------ 3 root root 4.0K Nov 21 2021 .config
-rwxrwxr-x 1 root root 104 Sep 13 2022 disable_ipv6
<snip>
I haven't been able to to get information on the size of the inode data with the ls or du commands on this system. Here is a directory which holds directories:
Code:
[flip@flop ~/lemon/file-exp]$ ls -alh
total 36K
drwxr-xr-x 9 flip flip 4.0K Sep 17 12:55 .
drwxr-xr-x 23 flip flip 4.0K Jul 15 09:55 ..
drwxr-xr-x 2 flip flip 4.0K Sep 17 12:49 anoth
drwxr-xr-x 3 flip flip 4.0K Aug 9 08:06 anoth2
drwxr-xr-x 2 flip flip 4.0K Jul 15 09:55 anoth3
drwxr-xr-x 2 flip flip 4.0K Sep 17 12:53 directory1
drwxr-xr-x 2 flip flip 4.0K Sep 17 12:55 empty1
drwxr-xr-x 2 flip flip 4.0K Sep 17 12:55 empty2
-rw-r--r-- 1 flip flip 0 Sep 17 12:33 exfile
drwxr-xr-x 2 flip flip 4.0K Aug 21 20:27 servers
When I use du to try and get the inodes sizes in bytes, du still only provides the number of inodes used:
Code:
[flip@flop ~/lemon/file-exp]$ du -shb --inodes .
du: warning: options --apparent-size and -b are ineffective with --inodes
35
The du man page on this system provides the following:
Code:
--inodes
list inode usage information instead of block usage
which I take to mean the count of inodes and blocks, and not the size of them. And that's how the option functions on this system.
Perhaps the coreutils package on your system, which holds both the du and ls commands, has been configured differently. Interesting.
In any case, the size of an inode can be seen in the following:
Code:
[root@flop ~]# tune2fs -l /dev/sda4 | grep -i inode
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Inode count: 57368576
Free inodes: 57145761
Inodes per group: 8192
Inode blocks per group: 512
First inode: 11
Inode size: 256
Journal inode: 8
Journal backup: inode blocks
Then some maths may be needed to calculate the size of the entries in the directory file using info from the linked page in post #4.