move /home
Hi, I'm sure there is a lot about that title out there as much as in here.
But I don't want to move it to an exclusive partition. I want to move it to an existing partition as a folder/directory. I tried not to post a new thread, trying to hook onto sth similar, but had no luck with it, so here goes the question. Please forgive me if I am not posting in the right place, it is my first post and I am already looking around for an hour... -------------------------- So, my /home directory is "as is" by default. Here's my df by the way Code:
[usr@pc ~]$ df sda1 is boot sda2 is / sda3 is swap and sda4 is the excess in that hdd from 120 to 500, made as partition (primary, ext4). my fstab file is Code:
# So i am automounting sda4 in /mnt/Datastore. Don't want to use sda4 exclusively for /home, i want to store there other data as well, virtual machines, etc. and I don't want to decide now how much space I should allocate by determining beforehand partition size for each thing. This I think is a terrible space management... So, I would like to have my home contents in /mnt/Datastore/home and somehow make my system understand that location as /home. I have already managed to copy successfully all the /home contents including all files, folders, maintained permissions etc. (by the way, I went through a lot of articles about that, solutions with find, cpio, compressing/archiving and decompressing to a new location, etc, in order to also copy links, all hidden and file permissions. In my case, I booted with a linux live cd, mounted sda2 and sda4 and then, the following worked for me: cp -avfR /mnt/sda2/home /mnt/sda4/) Thereafter, I know as much as entering in "init 1" and mv /home to a useless name. But that's how far I get... I cannot seem to find a way to actually tell my system to automount /mnt/Datastore/home as /home. I attempted to automount that relationship in /etc/fstab, but that sort-of-looped my boot. As soon as I could see the fedora loading logo, it hangs there... From my "df" output, I see that it understands /home in /dev/sda2, which is normal and by default, but i can't find where this is set, in order to change it... (and anyway, this in itself is a problem, because /dev/sda2 is a partition, which is actually "/" root, it was not initially configured as /home: Nevertheless, df sees /dev/sda2 both as / and as /home and as anything else it wishes to see that way... So, in case the question isn't clear, I want to move /home to a directory in an existing partition with other directory trees in it, don't want to mount to a dedicated disk/partition for that purpose. Is that possible? Does it make sense? maybe it doesn't make sense by design. Am I making a dumb mistake? Any help would be appreciated. Thanks |
you do not need to mount it at all. try to remove that /home mount completely from fstab and create a symbolic link from /home to /mnt/Datastore/home - or you can replace the user's config so they will have their homes directly in /mnt/Datastore/home
if you want to mount /home you need to share /mnt/Datastore/home first and than configure an nfs mount for that share |
You could also bind mount it in fstab (/mnt/Datastore should be mounted first)
Code:
/mnt/Datastore/home /home none bind Some functions returned the true path without symlink which could be annoying. |
OK,
thank you very much both of you, you were both helpful! From pan64's reply I realised I don't have to mount, so looking into changing config for user, found out I can do that with usermod Code:
usermod -d /mnt/Datastore/home/usr usr takes care of setting the user environment to use this folder as home. So far so good, but in df output, /home still worked for the default location. So then I followed dln's advice. I automounted it in /etc/fstab the way he/she indicated. After a reboot, it works beautifully. The mistake I was making, is that I was automounting in /etc/fstab with options "ext4 default" while I had to mount as "none bind" as dln indicated. I was close, but not close enough to do it without help... :) So thanks to pan64 for setting my mind free, and dln for correcting my mistake. Here's an output of df Code:
[usr@pc ~]$ df Code:
# Thanks a lot guys! |
All times are GMT -5. The time now is 01:05 PM. |