[CentOS] Expand XFS filesystem on CentOS Linux release 8.2.2004 (Core)

Sun Mar 14 12:12:42 UTC 2021
Strahil Nikolov <hunter86_bg at yahoo.com>

I'm constantly using fdisk on GPT and everything has been fine.
Best Regards,Strahil Nikolov
 
 
  On Fri, Mar 12, 2021 at 15:30, Simon Matter<simon.matter at invoca.ch> wrote:   > Hi,
>
> Is there a way to expand xfs filesystem /dev/nvme0n1p2 which is 7.8G and
> occupy the remaining free disk space of 60GB?
>
> [root at ip-10-0-0-218 centos]# df -hT --total
> Filesystem    Type      Size  Used Avail Use% Mounted on
> devtmpfs      devtmpfs  1.7G    0  1.7G  0% /dev
> tmpfs          tmpfs    1.7G    0  1.7G  0% /dev/shm
> tmpfs          tmpfs    1.7G  23M  1.7G  2% /run
> tmpfs          tmpfs    1.7G    0  1.7G  0% /sys/fs/cgroup
> */dev/nvme0n1p2 xfs      7.8G  7.0G  824M  90% /* ---->
> expand /dev/nvme0n1p2 which is 7.8G and occupy the remaining free disk
> space of 60GB.
> /dev/nvme0n1p1 vfat      599M  6.4M  593M  2% /boot/efi
> tmpfs          tmpfs    345M    0  345M  0% /run/user/1000
> total          -          16G  7.0G  8.5G  46% -
> [root at ip-10-0-0-218 centos]# fdisk -l
> GPT PMBR size mismatch (20971519 != 125829119) will be corrected by write.
> The backup GPT table is not on the end of the device. This problem will be
> corrected by write.

How did you end up in this situation? Did you copy the data from a smaller
disk to this 60G disk?

> *Disk /dev/nvme0n1: 60 GiB*, 64424509440 bytes, 125829120 sectors
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disklabel type: gpt
> Disk identifier: E97B9FFA-2C13-474E-A0E4-ABF1572CD20C
>
> Device            Start      End  Sectors  Size Type
> /dev/nvme0n1p1    2048  1230847  1228800  600M EFI System
> /dev/nvme0n1p2  1230848 17512447 16281600  7.8G Linux filesystem
> /dev/nvme0n1p3 17512448 17514495    2048    1M BIOS boot

Looks like you could move p3 to the end of the disk and then enlarge p2
and then grow the XFS on it.

I'm not sure it's a good idea to use fdisk on a GPT disk. At least in the
past this wasn't supported and I don't know how much has changed here. I
didn't touch a lot of GPT systems yet, and where I did I felt frightened
by the whole EFI stuff :)

Regards,
Simon

_______________________________________________
CentOS mailing list
CentOS at centos.org
https://lists.centos.org/mailman/listinfo/centos