LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Move home directory (https://www.linuxquestions.org/questions/linux-newbie-8/move-home-directory-272586/)

iain.ross 01-01-2005 11:21 AM

Move home directory
 
Happy New Year.

I am running SuSE 9.2 in a 20Gb / partition. The only other partition is a 1Gb SWAP partition. Is it possible to move my /home folder to a new partition? Its getting pretty full, and I have another disk in the system with 40Gb unallocated space.

Can I move the /home folder in such a way that I dont break any associations with programs that have prefs etc inside the home/user/ folder?

egag 01-01-2005 11:45 AM

i think this works.

-#mkdir /newhome
-#mount <the new partition on /newhome >
-#cd /home
-#cp -a * /newhome
-#umount /newhome
---edit fstab to mount new partition at /home
-#mv /home /oldhome
-#mkdir /home
-#mount /home

all done without x running.
if all is ok , remove /oldhome; /newhome


edit changed cp -r to cp -a

egag

druuna 01-01-2005 12:05 PM

2 minor additions to egag's solution:

[edit]
Additions withdrawn due to edit previous post
[/edit]

Happy newyear!

btmiller 01-01-2005 12:14 PM

Actually, you should probably use -a (for archive) to cp, to get a complete copy and avoid some problems with symlinks. See the man psge for cp for more info.

egag 01-01-2005 12:17 PM

yip: cp -a

i'll edit...

egag

michaelk 01-01-2005 03:51 PM

Futhermore
Quote:

-#mv /home /oldhome
-#mkdir /home
-#mount /home
No need to create another /home directory.

No need to mv except it will delete everything from the old home directory.

I would verify everything has been copied to the new home partition prior to deleting from the existing /home.

Be sure to log in as root so no files in the existing home directories will be accessed.

If you mount the new home before deleting the the existing home files they will become invisible. However it will prove that everything still works. You can always unmount the new home.

iain.ross 01-01-2005 04:37 PM

Thankyou to everyone who commented. I have now sorted it out. There was one heartstopping moment when I couldn't log in because for some reason I had forgotten to recreate the /home folder so fstab had nothing to mount to. I logged in at init 3 and put that right. All seems well.

Many thanks. Ive been messing about with Linux in one form or other for about 18months now, and its amazing that you can get by in windows without understanding partitions and mount points etc. I don't claim to understand them very well now, but I at least have a handle on the concepts...


Live and learn.


All times are GMT -5. The time now is 01:43 AM.