1

I got a Ubuntu 15 VM and I am adding a second virtual disk for the home partition.

I moved the old home to home.old. and have mounted the new home on the new disk. and the mount is successful. But when I go see home, I don't see the directory for my test user. the directory for test is still under home.old.

I also tried to create a new test user, test2 but neither home nor home.old shows me the directory 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:/$

What's going on here?

Thanks

EDIT: as per request

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$
12
  • 1
    Run 'cd ~; pwd; ls' and tell me the results please Jun 17, 2015 at 2:49
  • hi, the results are posted to the question
    – D.Zou
    Jun 17, 2015 at 3:18
  • Hmm weird but I meant as test2 Jun 17, 2015 at 3:23
  • still the same result: bash: cd: /home/test2: No such file or directory
    – D.Zou
    Jun 17, 2015 at 3:28
  • What happens if you run 'mkdir /home/test'? Jun 17, 2015 at 3:30

1 Answer 1

0

Try the following:

sudo cp -pR /home.old/test /home
cd
ll

Make sure the files listed (except for ..) all have your user name. For example:

drwx------  3 yourusername yourusername   4096 Jan  1  1970 .gnome/

It's a bit confusing, but to add a new user, don't use useradd. man useradd says:

useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead.

Instead, first remove the user you created with useradd by using deluser:

sudo deluser --remove-home test2

Then, add a user with adduser:

sudo adduser test2

Follow the prompts, and you'll have a new user properly created.

7
  • it works, but how come the new user's directory aren't created or placed under the new home?
    – D.Zou
    Jun 17, 2015 at 3:33
  • How did you add the user?
    – Olathe
    Jun 17, 2015 at 3:35
  • useradd then set password
    – D.Zou
    Jun 17, 2015 at 3:38
  • OK, I've added a section about that.
    – Olathe
    Jun 17, 2015 at 3:42
  • @Grammargeek, .. in that directory listing is /home, which is owned by root. However, . in that directory listing is /home/test, which should be owned by test.
    – Olathe
    Jun 17, 2015 at 3:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .