Issue
The storage on my Google Cloud Compute Engine Instance (inadvertently) got completely used up. I can no longer SSH into my instance. I have increased the space on my instance, but it still will not allow me to SSH. My VM operating system is Ubuntu.
I have tried two things:
1.) I have tried creating a start script to remove a large directory to clear up some space. Under "custom metadata" I have set the key as "startup-script" and the value as
#! /bin/bash
rm /home/myusername/dir-to-rm
I save and reset the instance, click "connect to serial console", but I still cannot SSH.
2.) I have tried to use a startup script to set a login username and password for the serial console by using the same method, but with the following script:
#! /bin/bash
sudo useradd tmpuser
echo 'tmpuser:password' | chpasswd
Solution
I donated my time to help this person since he is a student. Total time to recover was about an hour.
The problem was caused by a corrupted file system. Repairing the file system corrected the problem. I then resized the disk larger to provide more free space.
During startup, the network interfaces failed to load. This, of course, prevents any form of connectivity. This is why SSH did not work.
Answered By - John Hanley