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:
# 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).
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins

- My 10 UNIX Command Line Mistakes
- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
Facebook it - Tweet it - Print it -
We're here to help you make the most of sysadmin work. So, subscribe!

{ 17 comments… read them below or add one }
hi,
i think that this is BLOCK SIZE OF FILESYSTEM not harddisk. Title is a bit missleading. BLOCK SIZE OF DISK is allmost always 512B
Opps :( you are right. Above command is to determine the actual size of a block on the filesystem.
Thanks, I will update post :)
I just found this post, it was exactly what I was looking for, thanks for the help :)
Just two things:
1) on my system I had to use double quotes rather than single quotes,
2) I think this means that 100MB could be bigger on one system than another? Am I right?
100MB is the same size on one system as it is on another. However, with varying block sizes, 100MB may spread over more blocks on systems with smaller block sizes than it does on a system with a larger block size.
For example, on a system with a 512B block size 100MB will take up 204800 blocks. On a system with a 64K block size 100MB will take up 1600 blocks.
Umm, 409600 blocks = 409600(blocks) * 4096(B) = 1.6G
Nice tip. The comment by James Cape assumes that all block sizes are all the same, all the time, on all filesystems… hmmm. Is that true??
You can also get the block size for all disks using the following command, as well as readahead, size, etc.
blockdev –report
linuxrawkstar:
No, James Cape’s tip doesn’t assume that all block sizes are all the same, all the time, on all filesystems.
His tip specifically follows the example in the article, in which LINUXTITLI “discovered” a 4096b block size for the filesystem he was discussing.
LINUXTITLI, and Shane too, already showed how to discover block size for some other particular filesystem.
I am a bit confused…
when I try to see block size with command “/sbin/dumpe2fs -h /dev/mapper/System-home”
then it says:
Block size: 4096
but when i run df command: it shows
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/System-home 61958132 49838676 8972092 85% /home
and when I run df -h, it shows
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/System-home 60G 48G 8.6G 85% /home
does this mean that 1Kb = 4096 blocks ??
Hello Vivek / Admin,
This article is little confusing. I would suggest to make necessary correction on this article.
The output of # dumpe2fs /dev/sdb3 | grep -i ‘Block size’ is IO Block size. not the block size of filesystem which is 512K (each sector size). In your example 8 x 512K = 4096K, which is the default IO Block size.
hi all,
just wanted to know how no of blocks and size of disk are related just suppose i have 500gb of hard disk how blocks are numbered and how many bytes in one block
The above tip seems to be wrong.
Apparently there are more then one meaning to the term “block size”. The original post refers to the file-system block size, while quota uses a system constant that is a feature of the running kernel.
See Detect block size for quota in Linux question on StackOverflow.
You’re absolutely right. quotas always use a 1k block size regardless of the file system’s block size. This was very confusing for me!
Hi all (5 years later),
If block size is 4096 bytes (4KB) then disk quota of 10 MB for one user is:
10MB / 4KB = 2560 blocks
What am I missing?
david, my understanding about block size is just the same as you. i think maybe the author made some mistake
Hi
The size of the dataBlock in system is equal to size of the page in system.
check with getpagesize() & dumpe2fs.
regards,
manikanta
Hi
create an empty file say file.txt by touch command.
eg:
touch file.txt
then type this comman on konsole
# du -h file.txt
o/p:
4.0kb
regards
manikanta