Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Aug 2001 18:55:04 -0400
From:      Mike Tancsa <mike@sentex.net>
To:        freebsd-doc@freebsd.org
Subject:   FAQ Entry ?
Message-ID:  <5.1.0.14.0.20010815184927.064cdec8@192.168.0.12>

next in thread | raw e-mail | index | archive | help
Hi,
This question seems to come up from time to time. "How do I clone my 
FreeBSD boot disk"  Most all of its in disklabel, but perhaps an FAQ 
example like

This assumes that ad0 is your boot hard drive that you want to clone and 
that ad1 is the destination drive you want to copy to.

Note, this does _not_ check for any errors



#!/bin/sh
#
#this example assumes that you want to dupe ad0 to ad1
#
#it does ZERO error checking but gives you an idea how to dupe your system disk
#
#blow away all data one ad1
/bin/dd if=/dev/zero of=/dev/ad1 bs=512 count=32
# do the fdisk
/sbin/fdisk -BI ad1
#create a bootable drive with disk label
/sbin/disklabel -w -r -B ad1s1 auto
#If you are mass producing this, use a pre-made file with the disk lable info
#/sbin/disklabel -R ad1s1 /root/10g-disk
#Or do it by hand the first time
/sbin/disklabel -e ad1s1
#newfs the slices
/sbin/newfs /dev/rad1s1a
/sbin/newfs /dev/rad1s1e
/sbin/newfs /dev/rad1s1f
#enable soft updates
/sbin/tunefs -n enable ad1s1e
/sbin/tunefs -n enable ad1s1f
#mount them up
/sbin/mount -o async /dev/ad1s1a /mnt-root
/sbin/mount /dev/ad1s1e /mnt-var
/sbin/mount /dev/ad1s1f /mnt-usr
#dump / restore them
cd / ; dump -0 -b 600 -f - / | ( cd /mnt-root ; restore -rf - )
cd /usr ; dump -0 -b 600 -f - /usr | ( cd /mnt-usr ; restore -rf - )
cd /var ; dump -0 -b 600 -f - /var | ( cd /mnt-var ; restore -rf - )



The file 10g-disk looks like

# /dev/ad1s1:
type: unknown
disk: amnesiac
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 19856
sectors/unit: 20015793
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0

8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
   a:   819200        0    4.2BSD        0     0     0   # (Cyl.    0 - 812*)
   b:  2097152   819200      swap                        # (Cyl.  812*- 2893*)
   c: 20015793        0    unused        0     0         # (Cyl.    0 - 19856*)
   e:  4194304  2916352    4.2BSD        0     0     0   # (Cyl. 2893*- 7054*)
   f: 12582912  7110656    4.2BSD        0     0     0   # (Cyl. 7054*- 19537*)

         ---Mike

--------------------------------------------------------------------
Mike Tancsa,                                      tel +1 519 651 3400
Network Administration,                           mike@sentex.net
Sentex Communications                             www.sentex.net
Cambridge, Ontario Canada                         www.sentex.net/mike


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.0.14.0.20010815184927.064cdec8>