LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Get block size of XFS filesystem. (https://www.linuxquestions.org/questions/linux-newbie-8/get-block-size-of-xfs-filesystem-4175665518/)

ddenial 12-06-2019 08:25 AM

Get block size of XFS filesystem.
 
Hello

I want to know the block size of my XFS partition. Two different commands give two different values.

Code:

$ sudo blockdev --getbsz /dev/vgh/root
512

$ sudo xfs_info /dev/vgh/root
meta-data=/dev/mapper/vgh-root  isize=512    agcount=4, agsize=13107200 blks
        =                      sectsz=512  attr=2, projid32bit=1
        =                      crc=1        finobt=0 spinodes=0
data    =                      bsize=4096  blocks=52428800, imaxpct=25
        =                      sunit=0      swidth=0 blks
naming  =version 2              bsize=4096  ascii-ci=0 ftype=1
log      =internal              bsize=4096  blocks=25600, version=2
        =                      sectsz=512  sunit=0 blks, lazy-count=1
realtime =none                  extsz=4096  blocks=0, rtextents=0

One says its 512 bytes and another says 4096 bytes. Which one is true?

Thanks

MadeInGermany 12-08-2019 04:13 AM

No real knowledge but an idea:
The block device driver works with a block size of 512 for compatibility reason.
So addressing a certain block is independent of the file system. (See block size in the dd command, "man dd").
The xfs_info command knows more about the file system. The xfs bsize might be tunable, the device block size will remain.

JeremyBoden 12-08-2019 09:10 AM

It depends how the disk(?) was set up.
If your disk sectors are set up as 512 bytes then on a physical disk this is not optimal - even though important software may make assumptions that this is the case.

It is much more efficient to use larger sectors - typically 4K bytes and these disks became available some years ago.

To avoid problematic changeovers, these included a compatibility layer to allow these disks to be seen as 512 byte devices.
This can cause performance problems.
Don't know if this affected Linux.

According to the man fdisk page, the sector size parameter is deprecated in favour of the blockdev command.

But perhaps XFS is clever enough to override 512 bytes?
A lengthy discussion can be found at https://en.wikipedia.org/wiki/Advanced_Format


All times are GMT -5. The time now is 06:08 AM.