Increase filesystem size

General support questions
Post Reply
User avatar
kharvatis
Posts: 13
Joined: 2018/11/12 08:11:00
Location: Greece

Increase filesystem size

Post by kharvatis » 2021/06/07 07:59:01

Hi all.

I have been researching on how to move disk space from /home to /root, and I thought I got it, but the lv-to-be-extended filesystem looks the same size after the procedure.

I unmounted /home, backed it up, deleted, and created a new one, formatted it and restored/mounted it.
All is good there, and now I have several Gs to spare.

I do lvextend on /dev/centos/root, operation returns "successful", but /root remains the same size.

Code: Select all

[root@support ~]# lvextend -L +200G /dev/centos/root
  Size of logical volume centos/root changed from 50,00 GiB (12800 extents) to 250,00 GiB (64000 extents).
  Logical volume centos/root successfully resized.
DF returns original size on /dev/mapper/centos-root. What did I miss?

tia

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: Increase filesystem size

Post by MartinR » 2021/06/07 08:15:40

You've extended the partition but not the filesystem. You need something like xfs_growfs or resize2fs.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Increase filesystem size

Post by jlehtone » 2021/06/07 09:40:44

MartinR wrote:
2021/06/07 08:15:40
You've extended the partition but not the filesystem. You need something like xfs_growfs or resize2fs.
The lvextend would have had option --resizefs that would have called appropriate tool.
Since it was not used, one has to do the filesystem extension separately.


Note: Partition is not filesystem.
Partition is a (sequential) set of sectors (LBAs) on storage media (e.g. disk).
Filesystem is metadata (and data) on some sectors within a partition.

User avatar
kharvatis
Posts: 13
Joined: 2018/11/12 08:11:00
Location: Greece

Re: Increase filesystem size

Post by kharvatis » 2021/06/07 15:45:10

Thank you guys! However I am still unsure, and also a bit frustrated as I have to extend this /root directly on a production system.

I take it from here viewtopic.php?t=71993 that I need to xfs_growfs. But it is still unclear to me, no matter how hard I google it :P So, at this point, is

Code: Select all

xfs_growfs -L 200G /root
the right thing to do?

(By the way, I also can't figure out which command will show those stray 200Gs right now. No need, but just curious)

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: Increase filesystem size

Post by MartinR » 2021/06/07 16:00:23

First, a general comment: Google is unreliable. Next another comment: Google tells you fibs. ... and finally: Never trust Google.

The best place to go for information is the man page or else the Red Hat books.

So Google tells you:

Code: Select all

xfs_growfs -L 200G /root
does it. Hmm, if you do that you'll not see the space, you are extending the log. Score -1 to some random web site.

The man page gives you
-d | -D size Specifies that the data section of the filesystem should be grown. ...the data section is grown to the largest size possible with the -d option.
So that suggests:

Code: Select all

# xfs_growfs -d /root
would be a good way to go. Read the man page and get back to us if you don't understand why. To be an effective sysadmin you must become familiar with stuff like this.

User avatar
kharvatis
Posts: 13
Joined: 2018/11/12 08:11:00
Location: Greece

Re: Increase filesystem size

Post by kharvatis » 2021/06/08 21:11:30

Indeed I was quite hasty, did not rtfm :) Thank you very much for your help.
All is in order now; filesystem grown, services running smoothly. I appreciate it.

Post Reply