From owner-freebsd-questions@FreeBSD.ORG Wed Sep 30 08:40:52 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AF461065696 for ; Wed, 30 Sep 2009 08:40:52 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 168628FC32 for ; Wed, 30 Sep 2009 08:40:51 +0000 (UTC) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id C6F72EB575D; Wed, 30 Sep 2009 11:40:50 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id BC96745148; Wed, 30 Sep 2009 11:40:50 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9VA8DfmC1f+o; Wed, 30 Sep 2009 11:40:50 +0300 (EEST) Received: from kobe.laptop (adsl12-49.kln.forthnet.gr [77.49.139.49]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 5A02B4512A; Wed, 30 Sep 2009 11:40:50 +0300 (EEST) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n8U8emfG006526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 30 Sep 2009 11:40:49 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n8U8el79006525; Wed, 30 Sep 2009 11:40:47 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: PJ References: <4AC29BE6.4000505@videotron.ca> <20090930023051.cff2b0b4.freebsd@edvax.de> <4AC2C104.7090206@videotron.ca> Date: Wed, 30 Sep 2009 11:40:46 +0300 In-Reply-To: <4AC2C104.7090206@videotron.ca> (PJ's message of "Tue, 29 Sep 2009 22:23:00 -0400") Message-ID: <871vlo965t.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Polytropon , freebsd-questions@freebsd.org Subject: Re: backups & cloning X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2009 08:40:52 -0000 On Tue, 29 Sep 2009 22:23:00 -0400, PJ wrote: > Polytropon wrote: >> Assuming nobody uses tape drives anymore, you need to specify >> another file, which is the standard output in this case, which >> may not be obvious, but it is if we reorder the command line: >> >> # dump -0 -L - a -u -f - /dev/ad1s1a | restore -r -f - > 1. will the s1a slice dump the entire system, that is, the a, d, e, f > and g slices or is it partitions? No, dump will backup a single partition (or filesystem) specified by the options you pass, i.e.: * Dump only the ad0s1a partition to standard output: dump -0 -L -a -u -f - /dev/ad0s1a * Dump only the ad0s1d partition to standard output: dump -0 -L -a -u -f - /dev/ad0s1d You will have to run multiple `dump' instances to backup more than one partition. For example, a short script that I run daily to save dumps at level 2 for all my laptop's UFS filesystems includes code that is equivalent to the following set of commands: TODAY=$( date -u '+%Y-%m-%d' ) dump -2 -L -a -u -f - /dev/ad0s1a > kobe.2.${TODAY}.ad0s1a dump -2 -L -a -u -f - /dev/ad0s1d > kobe.2.${TODAY}.ad0s1d dump -2 -L -a -u -f - /dev/ad0s1e > kobe.2.${TODAY}.ad0s1e dump -2 -L -a -u -f - /dev/ad0s3d > kobe.2.${TODAY}.ad0s3d Each partition is dumped to a separate output file, so I can restore them separately. >>> I am trying to dump the whole system (all the slices)except swap >>> to a usb (sata2 500gb disk) and then restore to another computer with >>> 7.2 minimal installation. >> >> I think that's not possible because dump operates on file system >> level, which means on partitions, not on slices. > > I've been very confused with the slices/partitions. I meant above, to > dump the whole slice - but I guess that it has to be done with the > partitions. You cannot dump a full slice (what other operating systems call a "BIOS partition") in a single dump run. Use multiple dump commands like the ones shown above. >>> Slices ad2s1d,e,f and g dump ok to usb. a does not - errors ("should use >>> -L when dumping live filesystems) > > and when I do dump -0Laf /dev /ad1s1a /dev/da0s1a > the errors are > "write error 10 blocks into volume 1 > do you want to restart:" This is not a correct invocation of dump. You can't pass multiple partitions in one instance of dump, like /dev, /ad1s1a and /dev/da0s1a. If the order of dump options confuses you, reorder them the same way Polytropon did, so that the `-f OUTPUT' option stands out a bit more: dump -0 -a -L -f - /ad1s1a A break-down of these options is now easier to understand: * This will save a level 0 dump (the -0 option) of partition /ad1s1a. * The dump will not be split into multiple tape `archives' (the -a option). * Before trying to save the current state of the input partition, dump will create a `snapshot' so that a consistent state of all files in the partition will be saved in the dumped archive (the -L option). * The backup archive will be sent to standard output (the '-' argument of the -f option). The special '-' value for the output file of the -f option may be a bit confusing, but it is useful if you are going to immediately pipe dump's output to the restore(8) program. Otherwise, if you are just going to save the dump archive to another disk, you could have used: dump -0 -a -L -f dumpfile /ad1s1a The dump utility would then save a dump archive to `dumpfile' instead of writing everything to its standard output. >> To illustrate a dump and restore process that involves several >> partitions, just let me add this example: >> >> Stage 1: Initialize slice and partitions >> # fdisk -I -B ad1 >> # bsdlabel -w -B ad1s1 >> # bsdlabel -e ad1s1 >> a: 512M * 4.2BSD 0 0 0 >> b: 1024M * swap >> c: * * unused <--- don't change >> e: 2G * 4.2BSD 0 0 0 >> f: 2G * 4.2BSD 0 0 0 >> g: 10G * 4.2BSD 0 0 0 >> h: * * 4.2BSD 0 0 0 >> ^KX (means: save & exit) >> # newfs /dev/ad1s1a >> # newfs -U /dev/ad1s1e >> # newfs -U /dev/ad1s1f >> # newfs -U /dev/ad1s1g >> # newfs -U /dev/ad1s1h >> >> Stage 2: Go into SUM and prepare the source partitions > > why into SUM? I'm really the only user and I usually stay as root???? > if SUM, shouldn't the # below be $? Because when you are running in multi-user mode there may be services and other background processes changing the files of the source partitions while you are dumping them. By going into single-user mode, you ensure that there is only one active process in your system: the root shell you are using to back & restore the files.