Thursday, September 13, 2012

Get Linux file system blocksize

In a previous post I discussed the topic of blocksize for an Oracle database. As you have seen in this post it can be important to understand which blocksize to select when creating your database. When talking about blocksize it is also good to know what the blocksize is on your files system. Your database and the way it is requesting blocks from disk is related to the blocksize on your file system mounted to your operating system.

If you want to know the blocksize of your file system you can check this in multiple ways. One of the most commonly used ways is to execute the below command:

dumpe2fs /dev/sda1 | grep -i 'Block size'

this calls dumpe2fs, prints the super block and blocks group information for the filesystem present on device. in the above example we gather the information of /dev/sda1

As you can see we do a grep on 'Block size'. If you do not grep this you will get a LOT of information. the most usable for most users is the first part. You can simply use a more to get this information in the most easy way:

dumpe2fs | more

as an example you can see the output of this below which is the information of one of my workstations:

dumpe2fs 1.42 (29-Nov-2011)
Filesystem volume name:   
Last mounted on:          /
Filesystem UUID:          584232d2-3bc8-41bb-9534-c3a4f4f6e64c
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              91054080
Block count:              364187648
Reserved block count:     18209382
Free blocks:              337917734
Free inodes:              90742705
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      937
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Sat Dec 31 17:42:47 2011
Last mount time:          Sun Sep  9 20:37:55 2012
Last write time:          Wed Apr 11 17:52:11 2012
Mount count:              11
Maximum mount count:      21
Last checked:             Wed Apr 11 17:52:11 2012
Check interval:           15552000 (6 months)
Next check after:         Mon Oct  8 17:52:11 2012
Lifetime writes:          225 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
First orphan inode:       70780693
Default directory hash:   half_md4
Directory Hash Seed:      c55ef959-1938-4934-b178-eb9409c00d0b
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
Journal size:             128M
Journal length:           32768
Journal sequence:         0x00102c0c
Journal start:            30520

No comments: