Date: Fri, 6 Sep 2002 16:57:46 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: adrian kok <adriankok2000@yahoo.com.hk> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: ghost function? Message-ID: <20020906155746.GA40180@happy-idiot-talk.infracaninophi> In-Reply-To: <20020906135434.79381.qmail@web21210.mail.yahoo.com> References: <20020906135434.79381.qmail@web21210.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 06, 2002 at 09:54:34PM +0800, adrian kok wrote:
> Does freebsd provide function from disk to disk same as ghost
> software to image window from disk to disk
Yes, there are quite a few programs that can be used to copy the
contents of a whole partition onto another one. In the end, they boil
down to three approaches:
i) dd -- copying at the device level.
ii) tar or cpio or dump and restore --- backup and restore software
iii) rsync --- synchronising filesystem contents
"Great", I hear you say, "but which one should I use?" That's a good
question, and the answer depends on exactly what you want to achieve.
Each has various strong and weak points:
dd) Good: can copy an entire disk image, including boot blocks and
disklabels that are normally outside the scope of the
filesystem. Can copy foreign filesystems.
Bad: the target disk has to be at least as large as the source.
If the target is bigger than the source, then the excess space
will be inaccessible. Can do an incremental update: has to copy
the whole disk image each time. Copies *every single byte* from
the source disk, including all the empty space not yet used for
files. The target cannot be device corresponding to a mounted
filesystem.
eg: dd if=/dev/da0s1c of=/dev/da1s1c bs=64k
dump/restore, etc.) Essentially any software that can write backups
to tape can be persuaded to feed it's output into the input of
the matching programs to restore files from tape. Generally
these programs will copy a filesystem or partition, rather than
a whole disk.
Good: offers a lot of flexibility about missing out
uninteresting files, copying only what has changed since the
last time a copy was done. Only copies the files and metadata,
ignores the empty space.
Bad: not all file types can be copied by all programs (device
files, fifos, unix domain sockets etc. tend to cause problems.)
Most are aimed at writing backups to tape and not for this sort
of copying job, so the man pages may be a bit opaque.
eg: dump -0auf - /usr | (cd /copy/usr ; restore -rf - )
cd /usr ; tar -clvf - . | (cd /copy/usr ; tar -xvpf - )
find /usr -depth -print0 | cpio -p0dmu /copy
rsync) Good: designed to synchronise whole directory trees over
networks, works just as well copying from disk to disk within a
machine. Efficient: when updating a previous copy of a
filesystem, only copies over the parts that have changed.
Bad: Needs to be installed via ports/packages
eg: rsync -avx --delete /usr/ /copy/usr/
There's more to it than that, but this message is long enough already.
Suffice it to say, read the man pages for those commands and make sure
you understand how they work and what other things you have to do in
order to succeed at this task. This topic comes up regularly on this
list: if you search the archives you'll find any number of more
detailed examples.
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
Savill Way
Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020906155746.GA40180>
