From owner-freebsd-geom@FreeBSD.ORG Sun Aug 22 17:14:57 2010 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D25D1065693; Sun, 22 Aug 2010 17:14:57 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout028.mac.com (asmtpout028.mac.com [17.148.16.103]) by mx1.freebsd.org (Postfix) with ESMTP id 625188FC1D; Sun, 22 Aug 2010 17:14:57 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from sa-nc-it-176.static.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp028.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0L7K0075KAFVG780@asmtp028.mac.com>; Sun, 22 Aug 2010 09:14:21 -0700 (PDT) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1004200000 definitions=main-1008220095 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.0.10011,1.0.148,0.0.0000 definitions=2010-08-22_06:2010-08-22, 2010-08-22, 1970-01-01 signatures=0 From: Marcel Moolenaar In-reply-to: <4C70EB80.5050901@yandex.ru> Date: Sun, 22 Aug 2010 09:14:18 -0700 Message-id: <2AEF046C-476D-4AE6-9CF7-92DF45B35C5D@mac.com> References: <4C70EB80.5050901@yandex.ru> To: "Andrey V. Elsukov" X-Mailer: Apple Mail (2.1081) Cc: Alexander Motin , Marcel Moolenaar , Konstantin Belousov , freebsd-geom@freebsd.org Subject: Re: RFC: destroying non empty partition tables with gpart(8) X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2010 17:14:57 -0000 On Aug 22, 2010, at 2:18 AM, Andrey V. Elsukov wrote: > Hi All. > > I think gpart(8) is default way to create partition tables and manage > partitions in head/ and stable/8. Now when you want to destroy partition > table you should delete all partitions from it. This is not so bad, but > i made a patch that add ability destroy table with auto deleting all > partitions. For example: > > # gpart destroy -r ada1 > > I did it in user space, it just delete all partition entries before > destroying table. At this time if deleting of some partition failed > you can do `gpart undo ada1` and all already deleted by last command > partition will be restored. It seems usable for me. > > Any comments? Very nice! I'm pleased to see this done in userspace, as it's exactly where you want this. I haven't actually looked at the patch, but in case you didn't: consider disabling the auto- commit on the delete requests and use commit/undo to create an automic operation: 1) use commit when everything could be deleted without error. this makes it permanent. 2) use the undo in case there's an error. This "unwinds" the the sequence of operations that succeeded so far, giving you the all or nothing behaviour. FYI, -- Marcel Moolenaar xcllnt@mac.com