From owner-freebsd-questions@FreeBSD.ORG Wed Feb 11 04:15:27 2004 Return-Path: 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 A354C16A4CE for ; Wed, 11 Feb 2004 04:15:27 -0800 (PST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A96243D1D for ; Wed, 11 Feb 2004 04:15:27 -0800 (PST) (envelope-from malcolm.kay@internode.on.net) Received: from beta.home (ppp130-138.lns1.adl2.internode.on.net [150.101.130.138])i1BCFOUK001375 for ; Wed, 11 Feb 2004 22:45:25 +1030 (CST) Content-Type: text/plain; charset="iso-8859-1" From: Malcolm Kay Organization: At home To: freebsd-questions@freebsd.org Date: Wed, 11 Feb 2004 22:45:24 +1030 User-Agent: KMail/1.4.3 References: <4026FBA6.8030001@users.sourceforge.net> <200402110030.49302.malcolm.kay@internode.on.net> <402A07C2.50005@users.sourceforge.net> In-Reply-To: <402A07C2.50005@users.sourceforge.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200402112245.24095.malcolm.kay@internode.on.net> Subject: Re: How to safely merge two slices on harddisk? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2004 12:15:27 -0000 On Wed, 11 Feb 2004 21:15, Rob wrote: > Malcolm Kay wrote: > > On Tue, 10 Feb 2004 04:19, Rob wrote: > >>Malcolm, > >> > >>Thank you for your detailed answer to my question. > >> > >>Malcolm Kay wrote: > >>>On Mon, 9 Feb 2004 13:46, Rob wrote: > >>> Do not change the offset of 'f'. If 'g' does not physically > >>> follow 'f' on the disk then this is not going to work -- give up > >>> now!!! > >> > >>How can I find that out? Is it the slice order in the disk label edit= or > >>from /stand/sysinstall : > > > > No! What you want is disklabel (see man page). On 5.x this seems to > > have been replaced by bsdlabel -- but I have no experience with 5.x. > > The disklabel output of the disk is: > > -----------------------------------------------------------------------= -- > # disklabel /dev/ad1s1c: > [...zip...] > 8 partitions: > size offset fstype [fsize bsize bps/cpg] > c:156296322 0 unused 0 0 # (Cyl. 0 - > 9728*) > > a: 204800 0 4.2BSD 0 0 0 # (Cyl. 0 - > 12*) e: 6348800 204800 4.2BSD 0 0 0 # (Cyl. 12= *- > 407*) f: 6348800 6553600 4.2BSD 0 0 0 # (Cyl. 40= 7*- > 803*) g: 6348800 12902400 4.2BSD 0 0 0 # (Cyl. 80= 3*- > 1198*) h: 614400 19251200 4.2BSD 0 0 0 # (Cyl. 11= 98*- > 1236*) b: 614400 19865600 4.2BSD 2048 16384 91 # (Cyl. 12= 36*- > 1274*) d:135816322 20480000 4.2BSD 0 0 0 # (Cyl. 12= 74*- > 9728*) > -----------------------------------------------------------------------= -- > > I have put the partitions in a new order, such that the Cyl. counts are > continuously running up. Am I right, that g physically follows f here? > If so, that would mean I can merge f and g into one new partition of 6 = Gb, > right? I hope you mean you put the list in a new order -- not the physical parti= tions! You'll notice the cylinder counts occur after a '#'; thus they have no re= al=20 signifcance but are only (informative) comments. > > I actually wonder if the label editor of /stand/sysinstall can do what > I want.=20 Hmm, probably, but it is not always easy to know in detail what sysinstal= l=20 will do. In my opinion it is much more robust to modify the table through= =20 disklabel. >Since I now know that f and g are back-to-front partitions, I could > remove them and create a single new one; when I write this to disk, I c= an > let sysinstall also create a new filesystem on the newly merged partiti= on. > Yes you could, but this discards the data in both the partitions 'f' and = 'g'. But you could make a copy of everything on 'g' to a new tree on 'f'. Now dismount 'g' and 'f'.=20 Dump the output from fdisklabel to a file. Edit the file by removing the g: line. Change the size in the f: line from 6348800 to 12697600. Use disklabel to write the revised table to disk. Use growfs on partition 'f'. Remount partition'f'. Mission accomplished -- I hope. > I know this is potentially dangerous, but this way I have already > deleted the swap partition, created a new ufs partition instead and > created a file system on that; all in sysinstall. > I believe it is safe, as long as I do not run 'newfs' on the existing > partitions. > > Or am I missing something important here? A good chance it will work -- but pre-existing 'f' and 'g' data is lost. Malcolm