[K12OSN] Server Clone

Les Mikesell les at futuresource.com
Wed Jun 2 15:23:18 UTC 2004


On Wed, 2004-06-02 at 09:12, Jim Kronebusch wrote:

> I have used the WBEL install disk and chosen rescue mode, of course the
> first time it fails to mount /mnt/sysimage and dumps me to command line.
> There I create /tmp/sda2 and mount /dev/sda2 /tmp/sda2 then modify
> /etc/fstab to /dev/sda2 and /dev/sda1 instead of LABEL=/ and LABEL=/boot
> and leave everything else alone.  Then I reboot and it fails to mount
> /mnt/sysimage again, I run through the same sequence and find that fstab
> has maintained its settings.

Something went wrong saving this file.  Note that it is not /etc/fstab
but /tmp/sda2/etc/fstab when mounted in the temporary location.  You
also have to make sure the partition is unmounted cleanly before you
reboot or the changes might not be written back.  You'll have to get
this file changed or add the labels to the partitions so they match.

> Any ideas why it won't mount?  It gets an
> invalid argument when trying to mount sda1 and sda2 on its own and tells
> me that I have no linux partitions on the system.  But fdisk -l lists
> Device	Boot	Start	End	Blocks	ID	System
> /dev/sda1	*	1	13	104391	83	Linux
> /dev/sda2		14	841	6650910	83	Linux
> /dev/sda3		842	1092	2016157	82	Linux Swap
> Device
> /dev/sdb1	*	1	6607	53070696	83	Linux
> (54GB Raid 5 for /home)

This just shows the drive partition table.  You have to have
done a high level format with 'mke2fs -j' before the partition
is mountable.  If you used a high-level approach like ghost it
may have done this wrong, and unless it was the very latest version
may not have understood the ext3 type.

> And if I try to mount /dev/sda1 or 2 to their /tmp/sda1 or 2 I also get
> an invalid argument error, but if I rm /tmp/sda1 and 2 then mkdir
> /tmp/sda1 and 2 and mount /dev/sda1 and 2 to /tmp/sda1 and 2 the mount
> fine and I can again browse the directories cloned from the server.

That doesn't make sense.  You must have either left something already
mounted from an earlier attempt or have accidentally created regular
files instead of directories for the mount points.

> So I tried the "e2label /dev/sda1 /boot" and "e2label /dev/sda2 /" and
> recorrected the /etc/fstab back to using the LABEL=/ and LABEL=/boot and
> tried again.  Still no luck mounting /mnt/sysimage, same errors.  

It will probably fail as long as it can't match up every partition
mentioned in fstab.  Do you have a filesystem on /dev/sdb1 or
labeled HOME?  The contents probably don't matter, but it needs
a formatted filesystem to mount.


> Is there a way for me to rerun the linux rescue from the command line
> after I have manually mounted the partitions?

The rescue boot doesn't do any real magic.  You can accomplish the
same thing by mounting the partitions in their relative positions
yourself.  That is, if you mount your root partition on /tmp/sda2,
then mount /dev/sda1 as /tmp/sda2/boot.  Then 'chroot /tmp/sda2'.
This does require using a boot CD that is approximately the same
version as what is on the hard drive because you start executing
code from the mounted partition as soon as you chroot.  The chroot
command changes your concept of the root of the filesystem so what
was /tmp/sda2 now becomes / (as it would be in normal operation).


> Also my original system shows this for fdisk -l
> Device	Boot	Start	End	Blocks	ID	System
> /dev/sdb1	*	1	13	104391	83	Linux
> /dev/sdb2		14	841	6650910	83	Linux
> /dev/sdb3		842	1092	2016157	82	Linux Swap
> Device
> /dev/sda1	(205GB Raid 5 for /home)
> 
> So I am currently redoing my raid setups to hopefully get the new mirror
> to also be sdb instead of sda incase for some reason that is affecting
> things. 

No, it is odd to boot from the second drive unless you have a
dual-boot system. 

> But from what current advice seems to hint it shouldn't since I
> have been manually modifying fstab and system labels?
> 
> Also is the boot loader actually their since I can mount /dev/sda1 and
> browse all my kernels and grub.conf and so on?  Or do I just have the
> files but not the necessary boot blocks?

Yes, if everything is correct on the partitions when you mount them,
all you need is to have fstab match the correct names or labels and
get the boot block installed.  I was assuming that you would keep
the same partitions, so you may have to adjust your grub.conf if
you have swapped sda/sdb.  If this is an older system you may
be able to make a boot floppy that will save some time if you don't
get grub right the first time or two, but current kernels are too
big to fit.  From your chroot shell, try:
mkbootdisk --device /dev/fd0 kernel_version
where kernel_version is the number returned by 'uname -r' on
the master system.

> I am glad I keep my hair short or I would have one hell of a mess on my
> desk right now.

It does tend to be frustrating because the reboot cycle takes so long.

---
  Les Mikesell
   les at futuresource.com

\





More information about the K12OSN mailing list