From owner-freebsd-fs@FreeBSD.ORG Mon Sep 22 18:12:56 2008 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E071E1065676; Mon, 22 Sep 2008 18:12:56 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id 51D118FC19; Mon, 22 Sep 2008 18:12:56 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.2/8.14.2) with ESMTP id m8MICslf001834; Mon, 22 Sep 2008 22:12:54 +0400 (MSD) (envelope-from marck@rinet.ru) Date: Mon, 22 Sep 2008 22:12:54 +0400 (MSD) From: Dmitry Morozovsky To: Stanislav Sedov In-Reply-To: <20080921140932.adf51b5e.stas@FreeBSD.org> Message-ID: References: <20080921140932.adf51b5e.stas@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (woozle.rinet.ru [0.0.0.0]); Mon, 22 Sep 2008 22:12:54 +0400 (MSD) Cc: freebsd-fs@FreeBSD.org, marcel@FreeBSD.org Subject: Re: gpt in-place editing X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Sep 2008 18:12:57 -0000 On Sun, 21 Sep 2008, Stanislav Sedov wrote: SS> > is there a way to split existing GPT partition into two, like one can do in SS> > bsdlabel case? SS> > SS> > I found myself wanting to shrink swap to have an alternate root, but have no SS> > luck in my experiments. SS> > SS> > For the reference, I have SS> > SS> > da0p1 boot SS> > da0p2 bootdisk SS> > da0p3 swap SS> > da0p4 ZFS SS> > SS> > and want to place two partitions in place of da0p3... SS> SS> You can simpy remove the da0p3 partition and add two new instead of it. It does not seem gpart wants allow me to delete da0p3 while disk is active... gpt did the trick though, with sysctl kern.geom.debugflags=16 root@beaver:/# gpt remove -i 3 da0 da0p3 removed root@beaver:/# gpt show da0 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 128 1 GPT part - FreeBSD boot 162 1048576 2 GPT part - FreeBSD UFS/UFS2 1048738 33554432 34603170 4359862077 4 GPT part - FreeBSD ZFS 4394465247 32 Sec GPT table 4394465279 1 Sec GPT header root@beaver:/# gpt add -s 1048576 -t ufs da0 root@beaver:/# gpt show da0 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 128 1 GPT part - FreeBSD boot 162 1048576 2 GPT part - FreeBSD UFS/UFS2 1048738 1048576 3 GPT part - FreeBSD UFS/UFS2 2097314 32505856 34603170 4359862077 4 GPT part - FreeBSD ZFS 4394465247 32 Sec GPT table 4394465279 1 Sec GPT header root@beaver:/# gpt add -t swap da0 BUT - system missed part 5: root@beaver:/# gpt show da0 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 128 1 GPT part - FreeBSD boot 162 1048576 2 GPT part - FreeBSD UFS/UFS2 1048738 1048576 3 GPT part - FreeBSD UFS/UFS2 2097314 32505856 5 GPT part - FreeBSD swap 34603170 4359862077 4 GPT part - FreeBSD ZFS 4394465247 32 Sec GPT table 4394465279 1 Sec GPT header root@beaver:/# gpart show => 34 4394465213 da0 GPT (2.2TB) 34 128 1 freebsd-boot (65.5KB) 162 1048576 2 freebsd-ufs (536.9MB) 1048738 33554432 3 freebsd-swap (17.2GB) 34603170 4359862077 4 freebsd-zfs (2.2TB) root@beaver:/# ls /dev/da0* /dev/da0 /dev/da0p1 /dev/da0p2 /dev/da0p3 /dev/da0p4 Marcel, can you please comment too? Thanks. Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------