Replace Linux boot disk

Posted on 2006-05-04
Last Modified: 2012-06-27
My current system has a RAID0 stripe in software (sda and sdb) as md0 (two SATA 250GB disks), the MBR and /boot partition are on standard IDE disk (as the md0 will not raid). This setup works very well. The boot disk (hda) is 160GB and has another partition on it that is now full. As a consiquence the disk is now 99% full. I want to replace it with a IDE 400GB unit.

My question is if I connect this 400GB IDE disk up via an external USB caddy, can I then use dd to copy the entire 160GB structure over to the 400GB disk, then do a direct swapout and it will still boot and load the md0? I will backup and restore the larger partition on hda (so i can erase and create a larger partition).

If this is not a good method...can someone suggest a better one?

BTW: the /boot partition is ext3...all others are reiser3
Question by:prof666
    LVL 14

    Accepted Solution


    Are you using lvm? if you are just add the new md-device (setup a new md1 and add it to the current volume group).

    If not just there is no need to use dd, tar or cpio is more efficiant...

    I would do it like this...

    1. boot the box from a live-cd of your choice... (I use gentoo)
    2. move all data (tar -cvf - <source> | | tar -C <target> -xvf -)
    3. replace the disks
    4. create the new disk layout (using fdisk, mdadm...)
    5. mount the new disks and put the data back (swapping the tar command above)
    6. chroot into new system (chroot /newroot /bin/bash)
    7. setup grub

    Or simular...


    LVL 22

    Expert Comment

    I agree that tar or cpio is the better method here!

    This will work, provided that the partitions for the boot drive remain the same. i.e, the old hda1 is copied to the new hda1. Swap partitions on the boot drive will need to be the same as the original.

    If you can't manage that, then you will need to edit the /etc/grub.conf , and the /etc/fstab files or the equivalent for your distro. Best try and keep the partitions labelled examctly the same.

    Good luck! - Even if it doesn't quite work, you can always put the original drive back in whilst you work out what went wrong (if this is a production system). However, the process isn't that complicated, and you should eb able to manage it reasonably easily.


    LVL 34

    Expert Comment

    by:Duncan Roe
    tar / cpio is much better. If you use dd, the 400GB disk will look like a 160G disk to the system (been there, done that ;)
    LVL 22

    Expert Comment

    ...but have you got the T-Shirt duncan? ;)........and how many days did it waste redoing it once the mistake was realised? I had a 60GB drive that took 4 hours just to copy from an IDE to a SATA.....I rebooted and then the penny dropped! - ooops - we all make mistakes....but hopefully we learn from them:)

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
    The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now