LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /home directory in fstab (https://www.linuxquestions.org/questions/linux-newbie-8/home-directory-in-fstab-674377/)

gothicbob 10-05-2008 11:51 AM

/home directory in fstab
 
I have my first harddrive with two of the partitions for / and /home
this looks like the following:

Code:

# /dev/sda5
/dev/sda5 / ext3 nouser,defaults,errors=remount-ro,atime,auto,rw,dev,exec,suid 0 1
# /dev/sda6
/dev/sda6 /home ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2

What I want to do is move my /home directory to another one of my harddrives. First I tried doing this by making a link from /home to /media/x/home however this just caused my computer to stop after typing in my username.

I found something that I could use. Using "mount --bind /media/x/home /home" would work but I was hoping to put it in my fstab. Is there a way to link an already mounted folder to the /home directory in fstab? or is there a much simpler way of doing what I'm trying to achieve?

Thanks in advance, sorry if I haven't been clear enough.

p.s. I don't want to make a new partition on the other drive, just have the home folder siting in it (its ext3 already)

arckane 10-05-2008 11:55 AM

Code:

# /dev/sda5
/dev/sda5 / ext3 nouser,defaults,errors=remount-ro,atime,auto,rw,dev,exec,suid 0 1
# /dev/sda6
#/dev/sda6 /home ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2

move current home to whichever location you want then do:

ln -s /path/to/new/home /home

Job done.

gothicbob 10-05-2008 11:58 AM

that what I tried first, and kde just didn't load after typing in my password....

I'll try it again though

arckane 10-05-2008 12:00 PM

Hmm, you could try hard linking it but it definitely works in Solaris.

You do have the other drive mounted on something in fstab, right?

example: /dev/sdb1 /mnt/stuff

It also has to be automounted and available once you get to the login prompt :)

gothicbob 10-05-2008 12:30 PM

Right I just tried it again here are my steps:

Console login
Copy contents of /home to /media/x/home
replace /home with "ln -s /media/x/home home"
comment out the mounting of /dev/sda6 to /home in the fstab
restart

When I login it says "could not start ksysconfig" or something. Not quite sure what is wrong...

/media/x is in the fstab and is mounted fine, as I can access the files during the console login.

arckane 10-06-2008 08:28 AM

OK, so now hard link it:

Code:

rm /home
ln -T /media/x/home home

How does that work out?

NVRAM 10-06-2008 04:51 PM

If you log in as root on the console what do you see for:
ls -l /home
ls -l /home/
mount


Can you log in as your non-root user at the console? (Use Ctrl+Alt+F1)

How did you "Copy contents of /home to /media/x/home"? Did the command copy all files and retain their permissions?

Quakeboy02 10-06-2008 05:19 PM

Did you actually copy the contents of the old /home to the new /home? If not, given where you are, it's probably best to do it in maintenance mode before everything comes up. Just mount the old /home somewhere and the new /home somewhere else. Run "cp -axu /oldhome/ /newhome". Once the files are copied over, then you can redo your /etc/fstab and reboot.


All times are GMT -5. The time now is 01:00 PM.