Howto move your linux instalation to another hard drive

In this post I will describe how to move your existing linux installation to another hard drive. This maybe useful if you have bought a new computer and you want to keep your linux and not install it from scratch.

So first of all we will need some live cd linux, because we can’t migrate “/” partition when system is running because there are many temporary files (like lock files, pid files) that we don’t need to migrate, otherwise migrated system will not run correctly. So I have chosen Knoppix live cd which you can download from http://www.knoppix.net/.

Now we need to connect both hard drives (old and new) to same computer and boot from Knoppix live cd.
When Knoppix is successfully booted we need to mount both partitions (old and new). Note that we need to mount new partition in writable mode. If you haven’t any created partition yet on new hard drive you can create it by running “qtparted” or “gparted”. Let’s assume that old partition’s name is sda1 and new one is sdb5.

Then we have to open terminal, become root:

$ su

After that we can start copying:

$ cp -av /mount/sda1/* /mount/sdb5/

This may take a while depending on size of your data.

After that boot with your distributive cd, enter “rescue system” mode (in my case I’m using fedora) and simply run:

$ grub-install /dev/sdb5

That’s all. If you will experience some problems don’t hesitate to write me about that 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.