XFS grow not working
Asked Answered
H

4

10

So I have the following setup:

[ec2-user@ip-172-31-9-177 ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  80G  0 disk 
├─xvda1 202:1    0   6G  0 part /
└─xvda2 202:2    0   4G  0 part /data

All the tutorials I find say to use xfs_growfs <mountpoint> but that has no effect, nor has the -d option:

[ec2-user@ip-172-31-9-177 ~]$ sudo xfs_growfs -d /
meta-data=/dev/xvda1             isize=256    agcount=4, agsize=393216 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=1572864, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data size unchanged, skipping

I should add that I am using:

[ec2-user@ip-172-31-9-177 ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[ec2-user@ip-172-31-9-177 ~]$ xfs_info -V
xfs_info version 3.2.0-alpha2
[ec2-user@ip-172-31-9-177 ~]$ xfs_growfs -V
xfs_growfs version 3.2.0-alpha2
Hyoscyamus answered 12/8, 2014 at 10:55 Comment(0)
C
4

You have a 4GB xfs file system on a 4GB partition, so there is no work to do.

To overcome, enlarge the partition with parted then use xfs_growfs to expand the fs. You can use parted rm without losing data.

# umount /data
# parted
GNU Parted 3.1
Using /dev/xvda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit s
(parted) print
....
(parted) rm 2
(parted) mkpart
....
(parted) print
(parted) quit

# xfs_growfs /dev/xvda2
# mount /dev/xvda2 /data

Done. No need to update /etc/fstab as the partition numbers are the same.

Contango answered 20/11, 2014 at 15:14 Comment(0)
A
15

Before running xfs_growfs, you must resize the partition the filesystem sits on.

Give this one a go:

sudo growpart /dev/xvda 1

As per https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html

Acosta answered 5/6, 2018 at 23:25 Comment(1)
Thats the most correct answer! was struggling for 2 days with Amazon AMISoto
C
4

You have a 4GB xfs file system on a 4GB partition, so there is no work to do.

To overcome, enlarge the partition with parted then use xfs_growfs to expand the fs. You can use parted rm without losing data.

# umount /data
# parted
GNU Parted 3.1
Using /dev/xvda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit s
(parted) print
....
(parted) rm 2
(parted) mkpart
....
(parted) print
(parted) quit

# xfs_growfs /dev/xvda2
# mount /dev/xvda2 /data

Done. No need to update /etc/fstab as the partition numbers are the same.

Contango answered 20/11, 2014 at 15:14 Comment(0)
B
3

Before running xfs_growfs, Please do the following step first:

#growpart <devicenametobeextend> 

# growpart /dev/xvda 1                                                                                                                                                                   
CHANGED: partition=1 start=4096 old: size=31453151 end=31457247 new: size=41938911,end=41943007

#xfs_growfs -d /

enter FYI for your reference

Belomancy answered 28/3, 2019 at 8:7 Comment(0)
B
2

Many Servers by default won't have growpart utils So you can follow the below steps to do

  1. Install growpart utils using package manager as per OS distribution below is for RPM/FEDORA based.

    yum install cloud-utils-growpart

  2. Run the growpart command on the partition which has to change.

    growpart /dev/xvda 1

  3. Finally run the xfs_growfs command.

    xfs_growfs -d /dev/xvda1

Belomancy answered 21/5, 2020 at 11:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.