Re: How recursive copy to clone OS installation (devices, links, owners, privileges etc.)?

2018-03-15 Thread michael

Did this cloning thing many times before. You will save much time and other 
resources if you simply do a fresh install and copy the needed datafiles with a 
tar.

  


‎Von: Tinker
Gesendet: Donnerstag, 15. März 2018 02:10
An: misc@openbsd.org
Antwort an: Tinker
Betreff: How recursive copy to clone OS installation (devices, links, owners, 
privileges etc.)?

Say you have an OpenBSD installation (with /dev and all) mounted on
/mnt , and you'd like to clone it to /mnt2 , which is a partition
of different size, so dd is not an option.

For simplicity of the example both the source and destination OS
installations are on single ffs partitions, e.g. /mnt hosts /dev/sd1a
which is sd1's only partition, and /mnt2 hosts /dev/sd2a which is sd2's
only partition.

Can you make cp or some other recursive copying tool properly replicate
device files, links, file privileges and attributes, user and group
ownership, and maybe even creation and modification times, so the
copying together will make /mnt2 a complete and bootable replica of
/mnt ?

(Of course /mnt2 also needs proper treatment with fdisk, disklabel,
newfs, installboot.)

At the end of the day is copying a good idea at all or are there
notorious failure points in the process such that OS reinstall or disk
image cloning are prefered?

Thanks,
Tinker



Re: How recursive copy to clone OS installation (devices, links, owners, privileges etc.)?

2018-03-14 Thread Nick Holland
On 03/14/18 21:08, Tinker wrote:
> Say you have an OpenBSD installation (with /dev and all) mounted on
> /mnt , and you'd like to clone it to /mnt2 , which is a partition
> of different size, so dd is not an option.

Not necessarily true.
If the source is smaller than the destination, you can still image it
with "dd", rsdXc partition to rsdXc partition.  You can then use
"growfs" to expand the last partition -- if you planned it right, your
last partition is the one that needs the most space.

You can also dd over individual partitions.  Create a new 'a' partition,
copy over the 'a' partition (/dev/rsdXa) first, now make a /new/ disk
label (that's stored in the 'a' partition, so copying over 'a' blew your
old one away -- order here is kinda important), make all the new
partitions the size you want them to be, then dd them over from the
source to the dest, then growfs each of them to fluff them out to the
size you got.

Not saying it's the best way to do things, but it's educational. :)

Nick.



Re: How recursive copy to clone OS installation (devices, links, owners, privileges etc.)?

2018-03-14 Thread Philip Guenther
On Wed, Mar 14, 2018 at 6:08 PM, Tinker  wrote:

> Say you have an OpenBSD installation (with /dev and all) mounted on
> /mnt , and you'd like to clone it to /mnt2 , which is a partition
> of different size, so dd is not an option.
>
> For simplicity of the example both the source and destination OS
> installations are on single ffs partitions, e.g. /mnt hosts /dev/sd1a
> which is sd1's only partition, and /mnt2 hosts /dev/sd2a which is sd2's
> only partition.
>
> Can you make cp or some other recursive copying tool properly replicate
> device files, links, file privileges and attributes, user and group
> ownership, and maybe even creation and modification times, so the
> copying together will make /mnt2 a complete and bootable replica of
> /mnt ?
>

Ignoring the "bootable" qualifier which is more about disklabel and
installboot:

cd /mnt && pax -rwpe . /mnt2


Philip Guenther

(Replies that are mangled by protonmail will be ignored.)


How recursive copy to clone OS installation (devices, links, owners, privileges etc.)?

2018-03-14 Thread Tinker
Say you have an OpenBSD installation (with /dev and all) mounted on
/mnt , and you'd like to clone it to /mnt2 , which is a partition
of different size, so dd is not an option.

For simplicity of the example both the source and destination OS
installations are on single ffs partitions, e.g. /mnt hosts /dev/sd1a
which is sd1's only partition, and /mnt2 hosts /dev/sd2a which is sd2's
only partition.

Can you make cp or some other recursive copying tool properly replicate
device files, links, file privileges and attributes, user and group
ownership, and maybe even creation and modification times, so the
copying together will make /mnt2 a complete and bootable replica of
/mnt ?

(Of course /mnt2 also needs proper treatment with fdisk, disklabel,
newfs, installboot.)

At the end of the day is copying a good idea at all or are there
notorious failure points in the process such that OS reinstall or disk
image cloning are prefered?

Thanks,
Tinker