Thursday, October 7, 2010

Finding default block size in Linux

How to find default block size in Linux?
Answer:  
# tune2fs -l /dev/sda1 | grep Block
Block count:                4980736
Block size:                    4096
Blocks per group:     32768
From this example, you can see that the default block size for the filesystem on /dev/sda1 partition is 4096 bytes, or 4k. That's the default block size for ext3 filesystem.    


How to define the block size while creating  ext3 filesystem ?

 Answer:    

 # mkfs.ext3 –b <block size>  <Device>
 
Example:   # mkfs.ext3 -b 2048 /dev/sda1                
This creates a filesystem with 2KB block size on partition /dev/sda1.

3 comments:

  1. Thank you Ashok for the valuable information.

    ReplyDelete
    Replies
    1. Hi Ashok,

      I like your blog very much...Its amazing..

      Could you please keep a post for find command for finding large size files, large files generating directories in different ways...Generally we will see all basic types of commands in google search..but we want to see different types of commands in your blog style...

      Thank you...

      Delete
    2. Hello,

      Thanks for your comments.

      I've already posted few posts on using 'find' command to find huge-sized files and report it. Please have a look at these following posts:

      http://ashok-linux-tips.blogspot.com/2012/01/find-syntax-to-list-huge-sized-files.html
      http://ashok-linux-tips.blogspot.com/2010/12/finding-total-size-of-files-owned-by.html
      http://ashok-linux-tips.blogspot.com/2012/06/script-to-check-file-system-usage-in.html

      Regards
      Ashok

      Delete