View Single Post
Old 7th May 2012
neant neant is offline
New User
Join Date: Apr 2012
Posts: 4

I hope there's no problem necroing this thread since it's a sticky.

For the record, cloning an entire disk through the c partition can be done, using dd(1), HOWEVER, this can be dangerous. There's this post from 2001* by Randy Lewis, it basically says:

                                       +----------- bytes/sector value
                                      /    +------- sectors/cylinder value
                                     /    /
% dd if=/dev/rsd0c of=/dev/rsd1c bs=512x4520 count=7931 <cr>
                 total cyliders to copy value -----+

First, the obvious, dd is dumb, it shouldn't be run on a mounted/live disk. Incomplete files, inconsistent fs and partitions marked unclean since they were never unmounted are to be expected. Which means the clone will have to be fscked before use.
Second, OpenBSD 5.0+ (AFAIK) uses disk UIDs, fstab by default doesn't have /dev/sd0 in it, it has the ID of the disk instead. The clone, since it's an exact copy, will end up having the same DUID as the original, not good if the clone isn't pulled out of the system right away. The ID can be changed using disklabel(8)'s "i" command in the editor.

On the other hand, assuming two identical disks, reboot the system from a live cd (single-user works too I guess), run dd, pull out the clone and keep it in storage, and you've got a full system backup ready to go in as long as it takes to change a disk.
Didn't actually try this last part yet, but there's no reason it shouldn't work, right?

* Can't post links. The post can be found at /?l=openbsd-tech&m=100765187914137&w=2, or just search for "Re: Cloning OpenBSD disks (amended / expanded explanation)" on google.
Reply With Quote