?
Solved

Switch hard drives

Posted on 2003-03-25
8
Medium Priority
?
142 Views
Last Modified: 2013-12-15
Hello,
What I'm trying to do is switch my linux installation from an old hard drive to a new one.  I'm running Redhat 8.0, and using GRUB.

What I've done so far is partitioned the new hard drive, and mounted it.  I then copied everything over to the new hard drive using:
cp -ax / /new_disk

This is where Im stuck at.  I need to be able to remove the old hard drive, and have linux boot to the new one.  I am unsure on how to make GRUB do this.

Thanks for the help.
0
Comment
Question by:lwinkenb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 5

Author Comment

by:lwinkenb
ID: 8201492
oh yeah,
My old drive and data is /dev/hda1
My new drive and data is /dev/hdc2 (first partition is swap)
0
 
LVL 2

Expert Comment

by:haydes007
ID: 8203550
edit /etc/grub.conf and change what /dev/ the entry points to. Then all you need to to is reboot and grub should (hopefully) do its thing. The question I have is whether or not you can simply just cp the old installation to a new drive and expect it to boot like the old one did. I hope it works but I really don;t think it will. I will be interested to see if it does.
0
 
LVL 9

Expert Comment

by:mglxxx
ID: 8204514
haydes007's approach won't quite work: if the old hd is
removed, there won't be any GRUB the system will be able
to boot from.

Here's what to do in addition to editing /etc/grub.conf
as specified by haydes007:

Create a grub boot floppy:
cd /usr/share/grub/i386-redhat
dd if=stage1 of=/dev/fd0 bs=512
dd if=stage2 of=/dev/fd0 bs=512 seek=1

Now shut down your machine and remove the old disk.
You could plug the new disk into the controller port
where the old one was. This way the new disk becomes
/dev/hda. I assume that you will do this.

Now boot your machine from the grub boot floppy. This
will put you at a grub prompt.
Your new root filesystem is /dev/hda2. In order to
tell grub about that do a
root (hd0,1)
Now make grub install an MBR on the new HD:
setup (hd0)

Tell grub to reboot the machine:
reboot

Remove the floppy from the drive.
The machine should now start from the new hd and
show the grub menu.
0
How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

 
LVL 5

Author Comment

by:lwinkenb
ID: 8205102
ok, I tried everything you said and I got this when trying to reboot from the new drive:
When it says "Mounting root filesystem" the next line reads
"Mount: error 2 mounting ext3"
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2
umount /initrd/proc failed: 2
Kernel panic: No init found, Try passing init= option to kernel

Any ideas what the problem is?
0
 
LVL 9

Expert Comment

by:mglxxx
ID: 8208570
This looks like a problem in your grub.conf.
Make sure that you
specified root=/dev/hda2 in the 'kernel' line.
Also /etc/fstab should be modified to reflect the
new root device, unless the root device is
specified using LABEL=/
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 8208724
ok, when I added root=/dev/hda1 to the grub kernel line (I repartitioned the drive so that the linux installation came before the swap),
It gets past the kernel panic, but then it gives this during boot up:
Checking root filesystem
Couldn't find matching filesystem: LABEL=/
0
 
LVL 9

Accepted Solution

by:
mglxxx earned 1000 total points
ID: 8208899
Modifying the /etc/fstab entry for the root file system
to start with /dev/hda1 instead of LABEL=/ should help.
Boot into 'rescue' mode from the installation CD in order
to do this.
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 8214486
That did it, thanks a lot mqlxx.
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 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