0

I'm new to Linux and i wanted to know the free data size of a certain partition. But executing different programs gave me different free sizes.

What i know about the filesystem:

  • the names of files and subdirectories are stored in the parent directory file
  • the meta data of a file, like access rights are stored in the inode data (inode data table)
  • each partition can have a journal system

I have a complete new data free partition created on /dev/sdb3 with filesystem EXT4 there is only a folder on it called lost+found, which was automatically created and uses 16 blocks of 1024 byte, i think for the recycle bin.

with: sudo dumpe2fs -h /dev/sdb3


i get:

Filesystem UUID:          38747522-7dbd-45f7-8bc3-a18cf4376b1d
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
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
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              13107200
Block count:              52428544
Reserved block count:     2621427
Free blocks:              51328243
Free inodes:              13107189
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Mon Dec  4 15:57:13 2023
Last mount time:          Mon Dec  4 15:59:30 2023
Last write time:          Mon Dec  4 16:16:29 2023
Mount count:              2
Maximum mount count:      -1
Last checked:             Mon Dec  4 15:57:13 2023
Check interval:           0 (<none>)
Lifetime writes:          231 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      8c75ef2f-d7d6-440b-8ae4-3459397d6a35
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0xef4a6bbd
Journal features:         journal_incompat_revoke journal_64bit journal_checksum_v3
Journal size:             1024M
Journal length:           262144
Journal sequence:         0x0000000c
Journal start:            1
Journal checksum type:    crc32c
Journal checksum:         0x46b9de63

block count is: 52428544, size of blocks: 4096
Inode count: 13107200, Inode size: 256
Journal length: 262144 blocks

So i calculate for the inode table 13107200*256/4096= 819200 blocks
(52428544-819200-262144)*4 = 205388800 1k blocks for file data

when i call: df /dev/sdb3
i get:

Filesystem     1K-blocks  Used Available Use%
/dev/sdb3      205374440 61468 194810880   1%

i calculated 205388800, but the size for file data blocks is 205374440,
leaving a difference of 14360 1k blocks, what did i wrong?

next question:
==============
dumpe2fs says there are 51328243 free blocks of 4096 bytes
which are 51328243*4= 205312972 1k blocks
if i add the 61468 used blocks, i get the 205374440 1k-blocks from df, thats right.

but if i substract the reserved blocks from the free blocks:
Free blocks: 51328243
Reserved block count: 2621427
(as i read, these are reserved blocks for root)

I get (51328243-2621427)*4 = 194827264 1k blocks for the available size, but df tells me, there are 194810880 1k blocks available, thats a difference of 16384 1k blocks, what did i wrong.

And last question:
==================
the partition is completley free, only the folder lost+found is on the partition, with a size of 16 1kblocks.
why are 61468 1k blocks in use - for what, i already considered, the inode table, the journal size, what else does need 61MB of space??

Thanx for your time in advance

0

You must log in to answer this question.

Browse other questions tagged .