I have a 25 gb disk storage on ec2 instance. Im unable to connect to the ec2 instance using the remote ssh on vs code, the error I get is as follows:
mkdir: cannot create directory ‘/home/ubuntu/.vscode-server/bin/62xxxx..b’: No space left on device
How do I clear memory If I cannot connect?
I'm not sure if adding extra memory is the solution here? I added a 2gb disk but that didn't help.
I have tried rebooting and force stopping the ec2 instance. It reboots and starts however, Im unable to connect to it.
CodePudding user response:
It's difficult to resolve this if the EC2 instance is unresponsive and you can't access it:
- Increasing the size of the existing volume from the console won't help as you still need to increase the partition size at OS level.
- Attaching a new volume won't help either as you still need to mount and partition this at OS level. Your application(s) has no knowledge of the new volume and will keep trying to write to the original location.
A few solutions, depending on your requirements:
- If you don't need to recover data on the instance, it'd be easier to create a new one.
- If you do need to recover the data on the volume, create an AMI from the instance, then create a new instance from the AMI with increased volume size.
- If you really need to preserve the current instance, replace the root volume by creating an AMI with increased volume size.
CodePudding user response:
Amazon Linux AMIs (and some other ones) will automatically expand the root partition during system startup. Therefore, you can try the following:
- In the Amazon EC2 management console, Modify the Amazon EBS Volume that is for the root drive (you probably only have one volume on the instance)
- Increase the size of the disk
- Reboot the EC2 instance
This should allocate more space to the root partition.
Then, try connecting again and it should work.