LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Thread Tools Search this Thread
Old 11-29-2008, 05:43 AM   #1
morphynoman
Member
 
Registered: Nov 2008
Posts: 32
Thanked: 0
How could I change my /home dir path?


[Log in to get rid of this advertisement]
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
morphynoman is offline     Reply With Quote
Old 11-29-2008, 05:54 AM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Thanked: 126
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.

Last edited by billymayday; 11-29-2008 at 06:41 AM.. Reason: changed sdb to sda
billymayday is offline     Reply With Quote
Old 11-29-2008, 06:33 AM   #3
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028
Thanked: 0
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.
ugge is offline     Reply With Quote
Old 11-29-2008, 06:40 AM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Thanked: 126
Except he wants /home on sda4 to be his home, not / on sda4
billymayday is offline     Reply With Quote
Old 11-29-2008, 07:11 AM   #5
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028
Thanked: 0
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.

Last edited by ugge; 11-29-2008 at 07:21 AM..
ugge is offline     Reply With Quote
Old 11-29-2008, 07:21 AM   #6
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Pclinux, Mandriva, Kubuntu 9.10, Slck13_64-current
Posts: 1,435
Blog Entries: 3
Thanked: 59
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

Last edited by Drakeo; 11-29-2008 at 07:28 AM.. Reason: not finished
Drakeo is offline     Reply With Quote
Old 11-29-2008, 07:22 AM   #7
morphynoman
Member
 
Registered: Nov 2008
Posts: 32
Thanked: 0

Original Poster
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
morphynoman is offline     Reply With Quote
Old 11-29-2008, 07:36 AM   #8
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028
Thanked: 0
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.
ugge is offline     Reply With Quote
Old 11-29-2008, 08:41 AM   #9
AuroraCA
Member
 
Registered: Jul 2008
Location: Northern CA USA
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370
Thanked: 10
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.
AuroraCA is offline     Reply With Quote
Old 11-29-2008, 08:44 AM   #10
Woodypecker
Member
 
Registered: Mar 2006
Location: Austria
Distribution: Mandriva/Debian
Posts: 83
Thanked: 3
Point the entries in your /etc/passwd to wherever you want the homedirs.
Woodypecker is offline     Reply With Quote
Old 11-30-2008, 09:53 AM   #11
swright007
LQ Newbie
 
Registered: Nov 2008
Location: Hot Springs, AR
Distribution: 8.04 Hardy Heron
Posts: 8
Thanked: 0
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
swright007 is offline     Reply With Quote
Old 11-30-2008, 11:50 AM   #12
ozminh
Member
 
Registered: Aug 2007
Posts: 61
Thanked: 6
creat the dir anywhere you like
then modify the conf file
b careful with permision
ozminh is offline     Reply With Quote
Old 11-30-2008, 12:06 PM   #13
AuroraCA
Member
 
Registered: Jul 2008
Location: Northern CA USA
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370
Thanked: 10
Quote:
Originally Posted by swright007 View Post
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.
AuroraCA is offline     Reply With Quote
Old 11-30-2008, 04:18 PM   #14
morphynoman
Member
 
Registered: Nov 2008
Posts: 32
Thanked: 0

Original Poster
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.

Last edited by morphynoman; 11-30-2008 at 04:19 PM..
morphynoman is offline     Reply With Quote
Old 12-04-2008, 03:00 PM   #15
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :}
Posts: 19,146
Blog Entries: 1
Thanked: 201
Quote:
Originally Posted by morphynoman View Post
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
Tinkster is offline     Reply With Quote

Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add to path of all users home Dir. abovenbeyond Linux - Server 1 12-18-2007 06:27 PM
Changing Home Dir Path paul.hendrikus Linux - Software 7 02-05-2007 03:47 AM
Changing home dir path? NonSumPisces Linux - Newbie 4 08-22-2004 05:16 PM
howto make a dir shared that is not in my home dir Schmurff Linux - Newbie 2 06-19-2004 08:54 PM
Proftp on Slax Change Anonymous Home DIR rusty.bz Linux - Networking 0 05-02-2004 10:20 PM


All times are GMT -5. The time now is 06:05 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration