From owner-freebsd-questions@FreeBSD.ORG Wed May 31 20:42:29 2006 Return-Path: X-Original-To: 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 313D816AB86 for ; Wed, 31 May 2006 20:42:29 +0000 (UTC) (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 D3B9243D78 for ; Wed, 31 May 2006 20:42:24 +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.13.6+Sun/8.13.6) with ESMTP id k4VKgO48008665; Wed, 31 May 2006 16:42:24 -0400 (EDT) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.13.6+Sun/8.13.6/Submit) id k4VKgOSU008664; Wed, 31 May 2006 16:42:24 -0400 (EDT) From: Jerry McAllister Message-Id: <200605312042.k4VKgOSU008664@clunix.cl.msu.edu> To: roberthuff@rcn.com (Robert Huff) Date: Wed, 31 May 2006 16:42:24 -0400 (EDT) In-Reply-To: <17533.61128.28295.514215@jerusalem.litteratus.org> X-Mailer: ELM [version 2.5 PL7] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: using bsdlabel 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, 31 May 2006 20:42:36 -0000 > > I've never used bsdlabel before; would someone please confirm > I've got this right? > Status quo: > > huff@>> bsdlabel da0s1 > # /dev/da0s1: > 8 partitions: > # size offset fstype [fsize bsize bps/cpg] > a: 1024000 0 4.2BSD 0 0 0 > b: 2097152 1024000 swap > c: 8916012 0 unused 0 0 # "raw" part, don't edit > d: 2097152 3121152 4.2BSD 0 0 0 > > As I understand it, if I run this: > > huff@>> bsdlabel -w da0s1 -f /label.new > > where /label.new has: > > # /dev/da0s1: > 8 partitions: > # size offset fstype [fsize bsize bps/cpg] > a: 1024000 0 4.2BSD 0 0 0 > b: 2097152 1024000 swap > c: 8916012 0 unused 0 0 # "raw" part, don't edit > d: 2097152 3121152 4.2BSD 0 0 0 > e: 3697708 5128304 4.2BSD 0 0 0 > > this will allocate the rest of the slice to partition 'e'. > (And we're ready to newfs.) If I am doing it by hand, I would prefer using direct edit as in: (NOTE, you apparently already have some usable label on the disk) >> bsdlabel -e -r da0s1 This will bring up an edit session (vi unless you have your editor set to something else - I use vi) as follows. > # /dev/da0s1: > 8 partitions: > # size offset fstype [fsize bsize bps/cpg] > a: 1024000 0 4.2BSD 0 0 0 > b: 2097152 * swap > c: * 0 unused 0 0 # "raw" part, don't edit > d: 2097152 * 4.2BSD 0 0 0 > e: * * 4.2BSD 0 0 0 > Then, just write and quit the edit session It will calculate the last partition size and all the offsets for you just the way you want it. I use this method in our programs that automatically build variable sized disks for our clients. I fix the size of root (da0s1a), swap (da0s1b) and tmp (da0s1e) and then make the last partition (da0s1f) contain all the remainder, whatever it is. It works just fine. If you really want to work from a file, put the output of your bsdlabel into the file and then edit it as I show above. bsdlabel -r da0s1 >> label.new vi label.new Then do: disklabel -R da0s1 label.new The only thing you aren't doing in either of these cases is making that da0s1a bootable. If you want that, you need to do: either bsdlabel -B da0s1 bsdlabel -r -e and then do the edits as above or to do it from a file as created above do: disklabel -R -B da0s1 label.new ////jerry > > Robert Huff > _______________________________________________ > 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"