This question already has an answer here:
For academic purposes im trying to demonstrate internal fragmentation of a file. As i understand it, internal fragmentation can be shown as a difference between the size of file and the size of all blocks contatining the file. Finding out the number of block was easy enough. My problem is finding the size of blocks. Is this the number returned by stat -c %o? (4096) or stat -c %B (512).
What is the difference between these two? I've been trying to find answers online, however I'm only getting more confused. Other commands like blockdev --getbsz /dev/sda2 show my filesystem blocksize as 4096. However after doing caculations is seems that 512 is more fitting to be the asnwer im looking for (size of the file i was testing is 44933 and number of blocks is 88. Multiplying it by 4096 leaves us with 360448 which is more that 8 times size of the file).