From owner-freebsd-questions@FreeBSD.ORG Mon Feb 9 03:55:39 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 0A34E16A4CE for ; Mon, 9 Feb 2004 03:55:39 -0800 (PST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C89343D1D for ; Mon, 9 Feb 2004 03:55:38 -0800 (PST) (envelope-from malcolm.kay@internode.on.net) Received: from beta.home (ppp130-138.lns1.adl2.internode.on.net [150.101.130.138])i19BtZxC024286; Mon, 9 Feb 2004 22:25:35 +1030 (CST) Content-Type: text/plain; charset="iso-8859-1" From: Malcolm Kay Organization: At home To: Rob , freebsd-questions@freebsd.org Date: Mon, 9 Feb 2004 22:25:35 +1030 User-Agent: KMail/1.4.3 References: <4026FBA6.8030001@users.sourceforge.net> In-Reply-To: <4026FBA6.8030001@users.sourceforge.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200402092225.35217.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: Mon, 09 Feb 2004 11:55:39 -0000 On Mon, 9 Feb 2004 13:46, Rob wrote: > Hi, > > I have a hard disk, on which I would like to merge two slices > into one single slice. The disk slices are as follows: > > /dev/ad1s1a 98M 43M 47M 48% /home/userB > /dev/ad1s1d 64G 45G 14G 77% /home/userA > /dev/ad1s1e 3.0G 2.5G 282M 90% /home/userC > /dev/ad1s1f 3.0G 1.0G 1.7G 37% /usr/ports > /dev/ad1s1g 3.0G 268M 2.5G 10% /mnt > /dev/ad1s1h 295M 295M -23.5M 109% /diskless_swap > > I want to merge /ad1s1f and /ad1s1g into one 6Gb slice. > > The merging should NOT destroy anything in the slices before > (ad1s1a, d, and e), but destroying the data in the one afer > (ad1s1h) is no problem. > > Is there a way to do this? What is the safest one? > (without having to backup the whole disk). Any manipulation at this level is risky. To do so without first=20 taking a backup endangers all your data. But once you have the assurance of a backup you could copy all the information from /mnt into some new tree in /usr/ports. That is a tree copy of the content of /dev/ad1s1g to a new tree on /dev/ad1s1f. cp -Rp /mnt /usr/ports/newtree Having done that partition /dev/ad1s1g becomes free and you=20 can rebuild the disk label using disklabel to eliminate the 'g'=20 partition and extend the size of the 'f' partitition to take up the=20 extra space. But first umount the 'f' and 'g' partitions. CAUTION =3D=3D=3D=3D=3D=3D=3D=3D 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!!! If all has gone well so far you should now be able to use growfs on /dev/ad1s1f to expand the file system to fill the partition. Remount the 'f' partition and you should be back in business. If you want to find what was on /dev/ad1s1g with the original path=20 then rm /mnt ln -s /usr/ports/newtree /mnt If you are on 5.x then be warned that I have no experience with=20 these versions of FBSD. And in any case I have never, myself, had occassion to use growfs. Malcolm