Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Sep 2009 11:40:46 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        PJ <af.gourmet@videotron.ca>
Cc:        Polytropon <freebsd@edvax.de>, freebsd-questions@freebsd.org
Subject:   Re: backups & cloning
Message-ID:  <871vlo965t.fsf@kobe.laptop>
In-Reply-To: <4AC2C104.7090206@videotron.ca> (PJ's message of "Tue, 29 Sep 2009 22:23:00 -0400")
References:  <4AC29BE6.4000505@videotron.ca> <20090930023051.cff2b0b4.freebsd@edvax.de> <4AC2C104.7090206@videotron.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 29 Sep 2009 22:23:00 -0400, PJ <af.gourmet@videotron.ca> 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.




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