问题原文
原帖链接 · Otto · CC BY-SA 3.0
I have a CentOS 7.4 and I followed this guide to mount the new disk on my system. https://docs.microsoft.com/en-us/azure/virtual-machines/linux/add-disk
At first I made a symbolic link but can't achieve what I want because /home already exists, how can I mount safely /home in the new disk without losing the current data?
My objective is to easily migrate this disk in the future to another VM, should I need to know anything else before mounting this disk in another VM?
已采纳解答
原帖链接 · Bruno Faria · CC BY-SA 3.0
I assume you already have the partition setup and working. What you need to do first is to copy the home dir from root partition to the new partition. Let's say its mounted on /mnt/disk1
1) Copy /Home (Replace variables accordingly)
sudo rsync -aXS --exclude='/*/.gvfs' /home/. /mnt/disk1/home/.
2) Find uuid of new partition
sudo blkid
3) Update fstab /home path
UUID=<UUID_from_blkid> /home <partition_type> defaults 0 2
4) Move old home
cd / && sudo mv /home /old_home && sudo mkdir /home
5) Reboot
After that, you should have your home working as intended but located in a different partition.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
