[K12OSN] restore backup with chroot + grub-install

Robert Arkiletian robark at telus.net
Tue Dec 14 04:10:14 UTC 2004

Les Mikesell wrote:

>On Sat, 2004-12-11 at 22:12, Robert Arkiletian wrote:
>>dd if=/dev/sda1 of=/dev/hdb1
>If you don't take the whole disk image to preserve the boot,
>partition, and label info, you might as well use a file
>based copy technique.  'cp -a' will work, or if you are
>doing it repeatedly to stay up to date you can do:
> rysnc --delete --one-file-system -avH source_dir dest_dir
>where the source/dest are the mount points of the partitions.

I agree the file based copy is more versatile but would it not be 
possible to just copy the partition, as above, and then copy the first 
446 bytes of the MBR to the backup drive MBR.

So during restore you could fdisk the new drive EXACTLY like the source 
then dd over the / partition and also the first 446 bytes of the backup 
drive. I haven't tried it but it sounds logical to me. So fdisk would 
write bytes 446-512. You would also have to mkswap, as you mentioned 
earlier, on any swap partitions.
Also, any difference between tar and cp -a? I looked at man cp and it says

 -a, --archive
              Preserve as much as possible of the  structure  and
              attributes  of  the original files in the copy (but
              do not preserve directory  structure).   Equivalent
              to -dpPR.

Apart from the fact that tar can compress. I'm guessing tar is better at 
rebuilding the "structure" of the filesystem. Whatever that means.

As for rsync. I don't think I will use it. I know it's faster but since 
I have a huge backup drive I don't mind taking snapshots with tar. That 
way if I do a backup without noticing that the drive has begun to die, I 
can always restore a previous (known good) backup.


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

More information about the K12OSN mailing list