Product SiteDocumentation Site

2.2.5. Exercise 5

Make an XFS filesystem with more allocation groups to allow more parallelism when allocating blocks and inodes. Increasing the number of allocation groups will decrease the space available in each group. For most workloads, filesystem configurations with a very small or very large number of allocation groups should be avoided. The capacity of your block device may cause mkfs.xfs to report different values for agcount and agsize. For this exercise take the default agcount value and double it.
  1. Create a simple filesystem first.
    # mkfs -t xfs -f /dev/sda4
    meta-data=/dev/sda4              isize=256    agcount=16, agsize=461617 blks
             =                       sectsz=512   attr=0
    data     =                       bsize=4096   blocks=7385872, imaxpct=25
             =                       sunit=0      swidth=0 blks, unwritten=1
    naming   =version 2              bsize=4096
    log      =internal log           bsize=4096   blocks=3606, version=1
             =                       sectsz=512   sunit=0 blks
    realtime =none                   extsz=65536  blocks=0, rtextents=0
    
  2. In this example. the default agcount is 16 so let's try 32.
    # mkfs -t xfs -f -d agcount=32 /dev/sda4
    meta-data=/dev/sda4              isize=256    agcount=32, agsize=230809 blks
             =                       sectsz=512   attr=0
    data     =                       bsize=4096   blocks=7385883, imaxpct=25
             =                       sunit=0      swidth=0 blks, unwritten=1
    naming   =version 2              bsize=4096
    log      =internal log           bsize=4096   blocks=3606, version=1
             =                       sectsz=512   sunit=0 blks
    realtime =none                   extsz=65536  blocks=0, rtextents=0
    
  3. Or alternatively, set the allocation group size. In this example set each allocation group to 4GB. If the capacity of your block device is less than 4GB mkfs will fail, in this case pick a value for agsize that is one quarter of the device's capacity.
    # mkfs -t xfs -f -d agsize=4g /dev/sda4
    meta-data=/dev/sda4              isize=256    agcount=8, agsize=1048576 blks
             =                       sectsz=512   attr=0
    data     =                       bsize=4096   blocks=7385883, imaxpct=25
             =                       sunit=0      swidth=0 blks, unwritten=1
    naming   =version 2              bsize=4096
    log      =internal log           bsize=4096   blocks=3606, version=1
             =                       sectsz=512   sunit=0 blks
    realtime =none                   extsz=65536  blocks=0, rtextents=0