Synopsis
Sometimes we need to migrate user from /home to new disk, e.g., when the boot disk is full. This post is a note for this process.
Prerequisite checklist
Check if the new disk is mounted correctly by df -h. If not, mount it by sudo mount ${DEVICE_NAME} ${MOUNT_POINT}.
Move user home directory
1 | sudo mv /home/${USER_NAME} ${MOUNT_POINT} |
(Important) Make sure the permission is correct for the new home directory
The permission of the new home directory should be 755 and the permission of .ssh and authorized_keys should be 700 and 600 respectively. Otherwise, ssh login will fail.
1 | sudo chmod 755 ${MOUNT_POINT}/${USER_NAME} |