Product SiteDocumentation Site

3.2.3. Exercise 3

This lab demonstrates the inode rotor in action.
  1. Firstly, a filesystem large enough to trigger inode32 rotor behavior is needed. This can be achieved on a small local disk by creating a large sparse file, writing a new filesystem onto it and mounting it in loopback mode.
    > dd if=/dev/zero of=loop bs=4K seek=1G count=1 > /dev/null 2>&1
    > ls -sh loop
    4.1T loop
    > mkfs.xfs -d file=loop loop
    meta-data=loop                   isize=256    agcount=32, agsize=33554432 blks
             =                       sectsz=512   attr=0
    data     =                       bsize=4096   blocks=1073741824, imaxpct=25
             =                       sunit=0      swidth=0 blks, unwritten=1
    naming   =version 2              bsize=4096  
    log      =internal log           bsize=4096   blocks=32768, version=1
             =                       sectsz=512   sunit=0 blks
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    > xfs_db -f -c "sb 0" -c "p" ./loop | egrep 'agcount|inopblog|agblklog'
    agcount = 32
    inopblog = 4
    agblklog = 25
    > sudo mkdir /mnt/loop
    > sudo mount -o loop loop /mnt/loop
    > df -h /mnt/loop
    Filesystem            Size  Used Avail Use% Mounted on
    /home/sjv/loop        4.0T  528K  4.0T   1% /mnt/loop
    > sudo chmod 777 /mnt/loop
    > cd /mnt/loop
  2. Next, ten files are created in a directory on the new filesystem and their inode numbers and data extent allocations are examined:
    > dir=a
    > mkdir $dir
    > for file in `seq 0 9`; do xfs_mkfile 10m $dir/$file; done
    > ls -is $dir/*
    > for file in `seq 0 9`; do
    > ag=`xfs_bmap -v $dir/$file | tail -1 | awk '{print $4}'`
    > echo $dir/$file is in AG $ag
    > done
  3. Repeat step 2 with a different rotorstep value:
    > sudo sysctl -w fs.xfs.rotorstep=3
    > dir=b