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
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
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.
– polym
Jul 18 '14 at 08:23
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
. – HalosGhost Jul 18 '14 at 08:17man blockdev
doesn't help him/her. According to the man page this command is correct. – polym Jul 18 '14 at 08:19blockdev --setbsz=2048 /dev/sda5
? Maybe the man page is missing a = and this command should not have a whitespace – polym Jul 18 '14 at 08:20If you unmount your filesystems and change this per device, I would imagine it will screw up filesystems on the device but haven't tried it.
Basically, backup your data, recreate filesystems any way you want, copy data back. I don't think you can change this on a whim.
– Tomas Pruzina Jan 15 '18 at 17:13