How to Move a Linux Installation to a New Computer
- Install debian on the new machine from the CD – just do a basic install and don’t bother to configure anything.
- on the old machine – login as root and type telinit 1 at the prompt to shutdown all services. This will allow you to copy all of the files because they will not be in use anymore.
- on the old machine – backup up all of your important files. This should include /etc /home /var /usr. Use TAR to compress all of these folders into one file with a command such as this:
tar –cpf /home/username/tarbackup.tar /etc /home /var /usr
The first half defines the tar file that will be created, followed by a list of the folders to be included in the tar file.
- copy the tar file to your new machine via any means you can
- on the new machine – login as root and type telinit 1 at the prompt to shutdown all services. This will allow you to copy all of the files because they will not be in use anymore.
- on the new machine – untar the tar file to a folder
tar –xpf /home/username/tarbackup.tar
- on the new machine – copy the files to their final destinations in the root folder. You should delete the existing /etc /home /var /usr folders before you copy the ones from the old computer. This will make sure there is no extra junk in these folders that you don’t need.
- To Delete folders: rm –r /foldername
To copy files:
cp –Rp /source path /
(the final / is the destination path which in this case is the root folder)
- Once all of the folders have been copied, restart the computer. Shutdown –r now
Update:
A better method using System Imager can be found here: http://www.howtoforge.com/howto_linux_systemimager
Key Points:
Important: In new SystemImager versions (I think starting with 3.4) you have to prepend the string “si_” to all commands, so getimage becomes si_getimage, prepareclient becomes si_prepareclient, mkautoinstalldiskette becomes si_mkautoinstalldiskette and so on.
Create an Image:
On the golden client, run the following command:
prepareclient –server 192.168.0.2
On the image server, run
si_getimage -golden-client 192.168.0.100 -image my_golden_client -ip-assignment replicant
where my_golden_client is the name of the image you want to create. -ip-assignment can have one of the following 4 values (see man getimage):
Install an Image:
On the client machine, run
si_updateclient -server 192.168.0.10 -image my_golden_client