Anyone can provide me any test case for the below command:
blockdev --setbsz BYTES
to set/change the block size.
I have tried like below but no luck.
$ blockdev --setbsz 2048 /dev/sda5
blockdev: 2048: No such file or directory
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityAnyone can provide me any test case for the below command:
blockdev --setbsz BYTES
to set/change the block size.
I have tried like below but no luck.
$ blockdev --setbsz 2048 /dev/sda5
blockdev: 2048: No such file or directory
Check the block size of current device.
$ blockdev --getbsz /dev/vdb1
512
Unmount filesystem to change block size.
$ umount /dev/vdb1
Create filesystem to change new block size.
$ mkfs -t ext4 -b 4096 /dev/vdb1
Mount to check the changed block size.
$ mount /dev/vdb1 /test/
$ blockdev --getbsz /dev/vdb1
4096
You have to do it as root user after unmounting that device.
# this is as root user
[root@pse-linvm ~]# blockdev --setbsz 4096 /dev/vda2
BLKBSZSET: Device or resource busy
[root@pse-linvm ~]# blockdev --setbsz 4096 /dev/vda6
/dev/vda6: No such file or directory
# this is normal user
[root@pse-linvm ~]# su - raja
[raja@pse-linvm ~]$ blockdev --getbsz /dev/vda2
/dev/vda2: Permission denied
# Error same as yours
[raja@pse-linvm ~]$ blockdev --getbsz 4096 /dev/vda2
4096: No such file or directory
blockdev
should fix their error messages.
Not an answer - just posting in answer box for clarity
[dani@localhost ~]$ blockdev --getbsz /dev/sda1
blockdev: cannot open /dev/sda1: Permission denied
[dani@localhost ~]$
[dani@localhost ~]$ su -
Password:
[root@localhost ~]# blockdev --getbsz /dev/sda1
1024
[root@localhost ~]# blockdev --setbsz 1024 /dev/sda1
BLKBSZSET: Device or resource busy
[root@localhost ~]# umount /boot
[root@localhost ~]# blockdev --setbsz 1024 /dev/sda1
works well on fd20 with linux-utils 2.24.2
man blockdev
.man blockdev
doesn't help him/her. According to the man page this command is correct.