From owner-freebsd-questions@FreeBSD.ORG Fri Mar 30 14:43:01 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7899C1065673; Fri, 30 Mar 2012 14:43:01 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 359948FC15; Fri, 30 Mar 2012 14:43:01 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.5/8.14.5) with ESMTP id q2UEh0b5057654; Fri, 30 Mar 2012 08:43:00 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.5/8.14.5/Submit) with ESMTP id q2UEh0Fi057651; Fri, 30 Mar 2012 08:43:00 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Fri, 30 Mar 2012 08:43:00 -0600 (MDT) From: Warren Block To: Alexander Best In-Reply-To: <20120330130051.GA62102@freebsd.org> Message-ID: References: <20120330130051.GA62102@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Fri, 30 Mar 2012 08:43:00 -0600 (MDT) Cc: freebsd-questions@freebsd.org Subject: Re: question regarding geom labels X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2012 14:43:01 -0000 On Fri, 30 Mar 2012, Alexander Best wrote: > i have a question regarding a label for a swap partition. when should i do the > labeling? after or before creating the partition scheme? > > when i label before creating the partition scheme, likes this: > > glabel label -v swap /dev/da0 > gpart create -s GPT /dev/da0 > > i get the following warning: > > GEOM: da1: the secondary GPT header is not in the last LBA. > > which is obvious, because the label is being written into the last LBA and thus > the backup GPT header gets written into the last-1 LBA. Right. Don't do that, the GPT backup header needs to be at the end of the physical device. If you're using that whole disk for swap, there's no need for a partition anyway. > if i create the partitioning scheme before labeling the device, like this: > > gpart create -s GPT /dev/da0 > glabel label -v swap /dev/da0 > > or > > gpart create -s GPT /dev/da0 > gpart add -t freebsd-swap /dev/da0 > glabel label -v swap /dev/da0p1 > > the label gets written into da0 or da0p1 and is at constant risk of being > overwritten by userdata. No. The swap device entered in /etc/fstab would be /dev/label/swap, which is one block smaller than da0p1. That's the last-block metadata, it's safe. But if the whole disk is for swap, skip the partitioning entirely.