Data transfer from one HD to another

Chris Whitehouse chris at
Wed Mar 29 22:23:07 UTC 2006

Posted this to OP but omitted to post to the list. Here's my 2p worth


> Matt Smith wrote:
>> Hi,
>>     Is there an EASY method to transfer the partitions from an old hard disk
>> to a new one?
>>                                        Matt Smith 
>> _______________________________________________
>> freebsd-stable at mailing list
>> To unsubscribe, send any mail to "freebsd-stable-unsubscribe at"
> I regularly do this cloning desktops. I am usually using the same size / 
> /var /tmp and swap and whatever is remaining as /usr
> Install new disk as primary master.
> Boot from CD and install minimal system (you can even abort once it has 
> created the file system, the only purpose of this step is to create the 
> slices and newfs. I think this is quicker than doing it with sysinstall 
> or fdisk/bsdlabel. When it's me doing it it is certainly more error free.)
> Next install your source disk as primary master and new disk as anything 
> else. (ad1 in example below)
> Boot to single user.
> Now do:
> mount -u /
> mount /dev/ad1s1a /mnt
> cd /mnt
> rm -rf /mnt/* /mnt/.*
> dump 0afL - / | restore xf -
> cd
> umount /mnt
> fsck -y /dev/ad1s1a
> Do the same sequence of steps for /tmp, mounting /tmp read/write and 
> using L switch in dump. You don't need to do the mount -u / again.
> [Can anybody tell me if it is really necessary to clone /tmp? Not that 
> it takes much time.]
> Do the same sequence of steps for /var and /usr but mounting them ro and 
> not using the L switch in dump
> My /usr takes some time like 1 - 2 hours, the rest you can do as you sit at 
> the machine. Sometimes the rm fails to remove a directory called empty - 
> you have to chflags it.
> I've done this quite a few times and had no problems. I've tried various 
> variations and this one is the only one that didn't come to some sort of 
> sticky end for me. Cleverer people would probably have found a way through.
> I did try putting my commands in a script but the result was b0rked 
> somehow and I never found time to investigate why.
> Chris

More information about the freebsd-stable mailing list