I am trying to connect to my Google Cloud VM instance through SSH. I didn't have any problem before I mounted a new 500GB zonal persistent disk and even then I was able to ssh and format the disk and use the GCP instance. I stopped my instance yesterday from GCP GUI and now I cannot ssh using the external IP. How can I fix this ssh problem? My instance is started and running.
$ ssh external_IP_addr
ssh: connect to host external_IP_addr port 22: Connection refused
$ sudo nmap -Pn -p 22 external_IP_addr
Starting Nmap 7.80 ( https://nmap.org ) at 2021-02-09 15:44 EST
Nmap scan report for XYZ.bc.googleusercontent.com (ABC)
Host is up (0.099s latency).
PORT STATE SERVICE
22/tcp closed ssh
Nmap done: 1 IP address (1 host up) scanned in 0.28 seconds
and
$ gcloud compute instances add-metadata myvm \
> --metadata=serial-port-enable=1
ERROR: (gcloud.compute.instances.add-metadata) Could not fetch resource:
- The resource 'projects/rare-origin-289023/zones/us-west1-b/instances/myvm' was not found
These are the commands I used for formatting the disk and mounting it and it was actually usable and I ran experiments using it:
$ sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb
$ sudo mkdir -p /mnt/disks/mona
$ sudo mount -o discard,defaults /dev/sdb /mnt/disks/mona
$ sudo chmod a+w /mnt/disks/mona
$ sudo cp /etc/fstab /etc/fstab.backup
$ sudo blkid /dev/sdb
$ echo UUID=`sudo blkid -s UUID -o value /dev/sdb` /mnt/disks/mona ext4 discard,defaults,NOFAIL_OPTION 0 2 | sudo tee -a /etc/fstab
$ cat /etc/fstab
# /etc/fstab: static file system information
UUID=02132fe0-5012-49f4-8143-2fc1dbfad2b4 / ext4 rw,discard,errors=remount-ro,x-systemd.growfs 0 0
UUID=F77B-E04A /boot/efi vfat defaults 0 0
UUID=8f48ff56-d347-420a-9cfd-280a35e643eb /mnt/disks/mona ext4 discard,defaults,NOFAIL_OPTION 0 2
$ ls /mnt/disks/mona/
total 24
drwx------ 2 root root 16384 Feb 8 20:29 lost+found
drwxrwxrwx 3 root root 4096 Feb 8 20:29 .
drwxr-xr-x 3 root root 4096 Feb 8 20:30 ..
The instance runs Ubuntu 18.04 and I have Ubuntu 20.04 on my local machine.
Using the Web console in GCP GUI also doesn't connect via SSH.
0 Answers