1

I just installed a second hard drive. Previously my partition scheme was /dev/sda1 contained the boot files, and /dev/sda2 contained everything else. Now /dev/sda is the new hard drive, and /dev/sdb is the old hard drive. I want to use /dev/sda as my /home partition. So, I created the GPT partition table in /dev/sda with gdisk (single partition), then I formatted /dev/sda1 with mkfs.ext4, and then I added /dev/sda1 to my fstab as /home, ext4, "defaults", 0, and 2. I rebooted. I should have rebooted at this point, but I did something stupid and mved my only user folder, mszegedy, to /. I then mounted /dev/sda1 in /home, and mved mszegedy back to /home. I then rebooted, to find that /home/mszegedy did not exist. I went looking for it, but I couldn't find any of my files or any folder with the name "mszegedy", so I concluded that I had deleted it. /dev/sda1 was mounted in /home. I tried unmounting /dev/sda1 and remounting it, but the result was the same.

The interesting part is when I tried to useradd -m mszegedy, no directory named "mszegedy" appeared in /home, and when I tried it again, it said that I already existed. Rebooting turned out the same result. What's going on?

  • If I've followed your narration correctly, then /home/mszegedy should exist. Are you absolutely sure you didn't misremember one of the steps? What is the output of df now, and of fdisk -l? If you run mount --bind / /mnt; ls /mnt/home, what do you see? – Gilles 'SO- stop being evil' Sep 12 '13 at 0:23
3

I'm not sure how to even help you at this point. I would make sure that the contents of the drives are understood first.

For example I would go with something like this:

  1. Run the command blkid and see what partitions show up there.
  2. Mount each partition in tun under the directory /mnt, (mount /dev/sda2 /mnt) or something equivalent.

  3. Once mounted, confirm the contents of the partition (is it old /home, is it something else).

  4. umount it (umount /mnt).
  5. Repeat for each partition.

Hopefully this will shed some light on what's going on.

1

Uncommenting the line for /dev/sda1 in fstab did the trick. Apparently /home/mszegedy was being stored on /dev/sdb2, and when I mounted /dev/sda1, it made it completely invisible. I'll try to move it to /dev/sda1 some other way, then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.