Is there a way to mount a persistent disk to /home directory?
I've followed instructions from GCP (https://cloud.google.com/compute/docs/disks/add-persistent-disk) that allows me to mount the disk to /home directory initially. Then after I copied all the files from original home directory to the mounted /home, restart instance, I can no longer access the server using browser ssh tool anymore. I've tried: 1. Mount the disk directly to /home 2. Mount the disk else where and create a soft link link to it
I can create files and folders and everything works just fine in the newly mounted /home before I power off the instance. Once the instance is off and back online, I wont be able to ssh to it anymore with the message - "Unable to Connect, Retrying (2/3)..."
Has anyone with luck to mount a disk to /home successfully? Any help is appreciated.
Try first mounting the disk to /mnt
, then copy your files from /home
to /mnt
:
sudo mount /dev/sdb1 /mnt
sudo rsync -avHAX /home/ /mnt/
If everything got copied correctly, then you can delete the folders in /home
:
sudo rm -rf /home/*
Then, unmount the disk from /mnt
and mount it to /home
:
sudo umount /mnt
sudo mount /dev/sdb1 /home
(assuming /dev/sdb1
is the partition you're trying to mount)
Configure /etc/fstab
so that the /home
partition will mount properly on boot.
See for example https://www.tecmint.com/move-home-directory-to-new-partition-disk-in-linux/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With