Moving /home keeping settings

Jonathan Rawle jr36 at leicester.ac.uk
Mon Jun 13 19:14:45 UTC 2005


Truls Gulbrandsen wrote:


> Hi,
> I will make a fresh installation of FC4 to a new HD.  Then I will back
> up /home to a CD and copy to the new HD.  I have done this earlier but
> have been strugling with the files settings as all files have gone in as
> read-only.
> How do I copy from the CD to the HD keeping the original settings?
> 

You could temporarily keep both drives in the system and then copy your
files across. You can reformat and remove the other drive afterwards if you
no longer want it.

Before starting, boot your old installation for a final time, and relabel
the partitions. This will save a headache when you boot your new system, as
I once discovered the hard way! Type:
mount -l
to show what is mounted. You should see something like:
/dev/hda1 on / type ext3 (rw) [/]

The entries with square brackets show which partitions are labelled. So
issue as root the command:
/sbin/e2label /dev/hda1 /oldroot
(be sure to change hda1 to whatever your partition is!)

If you have other partitions such as /home or /boot you should change them
to /oldhome etc.

Install FC4 onto the new drive (you can do this with the old drive
disconnected if you are worried).

Reconnect the old drive and reboot. 

Now create directories /oldroot, /oldhome etc.
You can then mount the old partitions, e.g:

mount -L /oldroot /oldroot


Then copy your old home directory to your new one using:
cp -ar /oldroot/home/username /home

(the -a option ensures all timestamps and permissions are preserved).


Hope this helps!


Jonathan





More information about the fedora-test-list mailing list