Hey Guys,
Hope you’re all well.
Quick one , im trying to reduce the size of an EBS volume (boot device) that is attached to an EC2 instance.I having an challenge doing so as it seems AWS doesn’t allow that to be possible.
What i tried doing is creating a new volume and copying the old data from the original EBS to new EBS, and using the new reduced EBS volume as a boot device, but the Instance doesn’t boot anymore.
I’d appreciate any advice.
Thanks
I have never done this in AWS but with a standard Linux box, the disk needs to have a Master Boot Record at the beginning. Therefore if you swap an HDD in a PC with Linux and simply copy the files over it will not work either. A bit-copy is necessary to copy each bit of the disk exactly where it was before.
Hi , thanks very much for your reply.
I will keep that in mind and see if this is possible in AWS.
You’re welcome. Maybe one more thing. When I had similar issues before, I always strived for:
- stateless machines - the machine can be discarded at any time because it is only doing the compute and is not holding any data critical for the application. Caches and similar temporary files are OK.
- automation - Ansible is my best friend when dealing with VMs and I have everything declaratively described in a GIT repository. When such a situation occurs, I usually destroy the whole machine, change the disk size or any other parameter, and create a new one. Ansible makes sure it has all the necessary software and configuration.
It is an investment and I agree that this can not be achieved overnight, however, in my experience this investment paid back multiple times already.