Cloning multiple partitions



Messages: 39

Good morning all,

I am trying to clone a disk. An interesting particular here is that I have four actual partitions, not slices, on my master drive that make up my FBSD install, so it looks something like this:
ad0s1a = /
ad0s2d = /usr
ad0s3d = /var
ad0s4d = /tmp

I did this for the main reason that that was the only way I was going to be able to use this hardware reliably. Drive I am trying to clone to has similar partitioning scheme just different sizes to those partitions.

I am going to need to clone this about 4 times, and a few of these times I need to make some of the partitions different sizes, due to what will be the exact use of that machine. With that in mind I know dd will not work, it needs things to really be equal, and I have already tried.

So next would be using dump and restore? Documentation that I find talks about having single partitions.

Should something like this work?

# newfs /dev/ad1s1a
# mount /dev/ad1s1a /mnt
# newfs /dev/ad1s2d
# mount /dev/ad1s2d /mnt/usr
# newfs /dev/ad1s3d
# mount /dev/ad1s3d /mnt/var
# newfs /dev/ad1s4d
# mount /dev/ad1s4d /mnt/tmp
# cd /mnt
# dump 0af - / | restore xf -

Or am I now possibly barking up a wrong tree?

Thanx for the insight.


Well-Known Member

Thanks: 80
Messages: 379

You forgot mkdir /mnt/usr /mnt/var /mnt/tmp.
You may want to call dump as:
dump -C 24 -0aLf -

Cachesize 24M (speeds up dump)
L for live filesystems

I personally use restore rf but if you don't have incrementals to restore afterwards, it's identical to xf.



Messages: 39

Things appear to be going smoothly at the moment... Full reply shortly.

When the prompt comes up :
set owner/mode for'.'? [yn]
what should the appropriate answer be?




Messages: 39

To post a final follow up to this:

If someone else is doing this, a couple of things to make note:
On my system, the dump and restore would skip over the var usr and tmp directories as it states they exist. So I had to:
cd /mnt/usr then
dump -C 24 -0aLf /usr - | restore xf -
and answer no about the owner/mode
then do that for the other diretories.

And yeah, in my original post I omitted the creation of the dirs.


and thanx again