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?

New contributor
Rubique is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 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. – John Hanley 2 days ago

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

Your Answer

Rubique is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.