There are several methods to move running Linux to another hard drive at the same server. But I used Unix dump/restore utility to perform this…

First of all it’s necessary to partition new hard drive in the same way as it’s done with old drive (Linux is running at). I usually use ‘fdisk’ utility. Let’s assume that old drive is /dev/hda and new one is /dev/hdb. To view hda’s partition table please run ‘fdisk -l /dev/hda’ which should show something like this:

Disk /dev/hda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 15 120456 83 Linux
/dev/hda2 16 276 2096482+ 82 Linux swap
/dev/hda3 277 7297 56396182+ 83 Linux

After this run ‘fdisk /dev/hdb’ and make the same partitions at it. Interactive mode of fdisk utility is well documented and is very intuitive, so I don’t think it would be difficult to perform partitioning.

After this is done, we should make new filesystems at partitions we’ve created:

mkfs -t ext3 /dev/hdb1
mkfs -t ext3 /dev/hdb3
mkswap /dev/hdb2

When it’s done it’s NECESSARY to mark newly created filesystems as it’s done with old ones. To check filesystem volume name run command ‘tune2fs -l /dev/hda1 | grep volume’ and etc. You’ll see something like this:

Filesystem volume name: /boot

It means that we should mark new hdb1 with label /boot. It can be done by command:

tune2fs -L “/boot” /dev/hdb1

The same should be performed for all partitions except swap one. In my case I should label hdb3 by command:

tune2fs -L “/” /dev/hdb3

At this point new hard drive preparation is finished and we can proceed with moving Linux to it. Mount new filesystem and change directory to it:

mount /dev/hdb1 /mnt/hdb1
cd /mnt/hdb1

When it’s done we can perform moving by command:

dump -0uan -f – /boot | restore -r -f -

And the same with / partition:

mount /dev/hdb3 /mnt/hdb3
cd /mnt/hdb3
dump -0uan -f – / | restore -r -f -

When dump/restore procedures are done we should install boot loader to new HDD. Run ‘grub’ utility and execute in it’s console:

root (hd1, 0)
setup (hd1)
quit

In case everything is done carefully and right (I’ve tested this method by myself) you can boot from new hard drive and have ‘old’ Linux running at new hard drive running.

Good luck!

 

19 Comments

 

  1. January 20, 2009  2:20 pm by Make Money Online Reply

    Hey, this is Jing here and I just want to say interesting WP blog you have here. Just dropping by and saying hey!

  2. March 12, 2009  5:23 pm by Yousuf Reply

    Hi, good info, but using dump & restore is very proprietary to each filesystem. It will work for Linux's Ext2/Ext3 filesystems, but it may not work if you're using another Linux filesystem like ReiserFS or JFS or XFS. The dump program is proprietary to each filesystem, though the restore is portable. An alternative solution would be to use tar in a similar respect to how you used the dump and restore:



    tar cf - --one-file-system /source | ( cd /destination ; tar xvf - )



    The first tar command in the sequence acts like your dump, while the second tar inside the parenthesis "()" act like your restore. The first tar sends its output directly to the second tar through the standard input and output. No tar archives are created.



    The "--one-file-system" option only works with GNU tar (which is the version that comes with Linux), and it prevents the tar from crossing filesystem mount points. This way you will only backup and restore one file system at a time.

  3. August 18, 2009  12:31 pm by Øyvind Reply

    Hi, nice guide, but i'm stuck at the "dump" part, do you think you could help me out?



    oaeide@server:/mnt/sdd1$ dump -0uan -f - /boot | restore -r -f -

    DUMP: You can't update the dumpdates file when dumping a subdirectory

    DUMP: The ENTIRE dump is aborted.

    restore: Tape read error on first record



    Both Sda1 and Sdd1 are labaled /boot

  4. Pingback : Changer de disque dur sans réinstaller Ubuntu | Void And Any

  5. January 13, 2010  11:20 am by sankar Reply

    this is very useful to us.

    Thanking you,

    with regards,
    p.sankar

  6. Pingback : Linux – move to new hard drive - Iam8up Blog

  7. June 25, 2010  9:04 am by JohnnyBoyClub Reply

    The method i am using to move linux is :
    - I am using the software http://www.dmailer.com/dmailer-backup.html is a free software that allows you to backup and save your files online.
    - Making the backup to all files
    - Saving it online
    - Than restore it on the other drive
    - And i am ready to go

  8. October 31, 2010  11:25 pm by guillermo Reply

    I realize this post is very old, but i was wondering if i could move my debian to another hard drive, but keep booting grub from the old one. I need this because i'm trying to move debian to an ide hard disk and my server only boots the scsi drives. Is it possible to load grub in one disk and have the actual os on another?

  9. December 31, 2010  11:04 pm by seat covers for trucks Reply

    Any probability you might propose an excellent feed reader? I desire to follow your site to maintain up with what you write.

  10. January 25, 2011  5:18 pm by Sandra Juris Reply

    I do agree along with quite a few other people; each of our children have to have a lot more organization within his or her education And require to perform harder. This will happen only when We do not accept anything less from them; then, they will expect it of themselves.

  11. February 12, 2011  9:32 pm by perth business marketing Reply

    I've been gone for some time, but now I remember why I used to love this website. Thanks, Iâ??ll try and check back more frequently. How frequently do you update your web site?

  12. March 2, 2011  9:24 pm by detox colon cleanser trial Reply

    As a web site owner I think this article here is reallyfantastic. Thank you for your hard work. You should keep this up forever! Good Luck..

  13. April 11, 2011  3:10 am by Zaurd Reply

    highly recommended http://www.hdbflatforsale.net for good and reliable property agents

  14. March 23, 2012  1:03 am by BankCardUSA Reply

    I lately came across your blog and have been reading along. I thought I would leave my first remark. I don't know what to say except that I have loved reading. Respectable blog. I will keep visiting this blog very often.

  15. September 19, 2012  7:08 pm by gamezat Reply

    thanks ofr this but i found a linux based live cd called clounezilla it's a very easy
    thanks anyway

  16. March 6, 2013  3:03 pm by Alex Reply

    The last sentence in the post is pretty useful :)

  17. April 19, 2013  8:57 am by Jenni Reply

    Having read this I thought it was very enlightening.
    I appreciate you finding the time and energy to put this
    short article together. I once again find
    myself spending a lot of time both reading and leaving comments.
    But so what, it was still worth it!

  18. April 29, 2013  8:22 am by Margo Reply

    Hi, i think that i saw you visited my web site thus i
    got here to go back the choose?.I am trying
    to to find issues to improve my site!I guess its ok
    to make use of some of your ideas!!

Leave a reply

 

Your email address will not be published.