Product SiteDocumentation Site

2.2.6. Exercise 6

Grow an XFS filesystem.
  1. Start off by creating an XFS filesystem that uses only a portion of the available space on the device. We can do this by specifying the size option.
    # mkfs -t xfs -f -d size=1g /dev/sda4
    meta-data=/dev/sda4              isize=256    agcount=8, agsize=32768 blks
             =                       sectsz=512   attr=0
    data     =                       bsize=4096   blocks=262144, imaxpct=25
             =                       sunit=0      swidth=0 blks, unwritten=1
    naming   =version 2              bsize=4096
    log      =internal log           bsize=4096   blocks=2560, version=1
             =                       sectsz=512   sunit=0 blks
    realtime =none                   extsz=65536  blocks=0, rtextents=0
    
  2. Mount the filesystem:
    # mount /dev/sda4 /mnt
    
  3. The current capacity of the filesystem is 262144 blocks. To double the capacity, grow the filesystem to a capacity of 524288 blocks with:
    	# xfs_growfs -D 524288 /mnt
    meta-data=/dev/sda4              isize=256    agcount=8, agsize=32768 blks
             =                       sectsz=512   attr=0
    data     =                       bsize=4096   blocks=262144, imaxpct=25
             =                       sunit=0      swidth=0 blks, unwritten=1
    naming   =version 2              bsize=4096
    log      =internal               bsize=4096   blocks=2560, version=1
             =                       sectsz=512   sunit=0 blks
    realtime =none                   extsz=65536  blocks=0, rtextents=0
    data blocks changed from 262144 to 524288
    
  4. Verify the new filesystem capacity:
    # xfs_info /mnt
    meta-data=/dev/sda4              isize=256    agcount=16, agsize=32768 blks
             =                       sectsz=512   attr=0
    data     =                       bsize=4096   blocks=524288, imaxpct=25
             =                       sunit=0      swidth=0 blks, unwritten=1
    naming   =version 2              bsize=4096
    log      =internal               bsize=4096   blocks=2560, version=1
             =                       sectsz=512   sunit=0 blks
    
  5. The default behaviour of xfs_growfs is to grow the filesystem to the maximum available capacity:
    # xfs_growfs /mnt
    
  6. Continually growing a filesystem can have it's drawbacks – a grown filesystem keeps its allocation size fixed and increases the allocation group count in order to accommodate the new capacity. As we can see from the following filesystem geometry the allocation group count is very high.
    # xfs_info /mnt