Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I want to resize my linux root volume to create a separate partition. (aws ec2)

//as-is

[root@ip-172-28-72-124 /]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading