gcp display device names on os

In GCP console you can see the VM’s Device Names. In this case, it’s boot and persistent-disk-1. Name Device name server-boot boot server-data persistent-disk-1 To display the volume names on the OS, run this command. $ ls -l /dev/disk/by-id total 0 lrwxrwxrwx. 1 root root 9 Aug 2 01:12 google-boot -> ../../sda lrwxrwxrwx. 1 root root 10 Aug 2 01:12 google-boot-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 9 Aug 18 18:48 google-persistent-disk-1 -> ../../sdb lrwxrwxrwx. 1 root root 9 Aug 2 01:12 scsi-0Google_PersistentDisk_boot -> ../../sda lrwxrwxrwx. 1 root root 10 Aug 2 01:12 scsi-0Google_PersistentDisk_boot-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 9 Aug 18 18:48 scsi-0Google_PersistentDisk_persistent-disk-1 -> ../../sdb As you can see, boot and persistent-disk-1 are displayed along with its device names /dev/sda and /dev/sdb.

August 18, 2021 · 1 min · ulysses

check open ports remotely

Here are a few tools to check if ports are open from a remote host. nc -zvw10 192.168.0.1 22 nmap 192.168.0.1 -p 22 telnet 192.168.0.1 22 You may have to install netcat and nmap if missing in your distro. yum install nc yum install nmap

August 17, 2021 · 1 min · ulysses

terraform gcloud vm image family

How to implement image family with Terraform in GCP. Declare the machine image in terraform.tfvars. image-family = "centos-7" Declare data type for the machine image in maint.tf. data "google_compute_image" "my_image" { family = var.image-family project = "your-project-id" } In main.tf use “google_compute_instance” under boot disk section in main.tf. boot_disk { initialize_params { image = data.google_compute_image.my_image.self_link } }

August 10, 2021 · 1 min · ulysses

bash variable empty

Here’s how to check in Bash if a variable is empty or unset. if [ -z "${VAR}" ]; then echo 'do something' else echo 'do another' fi One liner if [ -z "${VAR}" ]; then echo 'do something'; else echo 'do another'; fi The inverse if [ ! -z "${VAR}" ]; then echo 'do something' else echo 'do another' fi if [ ! -z "${VAR}" ]; then echo 'do something'; else echo 'do another'; fi

August 6, 2021 · 1 min · ulysses

corosync settings

Here are the SAP Corosync settings. [root@server ~]corosync-cmapctl | grep fail_recv_const runtime.config.totem.fail_recv_const (u32) = 500

August 5, 2021 · 1 min · ulysses

markdown language

Style your text using markdown. If you use GitHub, markdown will come in handy. Examples: # This is an <h1> tag ## This is an <h2> tag ###### This is an <h6> tag </h6></h2></h1> Here are more markdown examples.

August 5, 2021 · 1 min · ulysses

sublime text terraform syntax

If you use Terraform and Sublime Text, add Terraform Syntax Highlighter using Package Control. Press Ctrl+Shift+P or Cmd+Shift+P. Select “Package Control: Install package” Select “Terraform” It should install in a few seconds.

August 4, 2021 · 1 min · ulysses

sssd override shell

If you have SSSD running and the default shell is ksh even with the default shell set to bash. Here’s the fix to override the default shell in /etc/sssd/sssd.conf. Add override_shell. default_shell = /bin/bash override_shell = /bin/bash To check which shell you are using. echo $SHELL /bin/bash

July 25, 2021 · 1 min · ulysses

gcp ssh issues

There are a few issues that prop up every once in a while with gcloud compute ssh. gcloud compute ssh creates local user at first login. The account password has a default expiration of 90 days. If unable to login, you can try logging in as a different name (even a fictitious name) e.g. superheroes, etc. something unique. gcloud compute ssh username@servername --zone us-central1-c --project project-id --internal-ip Once logged in, you can delete local users with expired passwords or perform other admin tasks. ...

July 20, 2021 · 1 min · ulysses

migrate vm to other network

Here’s how to move a VM to another network. Stop the VM. gcloud compute instances stop server-name \ --zone=us-central1-c \ --project project-id Migrate the VM. Use self link for network and subnetwork. gcloud compute instances network-interfaces update server-name \ --zone=us-central1-c \ --network-interface=nic0 \ --network=your-network \ --subnetwork=your-sub-network \ --project project-id Start the VM. gcloud compute instances start server-name \ --zone=us-central1-c \ --project project-id

July 20, 2021 · 1 min · ulysses