Getting an existing Linux installation from one computer to boot on another

General support questions including new installations
DemiSheep
Posts: 15
Joined: 2010/05/10 18:24:54

Getting an existing Linux installation from one computer to boot on another

Post by DemiSheep » 2011/01/15 00:22:28

I have an existing Dell Precision 690 workstation setup to dual boot Windows XP and CentOS 5.5. These operating systems are installed on two separate drives. I have a grub menu on the Linux drive with it set as drive 1 and points to the windows boot info on drive 2.

I tried taking the linux drive and installing it in a new HP Z800 workstation to see if I could be lucky enough to get it to boot, but it didn't. Immediately after it starts to boot I get a few errors.

Here is what the system shows:

Right after this message "Red Hat nash version 5.1.19.6 starting" I get the following lines:

Unable to access resume device (LABEL=SWAP-sda2)
mount: could not find filesystem '/dev/root'
setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

Is there something I can tweak to get this to possibly boot? I'd really like to not have to reload CentOS 5.5 and the specialized software on this machine.

I do have a grub menu setup on this drive, could this by chance be my problem? The drives in the old machine are setup with Linux as drive 1, and Windows as Drive 2, and the Linux drive hosts the grub menu allowing me to boot to Linux or Windows. Could this some how be the problem?

I do know of a way around this with Windows: install a secondary HDD controller card in the machine, install the drivers, hooked up drive to controller in old machine and make sure it boots, move the drive and controller to the new machine and boot off it, load the motherboard drivers (specifically the hdd controller drivers) and then you can take out the controller card, connect the hdd directly to the motherboard and you're set. This same thing is probably accomplish able in Linux, but I'm not sure. This might be a last ditch effort to try if nothing else works.

Thanks in advance.

User avatar
TrevorH
Forum Moderator
Posts: 31067
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Getting an existing Linux installation from one computer to boot on another

Post by TrevorH » 2011/01/15 01:57:29

You probably need to rebuild the initrd in the new machine. To do this, boot the Centos CD in rescue mode (type "linux rescue" at the initial boot prompt from the CD). It asks you if you want to serch for existing Centos installations and mount them on /mnt/sysimage so say yes. At this point do the following

[code]
mount --bind /proc /mnt/sysimage/proc
mount --bind /dev /mnt/sysimage/dev
mount --bind /sys /mnt/sysimage/sys
chroot /mnt/sysimage
cd /boot
mv initrd-2.6.18-194.32.1.el5.img initrd-2.6.18-194.32.1.el5.old
mkinitrd intrd-2.6.18-194.32.1.el5.img 2.6.18-194.32.1.el5
reboot
[/code]

You'll need to substitute whatever is your current kernel release into all those commands - I just used 2.6.18-194.32.1.el5 as an example.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Getting an existing Linux installation from one computer to

Post by pschaff » 2011/01/15 16:05:28

Given that I have provided nearly identical procedures in the past, I have taken the liberty of basing a new Wiki page on this post. :-)

[url=http://wiki.centos.org/TipsAndTricks/CreateNewInitrd]TipsAndTricks/CreateNewInitrd[/url]

Would be glad to add attribution if you want the fame and fortune. ;-)

User avatar
TrevorH
Forum Moderator
Posts: 31067
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Getting an existing Linux installation from one computer to boot on another

Post by TrevorH » 2011/01/15 17:04:44

Good idea, I've typed that in too many times so it would be a useful wiki addition. No attribution necessary :-)

DemiSheep
Posts: 15
Joined: 2010/05/10 18:24:54

Re: Getting an existing Linux installation from one computer to boot on another

Post by DemiSheep » 2011/01/21 00:00:00

Before I do anything does this give you any other ideas, my grub setup:

title Winddows XP
rootnoverify (hd1,0)
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

I am seriously thinking of trying to move the two drives setup on a RAID0 on ports 1 and 2 to ports 2 and 3 or 3 and 4 and putting the linux drive on port 1. My previous setup had the linux drive set as drive one and this is probably my whole problem.

I can post my actual configuration tomorrow maybe..

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Getting an existing Linux installation from one computer to boot on another

Post by pschaff » 2011/01/21 00:15:43

Not enough information to venture a guess, and the RedmondOS stanza is not really relevant to CentOS. It should be possible to get things working without switching physical connections. Have you tried booting in rescue mode? Have you made a new initrd? Please provide some more substantial information as suggested in [url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14274&forum=47]Readme First[/url] and [url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=25128&forum=47]How to provide information about your system[/url]. Your /boot/grub/grub.conf should be included.

User avatar
jlehtone
Posts: 3658
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Getting an existing Linux installation from one computer to boot on another

Post by jlehtone » 2011/01/21 13:34:49

It is good that the routine is in Wiki.
@Phil: May I humbly mention an another tip for the cases when you
a) Know what you are doing
AND
b) Know that mkinitrd will fail
?

One can unpack a initrd-[i]foo[/i].img by:
[code]mkdir unpacked
cd unpacked
cat /boot/initrd-foo.img | gunzip | cpio -i[/code]
Then in can edit commands in the 'init' file, possibly add (static) binaries to directories, and finally repack:
[code]find | cpio -o -H newc | gzip -9 > /boot/initrd-bar.img[/code]
Naturally, the '/boot/grub/grub.conf' might need an edit too, to use the new version,
or then you choose interactive Grub during boot and type in commands correctly ...

(This unpack/pack procedure did I gleance from the mighty inet and manuals, but since then
have had to resort to google to find my post from this Forum, whenever a repeat is needed.)

These tips might be on their last days of triumph now, for surely the upcoming 6 will
resort to the more dynamic dracut? But no fear, that aint here yet, nor will the steadfast 5
vanish overnight.



Now I recollect the meaning of that RedmondOS stanza. It is on the second disk and those
two 'map' commands swap hd0 and hd1, so the booting unspeakable thinks it is actually
starting from [the first partition of] the first physical disk, as it by default stubbornly prefers to do.


Sure, if the disk has been the first one and the kernel arguments, the initrd, and the /etc/fstab
all do refer to the disks by the /dev/sda*, then having the disk as not first is likely to cause trouble.

Like with the already discussed stanza, Grub could fool the OS somewhat. Not my favourite.
The BIOS, did you or can you tell it to boot from that particular disk? But even that would
probably mess with device enumeration (or already did).

Therefore, a longer-term tip would be to use LABEL or UUID on the three places, where
the filesystems are referred to. I thought that that [LABEL] is the default with CentOS?


Last note: the actual error message occurs earlier on the output, than what was shown in the OP.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Getting an existing Linux installation from one computer to boot on another

Post by pschaff » 2011/01/21 14:17:30

[quote]
jlehtone wrote:
It is good that the routine is in Wiki.[/quote]

Thanks. I added some additional details and suggestions based on you comments, but could not really do them justice without going beyond a TipsAndTrick into a full HowTo. Added a link to this thread for the curious.

[quote]
Now I recollect the meaning of that RedmondOS stanza. It is on the second disk and those
two 'map' commands swap hd0 and hd1, so the booting unspeakable thinks it is actually
starting from [the first partition of] the first physical disk, as it by default stubbornly prefers to do.[/quote]
Yes. That is almost a FAQ and may be worthy of a tip as well.

[quote]
... I thought that that [LABEL] is the default with CentOS?[/quote]
It is the default for 5.x - 6 is going to UUID, following the upstream.

DemiSheep
Posts: 15
Joined: 2010/05/10 18:24:54

Re: Getting an existing Linux installation from one computer to boot on another

Post by DemiSheep » 2011/01/21 19:01:47

:oops: Ok, so I thought I had tested the ghosted drive, but it seems I didn't. I went ahead and tested the ghosted drive in the old machine and sure enough I am having the same problem so it seems the ghost failed. I am reghosting it now and will test it ont he same machine before moving it to the new machine. I'll send an update when this is done and I may end up starting a new thread depending on what issues I run into from there. Sorry for any inconvenience I may have caused.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Getting an existing Linux installation from one computer to boot on another

Post by pschaff » 2011/01/21 19:12:24

No inconvenience, and at the very least the topic resulted in a new Wiki page. :-) Please do keep us posted.

Post Reply

Return to “CentOS 5 - General Support”