Replace Linux boot disk

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
Who is Participating?
cjl7Connect With a Mentor freelance for hireCommented:

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...


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.


Duncan RoeSoftware DeveloperCommented:
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 ;)
...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:)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.