From owner-freebsd-questions Sat Jun 15 19: 9:25 2002 Delivered-To: freebsd-questions@freebsd.org Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by hub.freebsd.org (Postfix) with ESMTP id 6E51737B43B for ; Sat, 15 Jun 2002 19:09:08 -0700 (PDT) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id A72AB816D6; Sun, 16 Jun 2002 11:39:06 +0930 (CST) Date: Sun, 16 Jun 2002 11:39:06 +0930 From: Greg 'groggy' Lehey To: Corey Snow Cc: freebsd-questions@freebsd.org Subject: Re: Adding hard drive, moving /usr/src Message-ID: <20020616020906.GJ65995@wantadilla.lemis.com> References: <3D0B8EE1.6924.A196528@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D0B8EE1.6924.A196528@localhost> User-Agent: Mutt/1.3.99i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 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 On Saturday, 15 June 2002 at 19:00:49 -0700, Corey Snow wrote: > Here's the situation. I have a machine that has a 540 MB hard drive. > I'm running out of room on the /usr slice (partition?). It's fine as > long as I don't try and download any of the source, but in order to > make this box a headless one (cf my previous postings) I need to > recompile the loader, and maybe even have to do a "make world" (I'm > still researching that part. I hope not, because it would probably > take days on this 486). > > Problem is I can't download the all the sources I need because the > /usr partition is running out of space. Lucky me, I've got some extra > hard drives around. I can toss a second drive in, around 800 MB or > so, and add it to the system. Then I can store my /usr/src files > there. > > So here's the questions: > > 1) How do you add a drive to a FreeBSD machine? There are two ways: with /stand/sysinstall or with fdisk and disklabel. The former is much easier. This is described in detail in "The Complete FreeBSD", but basically: 1. Start sysinstall. Go to the index, then select "Partition" to find the drive and set up a partition table. Use the W command to write the partition table. You don't need a boot selector, since you won't be booting from this drive. 2. Exit the partition menu, enter the label menu, and set up your file systems. Use the W command, which will newfs them, so it'll take a while to come back. 3. I think you still need to edit /etc/fstab. Check, anyway. > Does the kernel have to be recompiled? No. > 2) When I have the new drive in and set up, how can I relocate my > /usr/src files to the new larger slice on the second drive? My > thought was this: mv the files currently in /usr/src to a temp > directory, like /usr/srctemp. Then edit fstab to mount the new slice > to /usr/src and mv the files from srctemp into the new src > directory. Is this the right approach? No. umount the new file system, and remount it on /mnt. Then move the files across to /mnt. I use tar, but others use dump and restore. With tar it would be something like: # umount /usr/src (if necessary) # mount /dev/ad2s1h /mnt # cd /usr/src # tar cf - . | (cd /mnt; tar xvf -) After this is done, check that the files made it, then: # rm -rf /usr/src/* # umount /mnt # mount /usr/src (assuming that /etc/fstab has been updated) It's important to remove the files under /usr/src before mounting the file system in the correct place; otherwise you won't be able to access them at all. Greg -- When replying to this message, please copy the original recipients. If you don't, I may ignore the reply. For more information, see http://www.lemis.com/questions.html See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message