Skip to content

Instantly share code, notes, and snippets.

@sgzijl
Last active December 25, 2015 10:09
Show Gist options
  • Save sgzijl/6959577 to your computer and use it in GitHub Desktop.
Save sgzijl/6959577 to your computer and use it in GitHub Desktop.
XFS resize test (Ubuntu 13.04, xfsprogs 3.1.9)
# resize2fs allows offline & online resizing.
root@test:~# lvcreate -n test -L100M vg00
Logical volume "test" created
root@test:~# mkfs.ext4 /dev/vg00/test
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
25688 inodes, 102400 blocks
5120 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
13 block groups
8192 blocks per group, 8192 fragments per group
1976 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
root@test:~# lvextend -L+100M /dev/vg00/test
Extending logical volume test to 200.00 MiB
Logical volume test successfully resized
root@test:~# resize2fs /dev/vg00/test
resize2fs 1.42.5 (29-Jul-2012)
Resizing the filesystem on /dev/vg00/test to 204800 (1k) blocks.
The filesystem on /dev/vg00/test is now 204800 blocks long.
# xfs allows online resizing only.
root@test:~# lvcreate -n test -L100M vg00
Logical volume "test" created
root@test:~# mkfs.xfs /dev/vg00/test
meta-data=/dev/vg00/test isize=256 agcount=4, agsize=6400 blks
= sectsz=512 attr=2, projid32bit=0
data = bsize=4096 blocks=25600, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal log bsize=4096 blocks=1200, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
root@test:~# lvextend -L+100M /dev/vg00/test
Extending logical volume test to 200.00 MiB
Logical volume test successfully resized
root@test:~# xfs_growfs /dev/vg00/test
xfs_growfs: /dev/vg00/test is not a mounted XFS filesystem
root@test:~# mkdir -p /mnt/test
root@test:~# mount /dev/vg00/test /mnt/test
root@test:~# xfs_growfs /dev/vg00/test
meta-data=/dev/mapper/vg00-test isize=256 agcount=4, agsize=6400 blks
= sectsz=512 attr=2
data = bsize=4096 blocks=25600, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal bsize=4096 blocks=1200, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 25600 to 51200
root@test:~# df -m /mnt/test
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/vg00-test 196 6 191 3% /mnt/test
root@test:~# umount /mnt/test
root@test:~# lvremove /dev/vg00/test
Do you really want to remove active logical volume test? [y/n]: y
Logical volume "test" successfully removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment