Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6723
  • Last Modified:

How to change disk block size in Redhat linux server

I was trying to change disk block size in linux server but it does not work for me,

blockdev -setbsz 8192 /dev/sdb

Can someone let me know, what should be the proper procedure to change block size for disk on linux.

Thanks
0
sams20
Asked:
sams20
  • 2
2 Solutions
 
gheistCommented:
To change disk blocksize to 8K you need to go to blacksmith... It is not a software option.

cat /sys/block/sda/queue/*_block_size
basically any mention of 4096 says you have AF drive and 4k block is optimal (you can still try to set such drive to 512 byte blocks to reduce performance 8x and rise disk wear 8x
0
 
xeroxzeroxCommented:
In ext3, an 8K block size on the fs is only possible if you use Itanium and other 8K architectures. If your architecture is x86, x86_64, it is not possible to have a block size greater than 4k. If you try to make an ext3 fs you will fail with an error message similar to this:

mkfs.ext3: 8192-byte blocks too big for system (max 4096)

So,if your server architecture can take it, you can
use parted post installation to make the partition and then type the following example

mkfs -t ext3 -b 8192 /dev/sda

For more information you should go redhat site
https://access.redhat.com/site/documentation/en-US/
0
 
sams20Author Commented:
What about ext4, In my system most of file systems type is ext4. In this case, what about this command  " mkfs -t ext4 -b 8192 /dev/sda" .
0
 
gheistCommented:
Did you check physical disk block size?
"cat /sys/block/sda/queue/*_block_size"
If it is 4K in either number - 4K is your only choice
If it is both 512 you have choices of 1K 2K 4K (but other than 4K will not work for /boot)

your command will not work:
"man 2 mke2fs"
OPTIONS
       -b block-size
              Specify the size of blocks in bytes.  Valid block-size values are 1024, 2048 and 4096 bytes per block.  If omitted, block-size is heuristically determined by the filesystem size and the expected usage of the filesystem (see the  -T
              option).   If  block-size is preceded by a negative sign ('-'), then mke2fs will use heuristics to determine the appropriate block size, with the constraint that the block size will be at least block-size bytes.  This is useful for
              certain hardware devices which require that the blocksize be a multiple of 2k.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now