From owner-freebsd-questions@FreeBSD.ORG Wed Nov 23 18:52:25 2005 Return-Path: X-Original-To: freebsd-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 6323816A41F for ; Wed, 23 Nov 2005 18:52:25 +0000 (GMT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: from clunix.cl.msu.edu (clunix.cl.msu.edu [35.9.2.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id D055743D7E for ; Wed, 23 Nov 2005 18:52:16 +0000 (GMT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: from clunix.cl.msu.edu (localhost [127.0.0.1]) by clunix.cl.msu.edu (8.12.10+Sun/8.12.2) with ESMTP id jANIqE38012200; Wed, 23 Nov 2005 13:52:14 -0500 (EST) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.12.10+Sun/8.12.2/Submit) id jANIqE1h012199; Wed, 23 Nov 2005 13:52:14 -0500 (EST) From: Jerry McAllister Message-Id: <200511231852.jANIqE1h012199@clunix.cl.msu.edu> To: Michael.Collette@TestEquity.com (Michael Collette) Date: Wed, 23 Nov 2005 13:52:14 -0500 (EST) In-Reply-To: <4384AF06.4090809@TestEquity.com> X-Mailer: ELM [version 2.5 PL7] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: FreeBSD Lists Subject: Re: Automating Drive Formatting X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Nov 2005 18:52:25 -0000 > > I'm looking for some way to script together an automatic formatting of a hard > drive. Having a fair amount of difficulty locating some good information on > doing this. > > For example, let's say there's an unknown IDE drive that's at least 40G in > size. On that drive I want to create 1 partition with 3 labels. 2 of the > labels get 10G, and the 3rd gets whatever is left. > > My reason for doing this is that we've set up a couple of servers that are > running diskless, but are bogging down a bit with getting everything via NFS. > I'm trying to get a diskless box note the installed drive, check to see if > it's in the format I expect, and if not perform the bsdlabel, newfs, and all > that. > > I know the basic info is somewhere accessible, or sysinstall wouldn't have > this stuff available. Just need a shove in the right direction please. If you know the drive devince name /dev/ad3 or something like that, you can just run fdisk on it to read information and write a program (or script) to read its output. Part of that output will tell you the number of sectors on the drive. The information you want is in the third line of the output from fdisk. Ignore the rest of it. Your program then decides if it is what you want and then runs the fdisk to create a single slice and disklabel (bsdlabel) to make the 3 partitions and then newfs on each partition to make the filesystems. It is not difficult code to write (proof: I have done it for our installations). I did it in C because the rest of the installation stuff is already in C, but you could easily do it in Perl or most any language that allows you to run system commands from within the program or script. I don't know of any that do not support that. Most of them call the directive "system" or something similar. ////jerry > Thanks, > -- > Michael Collette > IT Manager > TestEquity Inc > Michael.Collette@TestEquity.com > http://www.testequity.com/ > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" >