Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k
Source Link
TimeString
  • 143
  • 1
  • 4

How does ext4 decide number of blocks of a file?

I'm playing with stat command which basically shows the inode information. Though I'm showing the information of a small file (146 characters), it shows 8 blocks. I was wondering why is that? Since the size of a page should be 4KB, which I expect the number is 1. BTW the file system I'm using is ext4. To give you more details:

more tmp.sh

#DATE=$(date +"%Y%m%d_%H%M%S")
#cp /var/log/filter.log /var/log/logHistory/filter_{$DATE}.log
dd=$(date --date='-1 day' +"%Y%m%d")
rm filter_$dd*

stat tmp.sh

  File: ‘tmp.sh’
  Size: 146         Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d  Inode: 1835522     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/timestring)   Gid: ( 1000/timestring)
Access: 2016-05-05 17:34:08.251864800 -0700
Modify: 2015-01-22 20:40:18.971521274 -0800
Change: 2015-01-22 20:40:18.975521274 -0800
 Birth: -