Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Jun 2012 14:44:15 -0700
From:      "Ronald F. Guilmette" <rfg@tristatelogic.com>
To:        freebsd-questions@freebsd.org
Subject:   Making a bootable backup (hard)disk... how?
Message-ID:  <2903.1339191855@tristatelogic.com>

next in thread | raw e-mail | index | archive | help

I've been lucky.  Over about the past 20 years I've never had a hard
disk go bad on me.  (Knock on wood.)  Of course I _do_ only buy the
better quality ones (with the 5 year warranties), and I'm sure that
has helped.  Still, one never knows, and it is best to be prepared.
Primarily however, I am mostly afraid of the fumble-finger scenario...
you know... cd /; rm -fr *

I read a little bit about UFS filesystem snashots, and they could probably
help me deal effectively with fumble-finger incidents, but I still think
that I would prefer to have a whole separate physical disk as my backup.
(I mean what the hell?  They are so cheap these days anyway.)

I got a lot of disks here, so that part is not a problem.  I just
need to make sure that I'm gonna do this the Right Way[tm].  (I've already
been making my own ham-fisted disk-to-disk backups in the past, but I'm
sure that the way I have been doing that is sub-optimal, so I'm here
seeking knowledge of how to do this the Right Way.)

The bottom line is this... I know how to use cpio, and would like to use
it to create a complete and _bootable_ backup of my main system disk.
(My main system disk has only one BIOS partition, and that is sub-divided
into the usual set of FreeBSD partitions, you know, /, /dev, /tmp, /usr,
/var, /usr/compat/linux/proc, and /var/named/dev.)

I'm not a complete dummy, so I can can easily figure out how to use cpio
to make copies of all of the things in these filesystems to another
physical drive, however, there are a couple of issues that I really don't
know how to deal with properly, to wit:

1)  How can one induce cpio to copy over the extra magical FreeBSD-specific
file flags, such as the "immutable" flag, and so forth?  (Naturally, I _do_
want to preserve all of these in my backup.)

2) Of necessity, the drive/partition designators of my backup disk and my
``real'' original system disk will be different.  The original is a SATA
drive, designator(s) /dev/ad4s1{a,e,f,d}, but due to the limitations of what
I have on hand, my backup drive will be an older PATA drive, designator(s)
/dev/ad2s1{a,e,f,d}.  Obviously, cpio doesn't give a darn about such things,
and so making my backup will not be a problem at all.  The problem will,
I suspect, arise when and if I actually have to try to use my backup disk to
recover from a system failure.  Then, the identity of the drive that will
actually hold the root partition will be new and different from whatever it
is set to currently on my ``real''/original drive... which will probably
cause the disk not to boot... and also, of course, a lot of the entries in
/etc/fstab will be wrong for the backup drive and will have to be diddled
at some time... either at the time I make my backup, or later, when I go
to actually _use_ the backup disk.  I need to know he Right Way to deal
with these (drive designator) problems also.

I guess that I can figure out for myself how to diddle the /etc/fstab file
on the backup drive in an appropriate way (and I can probably even cook up
a trivial script to do this diddling for me routinely, each time I make a
new disk-to-disk backup).  So I guess the only think that is still making
me nervous is my dim recollection... leftover from FreBSD releases of long
long ago, e.g. the 6.x series... that there was also something hard-coded
somewhere that told the kernel the identity of the root partition.  If that
hard coded thing still exists somewhere (i.e. in 8.3) then I'll need to
make it a point, when making my bootbale backup disk, to find and diddle that
thing too, in addition to diddling the /etc/fstab entries.

So my question is simple:  Do I need to diddle anything other than /etc/fstab
in order to allow for the fact that all of the drive designators will be
different for my backup disk, as compared to my original disk?  And if so,
where is/are the additional things that will need to be manually diddled?

Any help/advice/insight regarding the above topics will be much appreciated.


Regards,
rfg


P.S.  Maybe I just overlooked it, but I really didn't see any option listed
on the man page for cpio(1)... aka bsdcpio(1)... that would permit copying/
preservation of the various file flags discussed in the man pages for
chflags(1) and chflags(2).  Is it just me, or can cpio really not copy
these?  If so, it seems like one helluva big oversight.  (Even if there
is as issue where these additional file flags cannot be preserved, i.e.
in cpio archive files, you know, because of backward archive format com-
patability issues, at the very least there could be / should be a way to
get cpio to copy these things over when the -p (pass) option is being used...
no?

Hummm... come to think of it, I'm also not seeing any way to induce cpio
to copy over things like per-file ACLs and/or per-file file attributes
either.

Is it just me, or does _everyone_ who uses cpio for backups loose all of
this good stuff when making backups?

Color me preplexed.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2903.1339191855>