[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] restore backup with chroot + grub-install



On Sat, 2004-12-11 at 18:19, Robert Arkiletian wrote:
> >>5) then  chroot /mnt/sda1 /sbin/grub-install /dev/sda

> Does line 5 look okay?

If you have booted an install disk in rescue mode it will be
/mnt/sysinstall.  Do the the 'chroot /mnt/sysinstall' then
at the next prompt '/sbin/grub-install /dev/sda' and
exit twice to reboot.


> >The original install will have put labels on the partitions.  You'll
> >either have to create matching ones with e2label or edit /etc/fstab
> >and grub.conf to refer to the partition device names.  Note that
> >/etc/grub.conf is a symlink to /boot/grub/grub.conf so you have to
> >edit the real location or wait until you have your new partitions
> >mounted in their relative positions and chroot'ed to its root.
> >  
> >
> 
> Yeah I noticed this label business. Here is fstab from the server
> 
> ==========================================
> LABEL=/                 /                       ext3    defaults        1 1
> none                    /dev/pts                devpts  gid=5,mode=620  0 0
> LABEL=/home             /home                   ext3    defaults        1 2
> none                    /proc                   proc    defaults        0 0
> none                    /dev/shm                tmpfs   defaults        0 0
> /dev/sda2               swap                    swap    defaults        0 0
> /dev/cdrom              /mnt/cdrom              udf,iso9660 
> noauto,owner,kudzu,r
> o 0 0
> /dev/fd0                /mnt/floppy             auto    
> noauto,owner,kudzu 0 0
> ==========================================
> 
> I thought it should have looked like
> 
> ========================================
> /dev/sda1                 /                       ext3    
> defaults        1 1
> none                    /dev/pts                devpts  gid=5,mode=620  0 0
> /dev/sdb1             /home                   ext3    defaults        1 2
> none                    /proc                   proc    defaults        0 0
> none                    /dev/shm                tmpfs   defaults        0 0
> /dev/sda2               swap                    swap    defaults        0 0
> /dev/cdrom              /mnt/cdrom              udf,iso9660 
> noauto,owner,kudzu,r
> o 0 0
> /dev/fd0                /mnt/floppy             auto    
> noauto,owner,kudzu 0 0
> ========================================
> 
> Would I still need to edit fstab and grub.conf if I chroot to the newly 
> mounted and untared drive and do a grub-install from there?

Yes - you either have to add the labels yourself with e2label to
match the old ones or change the references to use device names.
It doesn't matter which you do, but the labels won't be added
automatically and the system won't boot unless the references
match something.  Don't panic if it doesn't boot the first time.
You can always reboot with the CD and fix things.  Note also that
you have a swap partition at /dev/sda2.  You'll also have to fdisk
this partition, setting its type to 82 (linux swap) and then
'mkswap /dev/sda2'.  You can move this as long as you edit
/etc/fstab to match.


> Good advice Les thanks. But the reason I chose gnoppix (Ubuntu) is that 
> it has a relatively up to date adaptec aic79xx driver since it uses 
> kernel 2.6.7.  If I use the RH9 install disc in rescue mode it has an 
> old/buggy scsi driver for the aic79xx. That's why I was scared to 
> tar/copy the entire fs with it. Needless to say I have the latest scsi 
> driver running on the server now but this was installed with an rpm 
> update. Reading your post carefully I can imagine myself using gnoppix 
> to fdisk and untar/copy to the new drive (with the advantage of the new 
> scsi driver) . Then as you suggest reboot again with the RH9 cd to 
> rescue and then finally just chroot and grub-install. Hopefully, I 
> should not have to mess with labels. Is this all correct?

I have some machines with an even worse problem with the RH9 CD - it
won't even see the drives.  A fedora core1/2 or corresponding k12ltsp
install CD will work in rescue mode, but as long as RH9 sees the drives
it should be ok for the final step to make the disk bootable.  I think
RH9 was still able to boot from a floppy so you might want to make
one.  Later systems just don't fit.

> 
> >The only other trouble you might have would be if the target machine
> >has a different scsi controller than the source.  In that case you
> >have to edit /etc/modules.conf (or conf.modules on older systems) in
> >the CD boot/chroot step to change the scsi driver module and then
> >rebuild the initial ramdisk with /sbin/mkinitrd.
> >  
> >
> 
> Wow you really have experience Les! But if we had a catastrophy like a 
> burglary then I would repurchase the same components.  I am mainly 
> afraid of the scsi drive dying. I would just go and buy the exact same 
> drive and restore. Feels good to have a backup.

If you are going to make an exact image, you can trade system time
for human trouble and just do a raw copy.  Plug the new drive in
jumpered for a drive select above your existing 2, boot from CD and do:
  dd if=/dev/sda of=/dev/sdc
to copy your first drive to the new (third) drive.  This will take all
the boot, partition, and label information along.   Then do the
same for /dev/sdb to copy the second drive.  You can put the disks
in some other machine and copy over the network too.  Boot the source
disk with gnoppix/knoppix to make sure the image doesn't change - the
target can be running normally as long as the drives aren't mounted.
The copy command in this situation would be:
 dd if=/dev/sda |ssh root target_machine dd of=/dev/disk_name
Be careful to get the remote disk name right, of course...

These copies will take a while but they are a good way to clone
machines - just boot into single user mode and change the host name and
IP number if you aren't replacing the source drives on an existing
machine.

I'll still plug backuppc as the way to handle backups though.  Install
it once and it will be able to give you the tar images you are starting
from any time you need them - current or back a few days.  The only
change from your restore plan would be that you'd have to look up the
command line to get the tar image you need and issue it via ssh from
your gnoppix boot, piping to tar to extract locally on your new drive.

---
  Les Mikesell
   les futuresource com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]