Moving hard drive from one machine to another can be hacky…

Hi all.

Due to a hardware failure I had to say goodbye (I think permanently this time) to one of my fav machines. I have a spare one so I am not going to cry over it but what got me worried for a moment was will I be able to get my data / installation from the old machine to the new one. In the past when I was moving from one machine to another I was just reinstalling fresh with my latest remaster. This time however I was moving hdd from a AMD based machine to a Intel based machine. The hdd has a installation that is running on the a64 kernel… Intel will not run well with a64 kernel I thought… I was right. First thing I have noticed was hdd timeout (different modules / architecture) and soon after kernel panic followed… Yeah that went well I thought… Remaster was made with a64 kernel too so… that idea was as good as… I didn’t wanted to loose all my data or to spend a great deal of time reinstalling from the scratch (I have to many customized settings on this installation…) so I thought for a while and I recalled a great post by a good Friend of mine Old-Polack on the PCLinuxOS Forum

With the hdd in the machine I have booted the computer with PCLinuxOS 2011.6 KDE4 LiveCD choosing Console from the grub options. Then I have logged in as root using password root.

Then I have issued the following commands:

mkdir /here

mount /dev/sdaX /here

In my case it was sda1

mount -o bind /proc /here/proc

mount -o bind /sys /here/sys

chroot /here

service network start

apt-get update

apt-get install kernel-

This basically means that from the LiveCD level I have became a root of my hdd installation / started network connection there and installed BFS kernel. After this was done I pressed the power button and allowed the machine to power-off slowly.

Then I have booted the machine from the HDD installation but I chose BFS kernel entry from the grub which now appeared there and was ready to be used. After a while of waiting for the modules to compile I was able to boot the machine into the KDE4 desktop.

I redid my xserver, sound, cpufreq and grub (defaulted to BFS kernel) settings and I was good to go… All my stuff but in a new machine without reinstalling…

Now You can use this method to reinstall kernel / upgrade kernel / install apps / change settings and so on if the booting from HDD installation fails.

Awesome trick. Thanks Old-Polack.

I have decided to re-post the info here just in case…

Now can someone please tell me how to do the same thing under windows without the BSOD??? 😛 Not that I need it… I was just pointing out another Linux advantage… 😉




"Never meet Your heroes. Most of the time you'll only end up disappointed." White Polak Male Husband Employee Hetero Carnivorous Fugly Geek @$$hole with ADD Catholic “Some men just want to watch the world burn.”

Comments are closed.