Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to find out what the kernel block size is from vmstat output. I am specifically looking for kernel block size as defined in Block devices and block sizes. There it says all Linux blocks are currently 1024 bytes, but this is not true for old kernels.

Is there a command I can use to view the kernel block size?

share|improve this question

migrated from serverfault.com Oct 18 '12 at 17:17

This question came from our site for professional system and network administrators.

1  
Why? What are you trying to do? –  ewwhite Oct 18 '12 at 0:55
    
I am trying to read the vmstat output in a meaningful way. Right now I can see blocks in and blocks out, but that does not tell me how much that is in terms of size. I would like to know if 512 B = 1 block or 1KB = 1 block, or something else. –  dabest1 Nov 2 '12 at 17:36
1  
Linux uses 4KiB blocks almost universally. –  vonbrand Jan 24 '13 at 19:17

1 Answer 1

man 8 vmstat says:

NOTES

    All linux blocks are currently 1024 bytes.

From sysstat/common.c

        /* One can also use getpagesize() to get the size of a page */
        if ((size = sysconf(_SC_PAGESIZE)) == -1) {
                perror("sysconf");
        }

From unistd.h

./unistd.h-/* Return the number of bytes in a page.  This is the system's page size,
./unistd.h-   which is not necessarily the same as the hardware page size.  */
./unistd.h:extern int getpagesize (void)  __THROW __attribute__ ((__const__));
share|improve this answer
    
As I mentioned in my question, I think this applies to current versions of Linux only, but does not apply to older kernels. Thus I am asking if there is a command or configuration which will show the actual block size. –  dabest1 Jan 30 at 23:16
    
Don't be afraid to look at the code. –  bersch Jan 30 at 23:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.