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

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

Les Mikesell wrote:

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.

Thanks for reminding me to exit twice. I would have forgot.

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.

I prefer to go without labels. So I will edit fstab and grub.conf. It looks easy enough.

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.

I was planning on adding sda2 as a swap partition when I fdisk the new drive but I did not know I had to mkswap. Thanks Les. I assume the RH9 will call swapon when it boots.

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.

Yeah RH9 does see the drive, it will even work in production with my class but under heavy load it corrupted the whole filesystem last summer. So I stick to the newer aic79xx driver from Adaptec which has been stable.

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

Actually Les, I did that TOO. You see my backup drive is a 120GB ide drive plugged into a mobile rack. My server has two 36GB scsi drives, one for / and one for /home. I used fdisk to make the first partition on the backup drive exactly match /dev/sda1 (the / partition). Then

dd if=/dev/sda1 of=/dev/hdb1

then to copy the boot record

dd if=/dev/sda of=/dev/hdb bs=446 count=1

Actually I mistakenly did bs=512 and learned the hard way that the partition table was also copied. So I have a stupid swap partition hdb2 on the backup drive mbr.
I cannot dd over /dev/sdb1 (the home partition) to another partition (maybe dd if=/dev/sdb1 of=/dev/hdb3) since the cylinders will not match. So I decided to copy /home using tar to hdb3. Plus, I don't have to worry about boot records and such for /home. Then I thought, with good backup mentality, why not also backup / using tar for redundancy, just in case you have problems with dd. If I had another drive I would also dd over /home as well.

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...

Cool, I love seeing how you can use dd over a network. In a perfect world I would have two identical scsi drives as the backup drives. So in time of need it would be quick and easy to restore. But two 36GB scsi drives are 5 times the cost of a 120GB ide drive. Not to mention finding a mobile scsi rack.

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

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.

I really appreciate this list and your expertise Les. Thank you. I have learned so much since I started K12LTSP at my school last May.


Robert Arkiletian C++ GUI tutorial http://fltk.org/links.php?V219

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