0

I recently installed Manjaro Linux, an Arch based system. I didn't specify my drive /dev/sda6 as my /home in the setup.

So now I have a /home in my / drive.

How can I mount my /dev/sda6 as my /home?

I tried editing /etc/fstab file and rebooting but it made no difference. Can you help me to fix this?

3
  • 2
    /dev/sda6 was not mounted after editing /etc/fstab and rebooting? Perhaps you should show us your /etc/fstab
    – user90883
    Commented Oct 12, 2015 at 5:04
  • Umm … did you do a mkfs?  Have you run fsck?  Can you mount the filesystem manually? Commented Oct 12, 2015 at 5:24
  • Please post the contents of your fstab, including what you tried.
    – Sparhawk
    Commented Oct 12, 2015 at 5:34

2 Answers 2

0

First and foremost, if you have directories in /home

then you want to copy them somewhere first.

Make a note of the permissions and ownership so that you
can make sure that they are the same when you move them.

Normally you will see /home permissions as 0700

# ls -lah /home
drwx------  4 user.user 4.0K Oct 11 21:58 user

If you need to format the partition ext4 then use:

    mkfs.ext4 /dev/sda6

Then to umount the current /home directory mapping use:

    umount /home

You can verify by using the command df

use the -f switch to force if you have to. ie. umount -f /home

Then when you have that done, use:

    mount /dev/sda6 /home

Copy your directories to /home that you backed up.

If you have to you can use the following to set them back to what they were:

chown -R user.user /home/user 
chmod 0700 /home/user

Now edit your fstab accordingly!

Your new /dev/sda6 should now map to /home when you reboot

if you changed the mapping in /etc/fstab appropriately.

0

Logout from your non-root user account and login as root. You may have to switch to a text console to do this. Make sure no other user accounts are logged in and no user-owned processes have files open under /home. The easiest way to guarantee this is to reboot into single-user mode.

Then, as root:

  • format /dev/sda6 (e.g. with mkfs.ext4) if it isn't already formatted.
  • edit /etc/fstab to mount /dev/sda6 as /home.new
  • mount /home.new
  • rsync -avx /home/ /home.new

    NOTE: the final / on /home/ is required

  • umount /home.new

  • mv /home /home.old
  • edit /etc/fstab to mount /dev/sda6 as /home
  • mount /home

You should now be able to login again as your non-root user. If everything's working without problems you can safely delete /home.old with sudo rm -rf /home.old

You can revert to the way things were at any time before you delete /home.old simply by unmounting /home, commenting out the /dev/sda6 line in /etc/fstab, rmdir /home, and mv /home.old /home. You will lose any changes (e.g. new or updated or deleted files) in the new (/dev/sda6) /home if you do this.

You must log in to answer this question.

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