LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How could I change my /home dir path? (https://www.linuxquestions.org/questions/linux-newbie-8/how-could-i-change-my-home-dir-path-687031/)

morphynoman 11-29-2008 04:43 AM

How could I change my /home dir path?
 
Hi guys,

I decided to create a partition for /home, sda4. But now I realize that my /home is in sda3, which was created to house my / tree. There's a home dir in sda4 but this is not the one that my dist recognizes as system /home. Here's my fstab:
Code:

aufs / aufs defaults 0 0 # AutoUpdate
devpts /dev/pts devpts gid=5,mode=620 0 0 # AutoUpdate
proc /proc proc defaults 0 0 # AutoUpdate
sysfs /sys sysfs defaults 0 0 # AutoUpdate
/dev/hda /mnt/hda iso9660 auto,users,exec 0 0 # AutoUpdate
/dev/fd0 /mnt/floppy vfat noauto,noatime,users,suid,dev,exec 0 0 # AutoUpdate
/dev/sda1 /mnt/sda1 ext3 auto,noatime,users,suid,dev,exec 0 0 # Autoupdate
/dev/sda2 none swap sw 0 0 # Autoupdate
/dev/sda3 /mnt/sda3 ext3 auto,noatime,users,suid,dev,exec 0 0 # AutoUpdate
/dev/sda4 /mnt/sda4 ext3 auto,noatime,users,suid,dev,exec 0 0 # Autoupdate

/dev/sdb5 /mnt/sdb5 swap auto,defaults 0 0 # AutoUpdate
/dev/sdd6 /mnt/sdd6 ext3 auto,noatime,users,suid,dev,exec 0 0 # AutoUpdate
/dev/sdd2 /mnt/sdd2 udf auto,noatime,users,suid,dev,exec 0 0 # AutoUpdate
/dev/sdd3 /mnt/sdd3 udf auto,noatime,users,suid,dev,exec 0 0 # AutoUpdate
/dev/sdd1 /mnt/sdd1 vfat auto,noatime,users,suid,dev,exec,quiet,umask=0,check=s,shortname=mixed 0 0 # AutoUpdate

and here my df -h:
Code:

Morphy / # df -h
Filesystem            Size  Used Avail Use% Mounted on
aufs                  51G  23G  26G  46% /
/dev/sda1            190M  9.5M  171M  6% /mnt/sda1
/dev/sda3              51G  23G  26G  46% /mnt/sda3
/dev/sda4              96G  6.1G  85G  7% /mnt/sda4
/dev/sdc1            233G  20G  214G  9% /mnt/sdc1
/dev/sdd1            439G  19G  420G  5% /mnt/sdd1

This is what sda4 contains:
Code:

Morphy / # l /mnt/sda4
total 28
drwxr-xr-x  4 root root  4096 Nov  8 16:26 ./
drwxr-xr-x 22 root root  4096 Nov 29 00:47 ../
drwxr-xr-x  7 root root  4096 Nov 28 22:50 home/
drwx------  2 root root 16384 Nov  8 16:06 lost+found/

and this what contains /home in sda3:
Code:

Morphy / # l home/
total 44
drwxr-xr-x  7 root root  4096 Nov 28 22:50 ./
drwxr-xr-x  4 root root  4096 Nov  8 16:26 ../
drwxr-xr-x  2 root root 12288 Nov 28 22:47 Bib/
drwxr-xr-x  3 root root  4096 Nov 28 21:31 Down/
drwxr-xr-x  3 root root  4096 Nov 28 21:39 Films/
drwxr-xr-x 16 root root  4096 Nov 28 18:58 Src/
-rw-r--r--  1 root root  6995 Nov 22 18:24 lsmodoutput.txt
drwxr-xr-x 18 root root  4096 Nov 24 03:11 tahl/

As you can see, tahl is a non-root user dir. I thought of linking the sda3 /home to the sda4 /home but I was unable to:
Code:

Morphy / # ln -s /home /mnt/sda4/
ln: creating symbolic link `/mnt/sda4/home': File exists

what is quite reasonable, so how could I define my sda4 /home as my system /home??

Thanks for your attention

billymayday 11-29-2008 04:54 AM

More typically people would mount a partition as /home, but since you want a directory on a partition, I guess you could delete your current /home, and create a symbolic link to /mnt/sda4/home using

ln-s /mnt/sda4/home /home.

I'd probably rename /home rather than deleting it, just in case you need it.

ugge 11-29-2008 05:33 AM

I must say that your fstab looks very special. All of your partitions are mounted under the /mnt directory, both the sda3 and sda4.
Normally your home directory should be under / (root), that is /home.
To accomplish that you would mount either your sda3 or your sda4 with a line in fstab similar to this:
Code:

/dev/sda4 /home ext3 auto,noatime,users,suid,dev,exec 0 0 # Autoupdate
Notice the /home in second coulmn. This makes your /dev/sda4 replace or actullay overlay any existing home directory on your root partition.

I must ask what distribution you use, because most lines in your fstab looks wrong compared to what is normal in the linux world.

billymayday 11-29-2008 05:40 AM

Except he wants /home on sda4 to be his home, not / on sda4

ugge 11-29-2008 06:11 AM

The code a gave would give him sda4 as /home

In contrast to windows which has several root directories, one for everey disk c:\ d:\ etc, there are only one file tree in linux, all placed under / (root)


A leading / in a path always makes it an absoulte path, so the first post is a bit misleading.
In the sda3 where / resides there are a home directory, as always, either it contains the users home directories or function as a mount point for a mounted "home"-partition.

Before the addition of sda4 the user files would be saved to /home (being on sda3). Mounting sda4 as I suggested above would make the partition sda4 "replace" or overlay the /home directory with the contents of sda4. Using soft links would be the wrong way to try to "fix" it.

When partitions are mounted in the correct place, there are no use for soft linking.

Drakeo 11-29-2008 06:21 AM

easy fix in kde go to user manager and tell it where to put user default is /home/user. . the option is there.
when you create a user it will ask if you want to create a user file and then you put it where you want it. or you can modify the user manager to for that user. I did this many times as I migrated to different hard drives. default is on the same partition as root if you loaded the whole system on sda3 and not mounting the sda4 as /home. the l -s symbolic link has caused me some troubles in the past do to /tmp/sockets etc etc. but when you loaded the new system you had a choice to make a partition and mount it as /home but you did'nt so now you need to tell the user manager where you want to put you user file. if you have a bunch of stuff there you can move it then tell the manager where to put it. as long as the user manager knows where to look for your folder. you must do this from root ok or you will be left with locked tmp sockets and you will have troubles. like the symlink stuff. it will all work just if you want to play with it. create your user and tell the user manager where to put it. your user file does not need to be in home. but if you config the fstab to /dev/sda4 /home then the default setting for adding a user goes to home.. but you will have to move them to sda4 before you do this.
/dev/sda4 /home ext3 defaults 1 2 do not copy the home file just the user file to sda4. because sda4 is now /home.
and your root sys will still look like this
bin,,,, boot ,,,, dev ,,,, etc ,,,,,,, home ,,,,,lib
make sure if you move it as root you set permisions back tou you user name and users or you will not have access to it. or just copy to sda4 then logout then login as root and change the fstab.
if you do not logout you will leave locked /tmp sockets running

morphynoman 11-29-2008 06:22 AM

I use Slackware 12.0. I'm a bit confused with your posts. What I'm supposed to do to replace my sda3 home in / with my sda4 home?

Thanks again

ugge 11-29-2008 06:36 AM

I'm sorry if I confuse things for you, I my self are confused by the fstab setup. I haven't used Slackware my self so I don't know how they do things.

If this is the default fstab, then running the command I suggested may as well mess things up.

AuroraCA 11-29-2008 07:41 AM

The OP must be using Knoppix, Xandros, SLAX or one of the distributions that uses the AUFS filesystem. He does not say what his distribuiton is.

I am not familiar with those current distributions and am not at all comfortable with the very different mounting of devices in the /etc/fstab from more mainstream Linux distributions.

I would be very reluctant to give any advice or suggestions given the apparent foreign nature of the file structure. While the principles may be the same I just don't know how his distribution expects things to be set up.

Woodypecker 11-29-2008 07:44 AM

Point the entries in your /etc/passwd to wherever you want the homedirs.

swright007 11-30-2008 08:53 AM

I would like to change my /home directory as well.. What I have in mind is to be able to have a drive for my Ubuntu operating system on one drive and my /home directory and all files on another drive. In the event I wanted to try an upgrade, the desired effect would be that all I would have to do would be install it to the operating system drive and then mount home on the other drive that has /home and the files. Could I do that merely by making a /home directory on the "home" drive and setting it up AS home in the "Users and Groups" admin utility or would it be more complex? what would be involved in both setting it up and mounting it the way I have envisioned? Any help would be greatly appreciated. I am running a dual core AMD 5000 processor and 2 gigs ram with Ubuntu 8.04 currently.

Thanks in advance,
Scott

ozminh 11-30-2008 10:50 AM

creat the dir anywhere you like
then modify the conf file
b careful with permision

AuroraCA 11-30-2008 11:06 AM

Quote:

Originally Posted by swright007 (Post 3359474)
I would like to change my /home directory as well.. What I have in mind is to be able to have a drive for my Ubuntu operating system on one drive and my /home directory and all files on another drive. In the event I wanted to try an upgrade, the desired effect would be that all I would have to do would be install it to the operating system drive and then mount home on the other drive that has /home and the files. Could I do that merely by making a /home directory on the "home" drive and setting it up AS home in the "Users and Groups" admin utility or would it be more complex? what would be involved in both setting it up and mounting it the way I have envisioned? Any help would be greatly appreciated. I am running a dual core AMD 5000 processor and 2 gigs ram with Ubuntu 8.04 currently.

Thanks in advance,
Scott

Here you go. http://ubuntu.wordpress.com/2006/01/...own-partition/

You don't even need to put the /home directory on it's own drive but on it's own partition for your idea to work. You can put /home on the same drive as your Linux files but place /home in a different partition of it's own. I always set up my Linux installations this way for just the reasons you stated. Keep in mind that if you use databases such as Postgresql or MySQL they will be placed in the /var directory on the main disk as well and may be lost if you re-install Linux. All files should be ok for regular updates and upgrades as long as you use the Ubuntu upgrade procedure and do not do a new install.

morphynoman 11-30-2008 03:18 PM

Solved
 
First of all, thanks everybody for your opinions but especially to ugge, you were right and, not least, very kind.

I like the discussions that lead to some point and I ensure you that controversy was/is NOT my aim. Sorry if I get it.I'll try to pass on tiptoe on the discussion, however I would jot down issue:
Code:

I would be very reluctant to give any advice or suggestions given the apparent foreign nature of the file structure. While the principles may be the same I just don't know how his distribution expects things to be set up.
It would be very wise of you to explain why can't I expect my distribution to work right.

Tinkster 12-04-2008 02:00 PM

Quote:

Originally Posted by morphynoman (Post 3359715)
Code:

I would be very reluctant to give any advice or suggestions given the apparent foreign nature of the file structure. While the principles may be the same I just don't know how his distribution expects things to be set up.
It would be very wise of you to explain why can't I expect my distribution to work right.

I don't think it's about "not working right". It's about
"is it right for all possible scenarios" - which will always
have to be a clear: "NO!", for what I think are quite obvious
reasons. You can't cater to all use-cases with one set-up,
a server will require a different set-up from a gaming desktop.
And I think that (even though one could build some heuristics
into the installer, and quizzing the person installing about
their intended use) you'll never be able to anticipate all
possible uses ...


Cheers,
Tink


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