I am on Ubuntu 20.04.5
and my file system is ext4
. I create an empty file and check its allocated size:
➜ touch test_file
➜ ls -s
total 0
0 test_file
I then echo one character into the file and check its allocated size again:
➜ echo "." > test_file
➜ ls -s
total 4
4 test_file
I understand that 4kb is the blocksize of my file system. But what happened to the file when I wrote to it? Why was there no space allocated before?