I need to create a RHEL machine on GCP with separate partitions for /home, /tmp, and /var. If I were installing on a physical machine I would simply partition my disk when I install the OS but I can't seem to figure this out on a GCP virtual machine. I:

  • instantiated a new RHEL VM on GCP by selecting an existing one and the "create similar" feature
  • created a new disk on GCP with gcloud compute disks create acas-home --size 200 --type pd-ssd
  • attached it to my VM with gcloud compute instances attach-disk <my-vm-name> --disk acas-home
  • formatted it with sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb
  • mounted the new partition just once in a temporary folder and copied the original .ssh folder into to to import the authorized_keys file
  • added the new disk to /etc/fstab with the following line UUID=<MY_UUID_VALUE> /home ext4 discard,defaults,nofail 0 2
  • mounted the disks with sudo mount -a
  • restarted sshd with sudo systemctl restart sshd.service

After this, I cannot ssh into the server. I tried simply deleting the authorized_keys file and creating a new one but nothing would do. I also tried adding another authorized keys file to sshd_config, and populating it, with this line but it would not pick it up either:

AuthorizedKeysFile  .ssh/authorized_keys /etc/ssh/authorized_keys 

What am I doing wrong?

  • Check the ownership and permissions for the directory ~/.ssh and the file ~/.ssh/authorized_keys`. If the settings are wrong, you cannot log in with that user ID. Jun 10, 2021 at 18:37
  • Were you able to solve your issue ? Can you connect via SSH at all ? You may also try serial console interactive mode. Have a look at my other answer on how to connect if you lost access.
    – Wojtek_B
    Jul 8, 2021 at 10:52

2 Answers 2


Could you please give a try following the official documentation and make the connection through gcloud:

gcloud compute ssh --project=PROJECT_ID --zone=ZONE VM_NAME

You can find more guidance in the official documentation on how to troubleshoot SSH in GCP.


You probably forgot to restore the SELinux contexts for your newly created partition.

restorecon -rv /home

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .