Date: Sat, 16 Dec 2000 15:11:02 -0800 From: "Crist J. Clark" <cjclark@reflexnet.net> To: John Bolster <j.bol@gte.net> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: How to move /var directories Message-ID: <20001216151102.S96105@149.211.6.64.reflexcom.com> In-Reply-To: <NEBBKLANMLAKACFKNODOCEHICJAA.j.bol@gte.net>; from j.bol@gte.net on Sat, Dec 16, 2000 at 05:38:31PM -0500 References: <NEBBKLANMLAKACFKNODOCEHICJAA.j.bol@gte.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Dec 16, 2000 at 05:38:31PM -0500, John Bolster wrote: > Hi, > > I set up my FBSD 4.1 box with a 20MB /var and 14GB /usr and now I've spent > ages configuring everything else- dns, ftpd, httpd, firewall, etc. Now I > come to use it as a mail server for over 100 people, I've realized that /var > needed to be much bigger and I'll probably never have much use for all the > /usr space. > > I've read that there is no Partition Magic type program for FBSD, so I > assume I'll have to move /var/mail and /var/ftp somewhere else where there > is more room. > > Can anyone tell me if this is the best way to deal with this, if there is a > better idea, and (ideally) how to do it? How big is the disk you have? Unless it is _huge_ I think that for a mailserver for 100 people you should just toss another disk in there and use that. Then the question arises whether you put just /var/mail or all of /var on the new drive. If you think that /var would be fine space-wise once /var/mail is moved, just put /var/mail on the new drive. If you want to do something with a /var/ftp directory, whatever that may be, you may have more to consider. Anyway, the procedure to do this is not too bad. You'll need to bring down the machine and put the new device in. Provided you have not built your own kernel and disabled the device the new drive would be using (let's say the new disk is the master on a second IDE channel with static device numbering, ad2), you should boot into single-user mode. First, mount your disks, # mount -t ufs -a Then prepare the new drive by writing a new "blank" label and then adding your partitions, # disklabel -w -r ad2 auto # disklabel -e ad2 After you do that, put on the filesystem(s) (let's say you made one 'f' parition out of the whole disk), # newfs ad2f Now, temporarily mount the disk and transfer the files that will be living there (in this example, we're moving all of /var), # mount /dev/ad2f /mnt # cd /var # tar cf - . | tar xf - -C /mnt Now, it is probably a good idea to check the move went well, and even after you do that, I'd recommend that you not remove the old files unless you have a reason to, # mv /var /var.old # mkdir /var Now, let's mount the new /var in the right place. But let's do it by putting the entry in /etc/fstab so we can check our work (of course you can edit fstab interactively, but is that nearly as much fun?), # ( echo '?/var?,s/^/#/'; echo w ) | ed /etc/fstab # echo "/dev/ad2f /var ufs rw 2 2" >> /etc/fstab # umount /mnt # mount /var And you should be fine. Exit the single-user shell and the machine should continue up into multi-user mode. And you are done. -- Crist J. Clark cjclark@alum.mit.edu 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?20001216151102.S96105>