Resizing an XFS filesystem on a multipath device

Jurjen Bokma

March 2012


I 've got a 3 TB filesystem on a SAN volume, and it's growing too large. The server guys added another 3TB to the colume, and now I've got to enlarge the filesystem.

  1. I had to reboot anyway, and now the system sees the extra space:

    apprentice@fileserver:~$ sudo multipath -l
    <snip>
    emc001 (012345678901234566789012345678900) dm-2 DGC,VRAID
    size=5.9T <snip>

  2. apprentice@fileserver:~$ sudo pvresize /dev/dm-2
    Physical volume "/dev/dm-2" changed
    1 physical volume(s) resized / 0 physical volume(s) not resized
    apprentice@fileserver:~$ sudo pvdisplay /dev/dm-2
    --- Physical volume ---
    PV Name               /dev/dm-2
    VG Name               vg-mirror
    PV Size               5.86 TiB / not usable 3.81 MiB
    Allocatable           yes 
    <snip>

  3. XFS filesystems can be enlarged but cannot shrink, so I don't want all that space in my FS yet, and I increase the LV by just 1TB.

    apprentice@fileserver:~$ sudo lvresize -L+1TB /dev/vg-mirror/lv-mirror
    Extending logical volume lv-mirror to 4.12 TiB
    Logical volume lv-mirror successfully resized

  4. apprentice@fileserver:~$ sudo xfs_growfs /srv/pubmirror/
    <snip>
    data blocks changed from 838859776 to 1107295232

  5. apprentice@fileserver:~$ df -h /srv/pubmirror/
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg--mirror-lv--mirror
    4.2T  3.0T  1.2T  72% /srv/pubmirror