Determine the block size on hard disk filesystem for disk quota

by on May 8, 2006 · 20 comments· LAST UPDATED May 29, 2006


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'


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).

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 20 comments… read them below or add one }

1 mj May 29, 2006 at 4:57 pm

i think that this is BLOCK SIZE OF FILESYSTEM not harddisk. Title is a bit missleading. BLOCK SIZE OF DISK is allmost always 512B


2 LinuxTitli May 29, 2006 at 5:08 pm

Opps :( you are right. Above command is to determine the actual size of a block on the filesystem.

Thanks, I will update post :)


3 Tortanick January 4, 2007 at 11:58 am

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?


4 Teslamike March 28, 2007 at 3:04 pm

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.


5 James Cape March 8, 2009 at 4:49 pm

Umm, 409600 blocks = 409600(blocks) * 4096(B) = 1.6G


6 linuxrawkstar April 23, 2009 at 6:56 pm

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??


7 Shane Menshik June 13, 2009 at 11:07 am

You can also get the block size for all disks using the following command, as well as readahead, size, etc.

blockdev –report


8 beanluc July 17, 2009 at 6:39 pm


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.


9 Ramesh November 17, 2009 at 12:05 pm

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 ??


10 TodayLinux December 19, 2009 at 11:54 am

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.


11 parvesh January 31, 2010 at 5:27 am

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


12 Chen Levy March 25, 2010 at 7:18 am

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.


13 Alan November 28, 2011 at 11:19 am

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!


14 david March 14, 2011 at 11:11 am

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?


15 yao August 11, 2011 at 5:10 am

david, my understanding about block size is just the same as you. i think maybe the author made some mistake


16 testinguser February 13, 2012 at 4:26 pm

Agreed, it seems the original post is potentially incorrect. My understanding is that you first need to calculate the total size you want in bytes and divide it by the block size.

EG: 100MB = 1024 x 1024 x 100 – this is the definition of 100Megabytes

Then depending on your file system block size, you divide by that to get your number of blocks.

So just like David explained: 1024x1024x100 = 104,857,600 / 4096 = 25600

25600 blocks

1GB = 1024x1024x1024 / 4096 = 262144 blocks

However, in my case I’m trying to determine what is the block size used by the quota system, or how can I find out what that is? My fs is mounted using a 4096 byte block size, but quota doesn’t seem to be using the same block size to set it’s limits. I assume it’s going by 1024 byte block sizes. Is there anyway to verify that without writing a C program and using the ‘sys/mount.h’ library?


17 Charles Vlk (kunk) March 19, 2011 at 6:50 pm

“Now setting a user quota of 40960 would limit a user to 10MB of disk space.” Yeah, I don’t the math here is right if the block size is 4096 B or 4 KiB.

40960 * 4 KiB = 160 MiB
40 * 1024 * 4 * 1024 = 160 * 1024^2
1024^2 = Mi


18 ManikantaVarma September 22, 2011 at 10:22 am

The size of the dataBlock in system is equal to size of the page in system.

check with getpagesize() & dumpe2fs.



19 ManikantaVarma September 22, 2011 at 10:27 am

create an empty file say file.txt by touch command.
touch file.txt
then type this comman on konsole
# du -h file.txt



20 Muzza March 10, 2014 at 3:13 am

An alternative command.

# /sbin/blockdev –getbsz /dev/sda1


Leave a Comment

Previous post:

Next post: