Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
moving /home?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Ixzat
n00b
n00b


Joined: 23 Jan 2004
Posts: 34
Location: Sweden

PostPosted: Wed Feb 11, 2004 8:57 pm    Post subject: moving /home? Reply with quote

Is there an easy way to move my /home to another harddrive that i have prepared with a ext3 fs?

I want to move it from /dev/hda4 to /dev/hdf1...
Back to top
View user's profile Send private message
Given M. Sur
l33t
l33t


Joined: 03 Feb 2004
Posts: 648
Location: No such file or directory

PostPosted: Wed Feb 11, 2004 9:06 pm    Post subject: Reply with quote

I believe this will work:
Code:
# cd /
# mkdir newhome
# mount /dev/hdf1 newhome
# mv /home newhome
# umount newhome
# rmdir newhome
# umount /home
# mount /dev/hdf1 /home


then edit /etc/fstab and change the line for your home directory to /dev/hdf1

At least that's how I would do it, but I'm still a n00b so there could be an easier way.
Back to top
View user's profile Send private message
Given M. Sur
l33t
l33t


Joined: 03 Feb 2004
Posts: 648
Location: No such file or directory

PostPosted: Wed Feb 11, 2004 9:08 pm    Post subject: Reply with quote

Sorry... that should be:

Code:
mv /home/* newhome


on the fourth line
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54407
Location: 56N 3W

PostPosted: Wed Feb 11, 2004 9:15 pm    Post subject: Reply with quote

Ixzat,

Make a new mount point wth mkdir /mnt/newh and mount dev/hdf1 there.
cd to /home (your old home)
next do the copy
Code:
tar -cf - . | ( cd /mnt/newh; tar -xf -)

This command creates a new archive of the current directory and sends it to stdout where it is piped to your new home and extracted from stdin.
File permissions, datestamps etc are untouched.

Have a look at /mnt/newh to see it ks OK.
Unmount it from /mnt/newh
Unmount /home
Mount /dev/hdf1 as /home.

Fix /etc/fstab to mount the new partition as home.

Later you can delete the old /home if you want, or clean it out to reuse the space.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Ixzat
n00b
n00b


Joined: 23 Jan 2004
Posts: 34
Location: Sweden

PostPosted: Thu Feb 12, 2004 3:47 pm    Post subject: Reply with quote

Thx for the tips, running this right now so lets see what happens...

However i have a few questions, what does the "- ." mean in the front and "-" in the back of the command?

tar -cf - . | ( cd /mnt/newh; tar -xf -)
Back to top
View user's profile Send private message
GuidoJ
Guru
Guru


Joined: 24 Dec 2002
Posts: 444
Location: Netherlands

PostPosted: Thu Feb 12, 2004 4:09 pm    Post subject: Reply with quote

The '-' refers to stdin or stdout, whichever is appropriate.
Back to top
View user's profile Send private message
Oo.et.oO
Apprentice
Apprentice


Joined: 23 Apr 2002
Posts: 291
Location: burlington

PostPosted: Thu Feb 12, 2004 9:57 pm    Post subject: Reply with quote

NeddySeagoon wrote:

Code:
tar -cf - . | ( cd /mnt/newh; tar -xf -)


damn is that overkill!

you can just use

$> cp -a
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum