From owner-freebsd-questions@FreeBSD.ORG Fri Sep 22 20:53:05 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 695E716A403 for ; Fri, 22 Sep 2006 20:53:05 +0000 (UTC) (envelope-from backyard1454-bsd@yahoo.com) Received: from web83102.mail.mud.yahoo.com (web83102.mail.mud.yahoo.com [216.252.101.31]) by mx1.FreeBSD.org (Postfix) with SMTP id 0318B43D46 for ; Fri, 22 Sep 2006 20:53:04 +0000 (GMT) (envelope-from backyard1454-bsd@yahoo.com) Received: (qmail 67415 invoked by uid 60001); 22 Sep 2006 20:53:04 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=6nDMBCYwYcoMJbyljVw92O8qfKGE7We6fisBE7Uocgw8eiFGGutqum6Uh6hpzbrmCtjVp7+Ug1aRX2akWMBR1APVZj02Dj5sBUy3Co4lK9AtQhM9TYerLYLf6Wk4PKPpT59N2TnmH7nOh/4m6g6BCL6s+4yLZ7dvRGWvhLrIXzE= ; Message-ID: <20060922205304.67413.qmail@web83102.mail.mud.yahoo.com> Received: from [75.15.29.212] by web83102.mail.mud.yahoo.com via HTTP; Fri, 22 Sep 2006 13:53:04 PDT Date: Fri, 22 Sep 2006 13:53:04 -0700 (PDT) From: backyard To: questions@freebsd.org In-Reply-To: <45142A20.5040601@averageadmins.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: Subject: Re: Resizing Partitions, Losing Windows XP... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: backyard1454-bsd@yahoo.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2006 20:53:05 -0000 --- Jeff Cross wrote: > > I really like the way I have my stuff setup within > FreeBSD and would > hate to have to recreate a lot of it as well as > install applications > over again. Could I do a dump of my current FreeBSD > partition, reformat > and partition the whole drive, install FreeBSD, and > then restore my data > to the new partition or would this cause issues? > > Any assistance is greatly appreciated! > > Jeff Cross > http://www.averageadmins.com/ > Yes failrly easily you can back everything up to "tape" first you must find a suitable backup medium such as a USB hard drive. I use a 5 gig seagate drive I picked up along the way. This allows a typcial root, var and about 5.6 gig of stuff on /usr. With compression things aught to work. You might want to clean up /usr/ports/distfiles, /usr/obj, and run a "cd /usr/ports; make -DNOCLEANDEPENDS clean" to get rid of any "unnecessary" files, but this is up to you. then... I would suggest booting to safe mode on your current FreeBSD install first of all then do a #fsck -p for paranoia #swapon -a for swap # mount -a -o ro to mount the partitions read only. this isn't required but if the drives are rw you need -L as a switch to the dump command below. mount -u /tmp dump will use /tmp then mount you backup media whereever you want I will use /mnt as my mount point I also assume you have separate partions for each drive. then this monster will backup everything (dump -0 -C 32 -f - / | bzip2 | dd of=/mnt/root.dbz2) && (dump -0 -C 32 -f - /var | bzip2 | dd of=/mnt/var.dbz2) && (dump -0 -C 32 -f - /usr | bzip2 | dd of=/mnt/usr.dbz2) then grab a coffee and wait for the tapes to be made. now to restore there are better ways to do it but this method has worked for me... reboot with the FreeBSD install disk go to fdisk and delete the old slices and create the new slice. Use all disk, I would not do this dangerously dedicated keep it compatible I've had boot issues with boot drives in dangerously dedicated mode. hit w to write the table it will ask if you are sure say yes and install the boot loader you want, standard MBR or the boot manager, your choice. reboot load up the cd and do bsdlabel mode setup root, usr, var, tmp, swap whatever you use as a partitioning scheme. this tool will require a root partitio to be specified to work. then w to write the label now go to fixit mode on the cd and you'll be at a prompt. if your backup media was Fat32, ext2, basically anything but UFS1 or 2 you will type sysctl kern.module_path="/dist/boot/kernel" to let the kernel find the right modules to support fat32 then I generally do a mkdir /TAPE and mount the backup media there. you should also have the swap already loaded and root will be mounted on /mnt usr will be /mnt/usr and var will be /mnt/var next type #mdconfig -a -t swap -s 512m this will give you a md node prolly md1 512m is what I use (512 mb of swap) but less may work fine. #newfs md1 mkdir /junk; mount /dev/md1 /junk; cp /tmp/* /junk/; umount /junk; mount /dev/md1 /tmp restore will need this tmp directory to have space or things will get messy then I would #umount /mnt/var /mnt/usr /mnt then I usually reformat the partitions to get rid of annoying error messages about directories alrady being present during the restore #newfs -O 2 -L root -n /dev/ad0s1a (adjust your device as required the -L option isn't necessary #newfs -0 2 -L var -U -n /dev/ad0s1d #newfs =O 2 -L usr -U -n /dev/ad0s1e again adust the devices as required then remount root to /mnt then #bzip2 -dc /TAPE/root.dbz2 | (cd /mnt; restore -r -f -) mount var and usr then repeat for them with "cd /mnt/usr" and "cd /mnt/var" as required. make any changes to /mnt/etc/fstab as required, unmount everything and you should be good to go for a reboot. you may get some "expected 23423234 got 234253546" messages in the restore. a few of them aren't a problem. As suggested by others MAKE SURE YOUR DUMPS ARE GOOD PRIOR TO DOING THE RESLICING AND PARTITIONING!!!! you can use that restore command to restore to whereever you want with the right change dir so find some free space and doit. even if you run a newfs on the windows slice and mount it unlabeled just to see the dumps are good, and assuming you don't care about windows being lost. after the reboot delete the restoresymtable files on each of the filesystems of course if you know fdisk and bsdlabel from the command line using a freesbie live cd would prolly make this easier and not require a reboot after the fdisk... I have had issues with the drives being able to boot up so I generally like to use grub. so readup on manually installing the MBR or boot manager just in case. I think my last restore I just chose the standard MBR and everything went fine. good luck -brian