On 04/22/18 14:46, Tuyosi T wrote:
> hi all .
> i manage to clone bigger HDD(sd1) to smaller HDD(sd0)
> 
> this is dangerous , so please test .
> and there may be some errors , then please point them out .

Ok, how do I put this nicely...

PLEASE DON'T DO THIS KIND OF "documentation".  Ok, you accomplished your
task.  Congrats, I'm proud of you.  But your initial config was bad,
your final config was bad, and your process was trivial and very
specific to your config.  Your "documentation" doesn't explain the WHY
of what you do, or the VERY special (and wrong) case of your config that
allowed this to work.  It's not a teaching document.

While I'm a big defender of free speech, this is not helpful in the way
you probably intended.  If your goal is training people to think before
they follow stuff they find on the 'net, great, ok, I guess -- nothing
teaches like a bullet in the foot.  But I don't think that was your goal.

Your initial system and final system were One Big Partition layouts --
Bad idea.  And you copied over just the 'a' partition.  Useless for the
recommended OpenBSD config.  And tar has trouble with really long paths.

And really, your task is simple --
* Boot the system with the new disk attached.
* Stop all processes you can that are changing important data on the
disk.  Can also be done by booting from bsd.rd.
* If you booted from bsd.rd, you will probably need to /dev/MAKEDEV
[sw]d1, as bsd.rd has only one sd and wd device.
* fdisk (if needed) and disklabel your new disk.  For simplicity, I'll
assume same disklabel setup on the new disk and old.
* newfs all the new partitions
* for each FS,
   * Mount the new one somewhere
   * dump | restore each existing partition to the new partition.
   * umount the new partition.
* Set up the boot code on the new disk.

Interestingly, that's basically the process for any Unix-Like OS (ULOS).
 The last step (set up the boot code) will vary tremendously from ULOS
to ULOS, and SELinux will require some voodoo that few understand to
make things work after moving them in the name of security.

Nick.

Reply via email to