From owner-freebsd-geom@FreeBSD.ORG Thu Nov 18 18:10:33 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 EB3F6106566C; Thu, 18 Nov 2010 18:10:33 +0000 (UTC) (envelope-from gcr+freebsd-geom@tharned.org) Received: from roadkill.tharned.org (roadkill.tharned.org [75.145.12.185]) by mx1.freebsd.org (Postfix) with ESMTP id 619958FC17; Thu, 18 Nov 2010 18:10:33 +0000 (UTC) Received: from roadkill.tharned.org (11008@roadkill.tharned.org [75.145.12.185]) (authenticated bits=0) by roadkill.tharned.org (8.14.4/8.14.4) with ESMTP id oAII0NFJ069742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 18 Nov 2010 12:00:23 -0600 (CST) (envelope-from gcr+freebsd-geom@tharned.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tharned.org; s=2010; t=1290103223; bh=BlIIr0WcYknh8k/FYeAe5oconZgYBqJuPRoW7uF6aNg=; l=1750; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=a5FNiCAm27/eY7fXpOQsfazCyoXKS/8+JTUrr5qfIM+5EbbLADZBJxBf5ZH7D8T16 Kp+enKfJu/HZ7KopL7NekjVf7oKrndO0RAdrGNykJINJ+PDeliH5JX9AgrhosUyLpd fkROqJGNBCU9d/v7gk0WR4X5/n40cm8QfAPKCrmU= Date: Thu, 18 Nov 2010 12:00:23 -0600 (CST) From: Greg Rivers To: "Andrey V. Elsukov" In-Reply-To: <4CE505B2.6010601@yandex.ru> Message-ID: References: <4CE505B2.6010601@yandex.ru> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (roadkill.tharned.org [75.145.12.185]); Thu, 18 Nov 2010 12:00:23 -0600 (CST) Cc: Marcel Moolenaar , freebsd-geom@freebsd.org Subject: Re: backup a partition table 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: Thu, 18 Nov 2010 18:10:34 -0000 On Thu, 18 Nov 2010, Andrey V. Elsukov wrote: > Hi, Marcel and All. > > I'm thinking about such feature like ability to dump partition table > into file from which it can be recovered in the future. Also it can be > used to copy partition table to another device. > > At the moment i think that just print out a list of commands that should > be done to create the same table it is the easiest way. > For example: >> gpart show ada1 > => 34 320172989 ada1 GPT (153G) > 34 512 1 freebsd-boot (256K) > 546 8388608 2 freebsd-swap (4.0G) > 8389154 311783869 3 freebsd-zfs (149G) > >> gpart dump -f x ada1 > geom part create -s gpt -f x ada1 > geom part add -b 34 -s 512 -i 1 -t freebsd-boot -f x ada1 > geom part add -b 546 -s 8388608 -i 2 -t freebsd-swap -f x ada1 > geom part add -b 8389154 -s 311783869 -i 3 -t freebsd-zfs -f x ada1 > > Any comments and ideas are welcome. > I think this is a great idea. But why not make gpart eat it's own dog food like bsdlabel(8) does? The output of bsdlabel is a simple text file that's easy for humans to read and edit. bsdlabel takes this very same output as input (-R). bsdlabel also supports wildcards on input, so it will compute starts/offsets for you. And bsdlabel makes it easy to change an existing label by opening the editor on it (-e). So instead of a special dump command or complicated XML formatting, just make "gpart show" output suitable for input (it's probably already close), and add the verb to read that input ("gpart read" or "gpart apply" or such). Add the ability to handle wildcards and run the editor, and gpart could be as friendly to use as bsdlabel is. -- Greg