Linux – Resize XFS Partition (Increase)

hard drivelinuxUbuntuxfs

I'm new to xfs and was wondering how to increase the size of /var and /home, I'm guessing xfs does not simply increase in size as needed…

Filesystem    Type     Size   Used  Avail Use% Mounted on
/dev/sda1     ext3     4.0G   418M   3.6G  11% /
none      devtmpfs     4.2G   205k   4.2G   1% /dev
none         tmpfs     4.2G      0   4.2G   0% /dev/shm
none         tmpfs     4.2G      0   4.2G   0% /tmp
none         tmpfs     4.2G    58k   4.2G   1% /var/run
none         tmpfs     4.2G      0   4.2G   0% /var/lock
none         tmpfs     4.2G      0   4.2G   0% /lib/init/rw
/dev/mapper/vg00-usr
               xfs     4.3G   640M   3.7G  15% /usr
/dev/mapper/vg00-var
               xfs     4.3G   657M   3.7G  16% /var
/dev/mapper/vg00-home
               xfs  

4.3G   1.9G   2.5G  44% /home

also:

# parted
 /dev/sda
GNU Parted 2.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: Areca ARC-1110-VOL#00 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system     Flags
 1      32.3kB  4006MB  4006MB  primary  ext3
 2      4006MB  6013MB  2007MB  primary  linux-swap(v1)
 3      6013MB  1000GB  994GB   primary                  lvm

Best Answer

You're using LVM, which is good. As long as the logical volume within which /var and /home reside is bigger than they are now, you can do the resize with xfs_growfs.

First make sure the logical volume you're using for the two partitions is bigger than 3.7G (for /dev/mapper/vg00-var) and 2.5G (for /dev/mapper/vg00-home):

bash$ lvdisplay <partition> | grep 'LV Size'

If the logical partition is bigger (so your FS has room to grow), you're all set.
If it's not, then you need to look at the physical volume group which contains the above logical volume, and make sure there is enough space in there to grow the logical volume first.