View previous topic :: View next topic |
Author |
Message |
Ixzat n00b
Joined: 23 Jan 2004 Posts: 34 Location: Sweden
|
Posted: Wed Feb 11, 2004 8:57 pm Post subject: moving /home? |
|
|
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 |
|
|
Given M. Sur l33t
Joined: 03 Feb 2004 Posts: 648 Location: No such file or directory
|
Posted: Wed Feb 11, 2004 9:06 pm Post subject: |
|
|
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 |
|
|
Given M. Sur l33t
Joined: 03 Feb 2004 Posts: 648 Location: No such file or directory
|
Posted: Wed Feb 11, 2004 9:08 pm Post subject: |
|
|
Sorry... that should be:
on the fourth line |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54407 Location: 56N 3W
|
Posted: Wed Feb 11, 2004 9:15 pm Post subject: |
|
|
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 |
|
|
Ixzat n00b
Joined: 23 Jan 2004 Posts: 34 Location: Sweden
|
Posted: Thu Feb 12, 2004 3:47 pm Post subject: |
|
|
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 |
|
|
GuidoJ Guru
Joined: 24 Dec 2002 Posts: 444 Location: Netherlands
|
Posted: Thu Feb 12, 2004 4:09 pm Post subject: |
|
|
The '-' refers to stdin or stdout, whichever is appropriate. |
|
Back to top |
|
|
Oo.et.oO Apprentice
Joined: 23 Apr 2002 Posts: 291 Location: burlington
|
Posted: Thu Feb 12, 2004 9:57 pm Post subject: |
|
|
NeddySeagoon wrote: |
Code: | tar -cf - . | ( cd /mnt/newh; tar -xf -) |
|
damn is that overkill!
you can just use
$> cp -a |
|
Back to top |
|
|
|