Direkt zum Inhalt

Can I reduce an over-sized EBS volume?

0

Amazon Linux 2 EC2 instance with an EBS GP2 boot volume that has one GPT partition and XFS file system: The EBS volume was extended from 1.5TB to 3TB. Turns out this is greater than necessary. The Linux partition and XFS file system were NOT extended to use the additional volume capacity; the partition and XFS file system are still 1.5TB. Can I reduce the EBS volume to, perhaps, 2TB without damaging the XFS file system?

I am aware that I can replace the volume using a snapshot, etc. I'm looking to avoid that effort if possible.

gefragt vor 4 Jahren16.357 Aufrufe
3 Antworten
0
Akzeptierte Antwort

Hello,

Unfortunately reducing the size of an EBS GP2 volume is not currently supported. The only available options for modifying your EBS volume are:

  • Increasing the size
  • Increase/decreasing the performance
  • Changing the volume type

Your best option if you'd like to decrease the EBS volume size is to:

  1. Create a snapshot of the current volume
  2. Create a new volume and mount it to the existing instance
  3. Copy the data from the existing volume to the new volume
  4. Delete the old volume

While this is not a quick and easy exercise, it is one of the only ways to decrease the volume size.

Documentation: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/requesting-ebs-volume-modifications.html

AWS
EXPERTE
beantwortet vor 4 Jahren
EXPERTE
überprüft vor 2 Jahren
0

If you are using LVM you can also make this change online through pvmove command:

#add the new volume to the volume group
vgextend dbdata01 /dev/sdg
#move all the data from old to new
pvmove -i 1 --alloc anywhere /dev/sdf /dev/sdg
#remove the old volume
vgremove dbdata01 /dev/sdg

Also you can test this on a restored snapshot first on a test instance.

AWS
MODERATOR
beantwortet vor 4 Jahren
  • thanks, but not relevant to my issue

0

Unfortunately, this answer does not take into account that the 'fstab' file will hold the wrong information for booting the system. Especially on 'gp3' drives, this is not effective. I've tried many ways, and have not been successful.

beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.