On Ubuntu 18.04 I was checking on my log sizes using du -sh and I can't quite understand what du tells me, please see my screen snippet below:
# I am in the logs directory and show total number of bytes (5th column in my ls-l output is file size in bytes)
logs$ ls -l |awk '{tot+=$5;} END{ print tot}'
8333848518
# I moved one level up and use du -s feature to show total disk space occupied by logs directory (slight discrepancy with above as the logs are being written into all the time):
logs$ cd ..
service$ du -sb logs
8334585063 logs
# the same but in "humanly readable" format, which I tend to use most often
service$ du -sh logs
1.4G logs
# or in megabytes:
service$ du -sm logs
1381 logs
I'd expect to see 7.75G, why du shows me this number?
man du refers to several environment variables it depends on, none of them are set:
service$ echo $DU_BLOCK_SIZE, $BLOCK_SIZE, $BLOCKSIZE, $POSIXLY_CORRECT
, , ,
Any pointers would be appreciated.