Date: Wed, 24 Jul 2002 10:40:24 -0400 (EDT) From: Jerry McAllister <jerrymc@clunix.cl.msu.edu> To: JamesV@postmaster.co.uk (James Vella) Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Moving /var Message-ID: <200207241440.g6OEeOs08332@clunix.cl.msu.edu> In-Reply-To: <PM.2227.1027506042@pmweb8.uk1.bibliotech.net> from "James Vella" at Jul 24, 2002 11:20:42 AM
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207241440.g6OEeOs08332>