Hi! > > Why can't we calculate the expected free space based on the size of > > the > > device? > > Hmm, I do not think it is suitable to calculate the size. 'df' report > file system disk space usage, which means it just only report the count > of all the data block. super block, group descriptor and others will not > include. > > ps: > ext2 file system: > +--------------+---------+---------+-----+---------+ > | boot section | group 0 | group 1 | ... | group n | > +--------------+---------+---------+-----+---------+ > group n: > +-------+------------+------------+--------+-------+-------+ > | super | group | data block | inode | inode | data | > | block | descriptor | bitmap | bitmap | table | block | > +-------+------------+------------+--------+-------+-------+ > > > > Does the space taken by the ext2 internal data structures > > vary unpredictedly? > > > > If we specify the block size, inode size and super block, we could get > the size of data block. BTW, mkfs use sparse_super as default option, > that means not every group has superblock backup copies. That make it > hard to calculate the size of data block.
Quite complicated indeed. Another idea may be to measure the difference in free space before and after we create a file. 1. create an empty file 1. get free space 2. fill the file with well defined amount of data 3. get free space, check that the difference matches the expectation -- Cyril Hrubis chru...@suse.cz ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list