Sunday, December 19, 2010

Linux block size

Filesystem block size

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.

On the downside, if you are going to have a lot of smaller files on that filesystem, like the /etc , there the potential for a lot of wasted disk space.

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.


Determine the block size on hard disk filesystem for disk quota

by LinuxTitli on May 8, 2006 · 12 comments

When configuring user disk quotas I need to find out the block size on my SCSI hard disk drive. For example if I am using a block size of 1024 then setting block size to 102400 blocks limit my user to 100MB of disk space.

Therefore, it is necessary to determine the correct block size; otherwise, I will end up assigning wrong disk quota limit.

You can use dumpe2fs command, which prints the super block and blocks group information for the filesystem present on device. You need to type dumpe2fs command as the root user:
# tune2fs -l /dev/sdb3 | grep -i 'Block size'
Or

# dumpe2fs /dev/sdb3 | grep -i 'Block size'


Output:

Block size: 4096

Now setting a user quota of 40960 would limit a user to 10MB of disk space.

Please note that dumpe2fs command used to determine the actual size of a block on the filesystem (and not BLOCK SIZE OF FILESYSTEM not harddisk).

No comments:

Post a Comment