Growing LVM partitions with XFS

Posted on Oct 12, 2025

After (finally) swapping the 240G SATA to a 1000G one in my NAS, this is what I’ve done to get the rootfs extended.

First of all, this is the current status of my disk:

nas:~# lsblk 
NAME                     MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
loop0                      7:0    0 636.9G  0 loop  /mnt/data/media/games
sda                        8:0    0 931.5G  0 disk  
├─sda1                     8:1    0   600M  0 part  /boot/efi
├─sda2                     8:2    0     1G  0 part  /boot
└─sda3                     8:3    0   222G  0 part  
  └─fedora_fedora-root   252:0    0   222G  0 lvm   /
nas:~# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               fedora_fedora
  PV Size               221.98 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              56827
  Free PE               0
  Allocated PE          56827
  PV UUID               5xZhit-jL8J-YFce-XGO2-e412-DKIe-hVV0Qf

Extending the partitions with parted

First step is to group the sda3 partition from its glorious 222G to whatever I can take:

nas:~# parted 
GNU Parted 3.6
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help                                                             
  align-check TYPE N                       check partition N for TYPE(min|opt) alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all]            display the partition table, or available devices, or free space, or all found partitions
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  resizepart NUMBER END                    resize partition NUMBER
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  type NUMBER TYPE-ID or TYPE-UUID         type set TYPE-ID or TYPE-UUID of partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright information of GNU Parted

(parted) print free                                                       
Model: ATA CT1000BX500SSD1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  630MB   629MB   fat32        EFI System Partition  boot, esp
 2      630MB   1704MB  1074MB  xfs
 3      1704MB  240GB   238GB                                      lvm
        240GB   1000GB  760GB   Free Space

Then tried to resize partition without reading the manual (it didn’t go well):

(parted) resizepart 3
End?  [240GB]? 1000GB
Error: Can't have overlapping partitions.

After reading the manual, percentages can be used. I’ve took the remaining free space just for this partition.

(parted) resizepart 3 100%                                            
(parted) print 
Model: ATA CT1000BX500SSD1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  630MB   629MB   fat32        EFI System Partition  boot, esp
 2      630MB   1704MB  1074MB  xfs
 3      1704MB  1000GB  999GB                                      lvm

(parted) quit                                                             

Executed partprobe afterwards to refresh the thing:

nas:~# partprobe /dev/sda

Resizing the LVM volumes

Next steps, to extend the physical and logical volumes:

nas:~# df -hT
Filesystem                     Type      Size  Used Avail Use% Mounted on
/dev/mapper/fedora_fedora-root xfs       222G  170G   53G  77% /
nas:~# pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

Physical volume was simple enough, the options for lvextend were not trivial to me; -l option takes (extents) takes a value with a unit. %FREE seems to be a unit by itself. Thus the following grows the logical volume to the maximum free space after it.

nas:~# lvextend -l +100%FREE /dev/mapper/fedora_fedora-root
  Size of logical volume fedora_fedora/root changed from 221.98 GiB (56827 extents) to 929.92 GiB (238060 extents).
  Logical volume fedora_fedora/root successfully resized.

Resize the file-system

In my case, my root is using XFS, then it’s simple enough:

nas:~# xfs_growfs /
meta-data=/dev/mapper/fedora_fedora-root isize=512    agcount=60, agsize=983040 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0 nrext64=0
         =                       exchange=0  
data     =                       bsize=4096   blocks=58190848, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
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 58190848 to 243773440
nas:~# df -h /
Filesystem                      Size  Used Avail Use% Mounted on
/dev/mapper/fedora_fedora-root  930G  175G  756G  19% /

Done.