Jan 24, 2008

Copying Home Folder

I know this next line needs a lot of explanation, but the resulting tar commandline is one line:

mount /dev/hda5 /newhome;cd /home;tar cvf - .|(cd /newhome;tar xvf - .);umount /newhome;mount /dev/hda5 /home


OK. No panic. I will explain. The "mount /dev/hda5 /newhome" just mounts the newly created partition (I suppose for the sake of simplicity the the newly created partition is hda5). That step is not required at all if you used diskdrake to create the partition, and you clicked the mount button after you created the partition. The "cd /home" means change to the /home directory (similar in effect to selecting a directory in the file manager).

Now the meat: "tar cvf - .|(cd /newhome;tar xvf - .)" This means create, on stdout, a tar archive of the current working directory (i.e /home since in the previous cd instruction we selected the /home as our current working directory) and pipe the created tar file into the second tar instruction which will untar stdin into its current working directory which will be /newhome in this example.

After that we unmount the partition from the /newhome mount point "umount /newhome" and remount it on /home: "mount /dev/hda5 /home"

After that the only thing we have to do edit the /etc/fstab telling the system on the next reboot that our /home directory structre is not part of the / partition anymore but it is a separate partition. The linux command to do this:

echo "/dev/hda5 /home auto defaults 0 0">>/etc/fstab


The >> sign is a special form of redirection meaning append the output to the end of the file (concatenate).

I know, I know a lots of talk, but believe me it is a lot easier to explain (and do) this using the terminal than it would be writing a step by step instruction how to do this with the GUI: clicking here clicking there, dragging from here dropping to there...

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home