How to Check Filesystem Block Size on Linux?
Posted by Planet Malaysia on April 14, 2009
The Linux file system architecture is an interesting example of abstracting complexity. The block size specifies size that the filesystem will use to read and write data. Larger block sizes will help improve disk I/O performance when using large files, such as databases. This happens because the disk can read or write data for a longer period of time before having to search for the next block.
For example, if you set your block size to 4096, or 4K, and you create a file that is 256 bytes in size, it will still consume 4K of space on your harddrive. For one file that may seem trivial, but when your filesystem contains hundreds or thousands of files, this can add up.
Block size can also effect the maximum supported file size on some filesystems. This is because many modern filesystem are limited not by block size or file size, but by the number of blocks. Therefore you would be using a “block size * max # of blocks = max block size” formula.
How to Check Filesystem Block Size on Linux?
Example 1:
# tune2fs -l /dev/sda1 | grep -i ‘block size’
Block size: 4096
Example 2:
# dumpe2fs -h /dev/sda1 |grep “Block size:”
Block size: 4096
Example 3:
# blockdev –getbsz /dev/sda1
4096
Example 4:
# echo “abc” >test.txt
# du -h test.txt
4.0K test
Possibly Related Posts:
- Google Public DNS Down?
- lppasswd: Unable to open passwd file: Permission denied
- Missing /var/log/lastlog
- Telnet service_limit error
- Google accounts on Twitter
Comments
Leave a Reply