如何在ubuntu搬家
我有一个Ubuntu 15 VM,我正在为主分区添加第二个虚拟磁盘。
我把旧房子搬到了家里。 并将新家安装在新磁盘上。 并且装载成功。 但是当我去看家时,我没有看到我的测试用户的目录。 测试目录仍在home.old下。
我还尝试创建一个新的测试用户test2,但既不是home也不是home.old显示我的目录test2。
test2@test-virtual-machine:/$ cd /home test2@test-virtual-machine:/home$ ls lost+found test2@test-virtual-machine:/home$ cd .. test2@test-virtual-machine:/$ ls /home.old/ test test2@test-virtual-machine:/$
这里发生了什么?
谢谢
编辑:根据要求
test@test-virtual-machine:/home$ cd ~ bash: cd: /home/test: No such file or directory test@test-virtual-machine:/home$ pwd /home test@test-virtual-machine:/home$ ls aquota.user lost+found test@test-virtual-machine:/home$
请尝试以下方法:
sudo cp -pR /home.old/test /home cd ll
确保列出的文件(除..
)都具有您的用户名。 例如:
drwx------ 3 yourusername yourusername 4096 Jan 1 1970 .gnome/
这有点令人困惑,但要添加新用户,请不要使用useradd
。 man useradd
说:
useradd是一个用于添加用户的低级实用程序。 在Debian上,管理员通常应该使用adduser(8)。
相反,首先使用deluser
删除使用useradd
创建的用户:
sudo deluser --remove-home test2
然后,使用adduser
添加用户:
sudo adduser test2
按照提示操作,您将正确创建新用户。