Bobcares

Extending XFS filesystem – How to do it?

by | Nov 18, 2021

Extending XFS filesystem is possible using the xfs_growfs Command

As part of our Server Management Services, we assist our customers with several XFS queries.

Today, let us see how our techs extend their filesystem size.

 

Extending XFS filesystem

We can use the xfs_growfs command to increase the size of an XFS file system. It must be mounted and there must be space available on the underlying device.

The syntax of the xfs_growfs command is as follows:

# xfs_growfs [options] mount-point

Currently, we cannot shrink or reduce an XFX filesystem. So, ensuring the device size is not larger than the intended size is essential.

  • Verify the current size

We can check the filesystem details prior to growing the filesystem:

# xfs_growfs -n /dev/vg_test/lv_test
meta-data=/dev/mapper/vg_test-lv_test isize=512 agcount=4, agsize=32000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=128000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

Here, the -n option does not extend, but prints the current filesystem details.

In addition, to view the current size of the mount point, we check the “df -h” command output:

# df -h
/dev/mapper/vg_test-lv_test 497M 26M 472M 6% /data
  • Extend the underlying device (lvextend, grow LUN, expand partition).

Now, we need to extend the underlying LVM volume. We need to perform this before growing the XFS filesystem.

It is also beneficial if we can extend an existing physical volume in the LVM VG.

In this article, we use a new PV to expand an LV.

1. Initially, we identify the new disk and create a Physical Volume:

# pvcreate /dev/sdc

2. Then we extent the Volume Group vg_test using the new PV:

# vgextend vg_test /dev/sdc

3. Eventually, we verify the new size of the volume group:

# vgdisplay vg_test
--- Volume group ---
VG Name vg_test
System ID 
Format lvm2
Metadata Areas 2
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.99 GiB
PE Size 4.00 MiB
Total PE 10238
Alloc PE / Size 125 / 500.00 MiB
Free PE / Size 10113 / 39.50 GiB
VG UUID wrd9eB-aZo3-HCmD-Rlgr-NcGP-vS2Z-cm2CeQ

4. Finally, we extend the logical volume to the size we require with the help of “lvresize” command:

# lvresize -L +35g /dev/vg_test/lv_test
Size of logical volume vg_test/lv_test changed from 500.00 MiB (125 extents) to 35.49 GiB (9085 extents).
Logical volume vg_test/lv_test successfully resized.
  • Grow the XFS file system

Now, we go ahead and grow the XFS file system:

# xfs_growfs /dev/vg_test/lv_test
meta-data=/dev/mapper/vg_test-lv_test isize=512 agcount=4, agsize=32000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=128000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 128000 to 9303040

As you can see, there is a change in the data blocks from 128000 to 9303040.

  • Verify

Now that we did the steps above, we need to verify the same.

1. To view the XFS volume details, we can use the “xfs_info” command.

Make note of the blocks for the data volume.

# xfs_info /dev/vg_test/lv_test
meta-data=/dev/mapper/vg_test-lv_test isize=512 agcount=291, agsize=32000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=9303040, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

2. After that, we verify the new size of the XFS file system in the “df -h” command output:

# df -hP /data
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_test 36G 35M 36G 1% /data

As we can see, /data mount point size increases from 500MB to ~36GB.

[Need further assistance? We are here for you]

 

Conclusion

In short, we saw how our Support Techs fix the XFS filesystem query for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF