//as-is
[root@ip-172-28-72-124 /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 100G 0 disk
├─nvme0n1p1 259:1 0 100G 0 part /
└─nvme0n1p128 259:2 0 1M 0 part
————————————————————————————————————
// to-be
[root@ip-172-28-72-124 /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 100G 0 disk
├─nvme0n1p1 259:1 0 50G 0 part /
├─nvme0n1p2 259:1 0 50G 0 part /data
└─nvme0n1p128 259:2 0 1M 0 part
————————————————————————————————————
The file system is xfs. How can I change nvme0n1p1 to 50G?
I tried to change the size using xfs_growfs but it failed.
xfs_growfs is used for the opposite of what you want. If you are using a RHEL based system, official answer is you cannot.
"After an XFS file system is created, its size cannot be reduced. However, it can still be enlarged using the xfs_growfs command. For more information, see Section 3.4, “Increasing the Size of an XFS File System”)."
You may find some hacky ways of doing it but there is a risk element there. I would recommend simply creating and attaching a 50Gig ebs volume if you simply need a second disk.