From owner-freebsd-questions@FreeBSD.ORG Wed Sep 30 00:30:54 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 DC4B61065679 for ; Wed, 30 Sep 2009 00:30:54 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id 6D44C8FC18 for ; Wed, 30 Sep 2009 00:30:54 +0000 (UTC) Received: from r55.edvax.de (port-92-195-71-245.dynamic.qsc.de [92.195.71.245]) by mx01.qsc.de (Postfix) with ESMTP id 024E63D662; Wed, 30 Sep 2009 02:30:52 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id n8U0UqKZ001485; Wed, 30 Sep 2009 02:30:52 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Wed, 30 Sep 2009 02:30:51 +0200 From: Polytropon To: PJ Message-Id: <20090930023051.cff2b0b4.freebsd@edvax.de> In-Reply-To: <4AC29BE6.4000505@videotron.ca> References: <4AC29BE6.4000505@videotron.ca> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: backups & cloning X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2009 00:30:54 -0000 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. :-) > 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. > Slices ad2s1d,e,f and g dump ok to usb. a does not - errors ("should use > -L when dumping live filesystems) 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. 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 # 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. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...