Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Sep 2009 22:23:00 -0400
From:      PJ <af.gourmet@videotron.ca>
To:        Polytropon <freebsd@edvax.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: backups & cloning
Message-ID:  <4AC2C104.7090206@videotron.ca>
In-Reply-To: <20090930023051.cff2b0b4.freebsd@edvax.de>
References:  <4AC29BE6.4000505@videotron.ca> <20090930023051.cff2b0b4.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
You are a Master among masters... extraordianry understanding of the
genre and ver, very clear explanations...
I guess my filter between the brain and the computer is a bit foggy... :-(
I really appreciate your explanations.
But I still have a couple of small questions below...


Polytropon wrote:
> On Tue, 29 Sep 2009 19:44:38 -0400, PJ <af.gourmet@videotron.ca> wrote:
>> This may be clear to someone; it certainly is not to me.
>> As I understand it, newfs will (re)format the slice.
>
> No. The newfs program does create a new file system. In
> other terminology, this can be called a formatting process.
> Note that NOT a slice, but a PARTITION is subject to this
> process. So
>
> # newfs -U /dev/ad2s1a
>
> does format the first partition (a) of the first slice (s1)
> of the third disk (ad2).
>
>
>
>> Ok, But what is standard out in the above example. The dump is from
>> where to where?
>
> According to the command
>
> # dump -0Lauf - /dev/ad1s1a | restore -rf -
>
> you need to understand that the main purpose of dump is to
> dump unmounted (!) file systems to the system's tape drive.
> 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 -
>
> You can see that -f - specifies - to be the file to backup to.
> The backup comes from /dev/ad1s1a.
>
> The restore program, on the other side of the | pipe, does
> usually read from the system's tape drive. But in this case,
> it reads from standard input as the -f - command line option
> indicates. It restores the data to where the working directory
> at the moment is.
>
> Here's an example (ad1 is source disk, ad2 is target disk):
>
> # newfs -U /dev/ad2s1a
> # mount /dev/ad2s1a /mnt
> # cd /mnt
> # dump -0Lauf - /dev/ad1s1a | restore -rf -
>
>> Could someone clarify all this for me?
>
> Hopefully hereby done. :-)
I feel a bit stupid, as usual, my carelessness led me to miss the
difference between ad1 and ad2... dumb, dumb, dumb.
Ok, so I see that this works if you have two different drives on the
same machine...
But... 2 questions:
1. will the s1a slice dump the entire system, that is, the a, d, e, f
and g slices or is it partitions?
>
>> So far, I have been unable to dump the / slice, not even with the -L
>> option.
>
> Always keep in mind: Use dump only on unmounted partitions.
>
>> 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.
>> 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:"
The first time I tried with -L the error was 20 blocks...
Both the slices for dump from and to are same size (2gb) and certainly
not full by a long shot ( if I reccall correctly, only about 14% is used)

>
> Keep an eye on terminology, you're swapping them here: The
> devices ad2s1[defg] are partitions, not slices. The corresponding
> slice that holds them is ad2s1.
Sorry; now it's getting clearer.
>
> Anyway, if you can, don't dump mounted file systems. Go into
> single user mode, mount / as ro, and run dump + restore. If you
> can, use a live system from CD, DVD or USB, which makes things
> easier.
>
>> Do you have to newfs each slice before restoring?
>
> Partitions. You don't have to newfs them once they are formatted.
> It's just the usual way to ensure they are free of any data.
>
>> But if you are
>> restoring on a running 7.2 system, don't you have to restore to another
>> disk than the one the system is on?
>
> I don't understand this question right... if you're using a running
> system for dump + restore - which is the system you want to be the
> source system, then do it in minimal condition. SUM is the most
> convenient way to do that, with all partitions unmounted, and
> only / in read-only mode so you can access the dump and restore
> binaries.
>
>> I am beginning to think that you have to have a system running and dumpt
>> to another disk on that system and then remove that disk and install in
>> another box and boot from that?
>> Am I getting close?
>
> Again, I'm not sure I understood you correctly. If you've done
> the dump + restore correctly, you always end up with a bootable
> system, so you can boot it in another box. Dumping and restoring
> just requires a running system, no matter if it is the source
> system itself or a live system from CD, DVD or USB. (I prefer
> tools like FreeSBIE for such tasks, but the FreeBSD live system
> CD is fine, too.)
>
> As far as I now understood, you don't want to clone from source
> disk to target disk, but use a USB "transfer disk"; in this case,
> you first need to clone onto this disk, and then use it in the
> other computers to fill their disks with the copy you made from
> your "master system".
>
> As a sidenote, it's worth mentioning that this can be achieved
> in an easier way: You create a minimal bootable FreeBSD on this
> USB disk, in case your computers can boot from it; if not, use
> a live system to boot the computers. Then, format the USB disk
> with only one file system (e. g. /dev/da0) and put dump files
> onto it, so they are available then as /mnt/root.dump, tmp.dump,
> var.dump, usr.dump and home.dump. Instead of using -f - for the
> dump and restore program, use those file names.
>
>> I know it's a lot to ask, but then, I know you guys are capable... :-)
>
> If you still have questions, try to ask them as precise as
> possible.
>
> I may add that this list is the most friendly and intelligent
> community to ask, so you're definitely at the right place here.
>
>
> 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 $?
So, ad1 is the target disk and ad0 is the source?
I don't follow the next sequence...
after shutdown, boot in SUM?
the following commands ($ instead of # ?) would be on the source (ad0 ?)
What is happening with the umount commands below?
And the mount -r / ?
The fsck is to clean the partitions, right?
> # shutdown now
> # umount /home
> # umount /usr
> # umount /var
> # umount /tmp
> # mount -r /
> # fsck / /tmp /var /usr /home
>
> Stage 3: Start dumping and restoring the partitions
> # mount /dev/ad1s1a /mnt
> # cd /mnt
> # dump -0 -f - /dev/ad0s1a | restore -r -f -
> At this point, /mnt will have the content of / and
> therefore the mountpoints for the other partitions,
> the former /tmp, /var, /usr and /home, will be
> available.
> # mount /dev/ad1s1e /mnt/tmp
> # cd /mnt/tmp
> # dump -0 -f - /dev/ad0s1e | restore -r -f -
> # mount /dev/ad1s1f /mnt/var
> # cd /mnt/var
> # dump -0 -f - /dev/ad0s1f | restore -r -f -
> # mount /dev/ad1s1g /mnt/usr
> # cd /mnt/usr
> # dump -0 -f - /dev/ad0s1g | restore -r -f -
> # mount /dev/ad1s1h /mnt/home
> # cd /mnt/home
> # dump -0 -f - /dev/ad0s1h | restore -r -f -
>
> Stage 4: Umount disks and shut down the system
> # cd /
> # umount /mnt/home
> # umount /mnt/usr
> # umount /mnt/var
> # umount /mnt/tmp
> # umount /mnt
> # sync
> # shutdown -p now
>
> Now you can take out the disk and use it in another computer.
>
>
>




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