Recently Google upgraded their compute engine to remove the ability to have scratch disks. This mad our instance go down and we were not able to connect to it via ssh, as it was TERMINATED. Since we were not able to connect to it we were not able to do the migration to new the compute engine. So we needed to get the data and database from the server, luckily we were able to use the disk but we could not attach it to another instance because it was already attached.
So basically what we did was create a snapshot of the lost instance's disk and created a new disk with that snapshot and attached it to a new instance. The mounted the disk on the new instance to get the data we required.
You could do the creation of disk, attachment etc from the compute engine console or you could install gcutil on your system and use it.
Installing gcutil : https://developers.google.com/compute/docs/gcutil/
Grant access to the gcutil on your system using the "
gcloud auth login" command
Then you have to attach the newly created disk using the attach command in gcutil https://developers.google.com/compute/docs/disks#attach_disk
gcutil --project=<project-id> addinstance --disk=<disk-name>[,deviceName=<alias-name>,mode=<mode>,boot] <instance-name>
Connect to the instance via ssh. Make a folder olddisk in mnt folder, using usr@server: mkdir /mnt/olddisk.
Mount the newly attached disk
To find the disks present and not mount enter fdisk -l in the terminal. If it returns nothing try blkid.
It will usually have line like
/dev/sda1/ label="/" UUID=31923-123... EXT4
/dev/sdb1/ UUID=31923-123... EXT4
The one without the label is probably the one which you just attached and is not mounted. Mount it using.
sudo mount -t ext4 /dev/sda1/ /mnt/olddisk
Then your disk should be mounted on the path /mnt/olddisk/ copy over the files you need. Also don't use safe_format_and_mount command that google provides.