From owner-freebsd-questions@FreeBSD.ORG Wed Sep 30 02:22:59 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 842511065676 for ; Wed, 30 Sep 2009 02:22:59 +0000 (UTC) (envelope-from af.gourmet@videotron.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.freebsd.org (Postfix) with ESMTP id 554A78FC08 for ; Wed, 30 Sep 2009 02:22:59 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=UTF-8 Received: from [192.168.0.51] ([96.21.103.185]) by VL-MO-MR005.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-4.01 (built Aug 3 2007; 32bit)) with ESMTP id <0KQR00MKSIM99DD0@VL-MO-MR005.ip.videotron.ca> for freebsd-questions@freebsd.org; Tue, 29 Sep 2009 22:22:58 -0400 (EDT) Message-id: <4AC2C104.7090206@videotron.ca> Date: Tue, 29 Sep 2009 22:23:00 -0400 From: PJ User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) To: Polytropon References: <4AC29BE6.4000505@videotron.ca> <20090930023051.cff2b0b4.freebsd@edvax.de> In-reply-to: <20090930023051.cff2b0b4.freebsd@edvax.de> Cc: 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 02:22:59 -0000 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 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. > > >