Trying to install Alma Linux with 2 hard drives, the Ass Hat installer is a PITA for custom partitioning. Wanted home on larger drive and the rest on the other drive. But login after install, and found home was only 500 GB of the 2 TB drive. It was xfs and to my surprise, I see xfs_growfs can run on a mounted drive. So did control-alt-F3 for a text terminal, then sudo xfs_growfs /dev/sda1
It only took a second, so apparently only change partition table limits. Shouldn't format the rest of the drive?
While the XFS partition was mounted...
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 40962047 40960000 19.5G 83 Linux <=== Using fdisk, I deleted the (XFS) partition.
Command (m for help): n <=== Using fdisk, I created a bigger partition definition.
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-104857599, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-104857599, default 104857599): 84857599
Created a new partition 1 of type 'Linux' and of size 40.5 GiB.
Partition #1 contains a xfs signature.
Do you want to remove the signature? [Y]es/[N]o: n <=== The signature should remain of course.
Command (m for help): p
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 84857599 84855552 40.5G 83 Linux <=== You can see my space, is now bigger
Command (m for help):w
Command (m for help):q
*******
***@CASEMINT:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 20469760 175784 20293976 1% /media/bullwinkle/TESTXFS <=== original size (on top of 40.5G declaration)
***@CASEMINT:~$ sudo xfs_growfs -d /media/bullwinkle/TESTXFS <=== NOW, do the growfs
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=1280000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=5120000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 5120000 to 10606944 <=== growfs, verified
***@CASEMINT:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 42417536 329140 42088396 1% /media/bullwinkle/TESTXFS <=== I can see I have extra space
*******
You should really make a backup before you do this.
And "gparted" is likely a safer way to do it.
I don't like the idea of doing this with live data on the partition.
My "fdisk sequence" is just a bad idea, OK? I only did it to make a point.
Doing it hot like that... is bad karma.
Paul