[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Replace Linux boot disk

Posted on 2006-05-04
Medium Priority
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 boot...software 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
  • 2
LVL 14

Accepted Solution

cjl7 earned 2000 total points
ID: 16604109

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

ID: 16605351
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 35

Expert Comment

by:Duncan Roe
ID: 16610127
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

ID: 16610163
...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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 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