LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Can I move /home partition under root partition (https://www.linuxquestions.org/questions/linux-general-1/can-i-move-home-partition-under-root-partition-566647/)

arijit_2404 07-04-2007 02:23 PM

Can I move /home partition under root partition
 
I've feisty(/) installed in my pc. My HDD has one more free partition,
on which I want to install a different distro for evaluation.(so that
partition will be formatted at regular interval)

here's current hdd structure:
sda1: ubuntu root(8 GB)
sda2: swap (1 GB)
sda3: ubuntu /home (125 GB)
sda5(logical): reserved partition for distro testing (22 GB)

but during evaluation I may download/create files in the second OS.
So I want to store those files in one common partition. for that reason
I want to convert that partition from "/home" to a common data partition.
And home should be moved to "sda1" itself.

My qustion: can i safely do this without loosing my settings for ubuntu?
I don't want to share "sda3" as common home. I already tried that before.
different distros overwrite software settings which is troublesome.

GregLee 07-04-2007 02:41 PM

I'm not 100% sure I understand what you want to do, but I think it's:

cp -a /home /home_save
umount /home
mv /home_save /home

then edit /etc/fstab to remove the line that mounts /dev/sda3 on /home.

jschiwal 07-04-2007 02:51 PM

Create a partition temporarily named /home-new, and then copy the contents of /home to it.

I think the command to use would be "sudo cp -dpR /home/* /home-new/". If you have links, check if they are OK.

When you share a home directory, you can have problems with the ~/.kde/ or ~/.gnome2/ settings being changed. You can still share the /home partition. Use a different home directory for each partition. You don't even need to use a different username. You can change the location of your home directory when creating a user, or later using the "users & groups" config program of your distro, or directly by editing the home directory field in /etc/passwd.

One thing to look out for, both ways is that the range of UIDs for regular users can differ between distro's. Mandrake & Red Hat start at 500. SuSE starts at 1000.

You can change this behavior in the /etc/login.defs file:
This is from SuSE 10.2
Code:

#
# Min/max values for automatic uid selection in useradd
#
# SYSTEM_UID_MIN to SYSTEM_UID_MAX inclusive is the range for
# UIDs for dynamically allocated administrative and system accounts.
# UID_MIN to UID_MAX inclusive is the range of UIDs of dynamically
# allocated user accounts.
#
SYSTEM_UID_MIN            100
SYSTEM_UID_MAX            499
UID_MIN                  1000
UID_MAX                60000

#
# Min/max values for automatic gid selection in groupadd
#
# SYSTEM_GID_MIN to SYSTEM_GID_MAX inclusive is the range for
# GIDs for dynamically allocated administrative and system groups.
# GID_MIN to GID_MAX inclusive is the range of GIDs of dynamically
# allocated groups.
#
SYSTEM_GID_MIN            100
SYSTEM_GID_MAX            499
GID_MIN                  1000
GID_MAX                60000

You might want to change your UID & GID to a number that is in range of both distro's if they differ. Make sure your UID and GID numbers match if you want to use a common data partition.

You would want to do the same thing if you had an external mass storage drive with an ext3 or xfs or reiserfs filesystem. They you would have access regardless of which distro you booted to.

arijit_2404 07-05-2007 12:01 AM

Quote:

Originally Posted by jschiwal
When you share a home directory, you can have problems with the ~/.kde/ or ~/.gnome2/ settings being changed. You can still share the /home partition. Use a different home directory for each partition. You don't even need to use a different username. You can change the location of your home directory when creating a user, or later using the "users & groups" config program of your distro, or directly by editing the home directory field in /etc/passwd.

One thing to look out for, both ways is that the range of UIDs for regular users can differ between distro's. Mandrake & Red Hat start at 500. SuSE starts at 1000.

You can change this behavior in the /etc/login.defs file:
This is from SuSE 10.2
Code:

#
# Min/max values for automatic uid selection in useradd
#
# SYSTEM_UID_MIN to SYSTEM_UID_MAX inclusive is the range for
# UIDs for dynamically allocated administrative and system accounts.
# UID_MIN to UID_MAX inclusive is the range of UIDs of dynamically
# allocated user accounts.
#
SYSTEM_UID_MIN            100
SYSTEM_UID_MAX            499
UID_MIN                  1000
UID_MAX                60000

#
# Min/max values for automatic gid selection in groupadd
#
# SYSTEM_GID_MIN to SYSTEM_GID_MAX inclusive is the range for
# GIDs for dynamically allocated administrative and system groups.
# GID_MIN to GID_MAX inclusive is the range of GIDs of dynamically
# allocated groups.
#
SYSTEM_GID_MIN            100
SYSTEM_GID_MAX            499
GID_MIN                  1000
GID_MAX                60000

You might want to change your UID & GID to a number that is in range of both distro's if they differ. Make sure your UID and GID numbers match if you want to use a common data partition.

You would want to do the same thing if you had an external mass storage drive with an ext3 or xfs or reiserfs filesystem. They you would have access regardless of which distro you booted to.

thanks for this information. this seems a better solution.


All times are GMT -5. The time now is 07:32 AM.