Home > Net >  Delete EBS volumes not in use without losing data
Delete EBS volumes not in use without losing data

Time:12-29

I have created a ec2 instance and attached 4 ebs volumes, gp2=3gb, gp3=3, io1=4gb, io2=4 and mounted it.

I have installed postgres source code on it and created a database with 2 million sample entries.

By checking, I see that the table or data which i am creating is been stored in root volume xvda1.

I want to delete rest 4 volumes that I have attached to an instance in such a way that it won;t affect the postgresdata. The root volume says 36% use and the rest 4 volumes says 2% use and I think the 2% is storage use to mount it ( not sure ). I wanna know how can i delete it,

  1. should I umount it first and then detach the volume and delete it?

Picture

CodePudding user response:

As your data is in root volume, you can remove all other volumes. For graceful unmounting & preserving data integrity, unmount drives one by one & then delete it. Once all done, just restart your EC2 & check if all your data is still there.

CodePudding user response:

You can detach an Amazon EBS volume from an instance explicitly or by terminating the instance. However, if the instance is running, you must first unmount the volume from the instance.

After you detach a volume, you are still charged for volume storage as long as the storage amount exceeds the limit of the AWS Free Tier. You must delete a volume to avoid incurring further charges.

To Detach an Amazon EBS volume from a Linux instance, refer here

You can also automate using OpsCenter, a feature of AWS Systems Manager, to identify and manage EBS volumes that are unused and detached from an EC2 instance. To implement this setup, refer here

  • Related