From owner-freebsd-questions Wed Jul 24 7:40:33 2002 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 856A237B400 for ; Wed, 24 Jul 2002 07:40:27 -0700 (PDT) Received: from clunix.cl.msu.edu (clunix.cl.msu.edu [35.9.2.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id C98BA43E42 for ; Wed, 24 Jul 2002 07:40:26 -0700 (PDT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.11.6+Sun/8.11.6) id g6OEeOs08332; Wed, 24 Jul 2002 10:40:24 -0400 (EDT) From: Jerry McAllister Message-Id: <200207241440.g6OEeOs08332@clunix.cl.msu.edu> Subject: Re: Moving /var To: JamesV@postmaster.co.uk (James Vella) Date: Wed, 24 Jul 2002 10:40:24 -0400 (EDT) Cc: freebsd-questions@FreeBSD.ORG In-Reply-To: from "James Vella" at Jul 24, 2002 11:20:42 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > chaps, > > i have been reading through a lot of the documentation out there and > am still unable to do the following: > > using freebsd v4.6, i need to be transferee /var on da0 to the new hd da1 > in it's entirety. i've managed to create the disklabel, but am stumped > as to how to continue. > > any help would be appreciated You didn't say if you did a newfs(8) on the new partition. (ssuming you did) First make a mount point for the new partition (choose something meaningful) cd / mkdir otherdsk edit /etc/fstab so the new partition will get mounted on boot using the appropriate partition identifier in place of da1s1a /dev/da1s1a /otherdsk ufs rw 2 2 mount the partition mount /otherdsk tar up the existing /var Example puts it in a tar file on the new disk because I assume there is room there. It would also be reasonable to pipe the tar to another tar that unrolls it in place. tar cf /otherdisk/var.tar /var Untar the file in the new location. cd /otherdsk tar xf var.tar Get rid of the original /var (rename it for now just in case) cd / mv var var.premove Make a link to the new /var ln -s /otherdsk/var var Now you are done except you might enjoy checking things out and then eventually getting rid of the old copy of /var and the tar file. cd / rm -r var.premove cd /otherdsk rm var.tar Choose your own file and directory names. We generally would acttually name the new var something like other.var and the link command would then look like ln -s /otherdsk/other.var var Alternatively you could just make the new partition directly mount as /var In that case Make sure your present /var is not already its own mounted file system (if it is, use dump/restore to move it instead of tar) Then edit your your fstab entry to look something like: /dev/da1s1a /var ufs rw 2 2 Then you would change the name of existing var directory cd / mv var var.premove Mount the new partition as /var mount /var Put the contents of the old var directory in to the new partition using tar cd var.premove tar cf /var/var.tar cd /var tar xf var.tar Now you are all set. Check it out and eventually get rid of the old var directory (/var.premove) and the tar file. If you are going from an current partition mounted as /var to a new partition mounted as /var use dump and restore Make a temporary mount point for the new partition and mount it there cd / mkdir newvar mount /dev/da1s1a /newvar Use dump to copy the old /var cd / dump 0af /newvar/var.dump /var Unroll the dump file in to the new partition cd /newvar restore xf var.dump answer 'n' to setting owner of . Unmount the old /var (or this can be done before the dump command) umount /var Now, edit /etc/fstab to put in the new partition (da1s1a or whatever it is) for /var replacing the old one (da0s1f or whatever it might be) Remount /var mount /var You should be done. Just eventually get rid of the old dump file and do whatever you please with the old partition that used to be /var ////jerry > > james > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message