[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sharing /home and swap space between two Linux systems

On Mon, Jul 09, 2001 at 01:46:50AM -0400, Faheem Mitha wrote:
| Dear People,
| I'm planning to buy a new computer and install Debian on it. I haven't got
| around to the buying yet, and I had a spare 2 Gig on one of the drives of
| my current computer, so I decided to install Debian on it. The install
| went very smoothly, though it was facilitated by the fact that I could
| copy config files over from my old installation. However, there are still
| a few minor issues outstanding, the most significant of which is that I
| would like to share /home between the two Linux systems now on the drive.
| I have some idea of how to do this, and will sketch it below. I would
| appreciate it if people would tell me if anything I am thinking is a bad
| idea.
| Basic setup: I have two disks, hda and hdb. They are mounted as follows.
| /dev/hda1  Win 95 installation
| /dev/hda2  Debian (root partition)
| /dev/hdb1  /boot (SuSE) 
| /dev/hdb2  swap partition (SuSE)
| /dev/hdb3  SuSE (root partition)
| As you can see, part of the difficulty lies in the fact that the whole
| system is in one partition. This was the SuSE 6.2 default at the time,
| which it never occurred to me to change.

Since it is one machine and will only have 1 system running at any
given time this isn't a problem (ie you aren't trying to share your
swap between the "server" and a diskless xterm).  I did this when I was
converting from RH7 to Potato.

| I would like to share the SuSE /home (my only /home till now). When
| running Debian, I have mounted /dev/hdb2 as /mnt/suse. My thinking is that
| I could rename my current home directory to /home/faheemold, make a
| symlink from /home/faheem to /mnt/suse/home/faheem. This will take care of
| the home directory.


| But I still need to worry about my inbox. So I will put a symbolic link in
| /var/spool/mail called faheem which points to the "real" mailbox
| /mnt/suse/var/spool/mail/faheem. This takes care of the inbox.


| The most obvious problem with this is
| 1) a) My user id on SuSE is 500. My user id on Debian is 1000. Clearly I
| will need to reconcile these. I think I would prefer to change my Debian
| uid to 500. I'm not sure how to do this. I could try editing /etc/passwd
| my hand, but this might be dangerous.

After I had read the Debian docs which say UIDs under 1000 are
reserved for something, I changed my RH UID to 1000 (it defaulted to
500 too)

| The SuSE /etc/passwd has as my entry
| faheem:x:500:100:Faheem Mitha:/home/faheem:/bin/bash
| The 500 corresponds to the faheem uid, and the 100 corresponds to the
| group id for users. Is there a reason why this group is special? I belong
| to other groups.

It is your "default" or "main" group.

| The Debian /etc/passwd has
| faheem:x:1000:1000:Faheem Mitha,,,:/home/faheem:/bin/bash
| The 1000 corresponds to the faheem uid, and 1000 to the group faheem.
| Fortunately, Debian also has a group called users with gid 100, otherwise
| things would have really got complicated.
| I think I would like to change the Debian uid. If I simply change the uid
| faheem in /etc/passwd from 1000 to 500 then will everything be hunky-dory?
| Or is there a better way to do this?

You can simply change the UID/GID in /etc/passwd, but note that all
files on the system have owner/group stored as an int, not as the
name.  You will need to change all files that are already owned by the
"wrong" UID to the right one.

I did this by using linuxconf on RH to remove my user, but keep home
dir.  Then create user again, but specified UID 1000.  Then I used 'ls
-lR' to find all files owned by "500" (it displays the UID because
there is no name associated with it).  Then, as root, I 'chown dman
<file>'  ('dman' is my user name).  Since my UID is now 1000 it stores
that in the file.  If you forget something, like in /usr or /var, you
will find out when you get permission errors.


"ls -lR / | grep 500"

to get a rough idea of all the files owned by the old UID (that is,
after changing SuSE to use UID 1000).  This particular usage of the
commands will display any files that happen to have "500" in the name.

| b) Also, there is a possible problem with reconciling initialisation files
| in my (SuSE) home directory, which might not work with different copies of
| the same program in two systems, and also there might be problems with the
| .bashrc. But I could try to deal with this on a case by case basis. Is
| there a simple way of doing
| if (Debian)
| 	read this section of the file
| else
| 	ignore  ?

Depends on how the file is used.  If it is a shell file that simply
creates environment variables then it is rather easy.

if [ -f /etc/debian_version ] ; then

Some things don't work well that way, but you could hack your way
around it with various login scripts (it wouldn't be a pretty sight,
BTW, but I can give some (untested) suggestions if you really want

I found that my gnome config from RH (I had upgrade to the latest
gnome 1.2) didn't work with Potato (gnome 1.0.55) because of a lack of
new features.  Now I am running Woody and have gnome 1.4 -- it is

| Also...
| 2) I realised after installing that I could have used my SuSE swap
| partition as swap space for my Debian system. Is it too late now?

I don't know how to tell init where to find the swap.  Perhaps
/etc/inittab tells?

| On a side note, I read in an article a couple of years ago, that Debian
| would greet its installer on successful completion with "Happy Hacking".
| I've installed it (twice), but have yet to see this greeting. A pity. I
| would quite like it.

Dunno about that, maybe it is in an old version?


Reply to: