From owner-freebsd-stable@freebsd.org Fri Dec 16 22:56:17 2016 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB1C4C839F2 for ; Fri, 16 Dec 2016 22:56:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73DE6CDF for ; Fri, 16 Dec 2016 22:56:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x241.google.com with SMTP id b123so4219419itb.2 for ; Fri, 16 Dec 2016 14:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=RJ8cxDdoJkj1oR/q9VXqSkpoDRom2M4hXY357cu57sg=; b=g7Tdxmn2qzGsPVSZJkcczqc84xnbidi2y6f0TLFZcK60ih1P8Nk0xVOo1+doKq3xMt 36hCtxAcNmSffh0/eP1tFBR7E0jUmkSQSaQ7wnl6Zhie6rTvJ7ThUa9gEzPmUmBMwaTE mX9a5MWQtBD33OUo/ts7biYktvNH8KiqJ6/ucWsY9WVdXnYBQYjJvJ8DAkQf3Bh1u9rS DTR5UJjf1ZdH0e19Sbw3MrP6BAM2er6Amq+nwp6hrTmh4LsDhsqrIHotmC06cch4UpJR g1cA6FlXxyBnDcYqeKX+cC53dBj3S3ZHBqLDiJwyBpMhE2vBCJ+xXQQBSyN9RLHJnMlu y8+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=RJ8cxDdoJkj1oR/q9VXqSkpoDRom2M4hXY357cu57sg=; b=K8sFTw1iN1idUE0973LjjDcWCCpF5qNUjHMV7ddzZRVZzxVhU5lhsbENVJURqwD7/+ RAnxZgKJsLM3ESrAVjY10jrkzt3etknthGpRZGuMb4hXSkUgZNh9bls387UjEz66m9N5 Z67d7uHRjDo1x8hRK92Dzjq0W0lMt9AbSeIYjVanSYEPgxLS3yB2OeDGoubj9GR39p0L 8kzKA7OMGOSUrDBQXko72dvpQkBZuLJUEXy75h2IZ/wJEqjQxGnoF7BnmRFvdgwNkDRk XqFvdZZl6q8vk/GLMB4fYafzIodPm2osirISPK1CDDWW0Jf7a18QXj1pE5e5fq3qbu+H RNPg== X-Gm-Message-State: AKaTC01HbOwUmrE6LJ37ry8UGior0KUgnkl+xkZP6MT8dD+geoshiGfs/7pCxzDAQ2tfRHLR1sfYbI6vgabf4Q== X-Received: by 10.36.61.207 with SMTP id n198mr5714772itn.60.1481928976516; Fri, 16 Dec 2016 14:56:16 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.22.135 with HTTP; Fri, 16 Dec 2016 14:56:16 -0800 (PST) X-Originating-IP: [156.39.10.46] In-Reply-To: <85F3F813-D821-439B-B700-DCE51C53E035@FreeBSD.org> References: <20161216173930.GD90401@zxy.spb.ru> <85F3F813-D821-439B-B700-DCE51C53E035@FreeBSD.org> From: Warner Losh Date: Fri, 16 Dec 2016 14:56:16 -0800 X-Google-Sender-Auth: KkY10SVby2NvfKetQh3YgYnGxnw Message-ID: Subject: Re: Upgrading boot from GPT(BIOS) to GPT(UEFI) To: Dimitry Andric Cc: Antony Uspensky , =?UTF-8?Q?Fernando_Herrero_Carr=C3=B3n?= , Eric van Gyzen , freebsd-stable , Slawa Olhovchenkov Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2016 22:56:17 -0000 On Fri, Dec 16, 2016 at 11:00 AM, Dimitry Andric wrote: > On 16 Dec 2016, at 18:53, Antony Uspensky wrote: >> >> On Fri, 16 Dec 2016, Eric van Gyzen wrote: >>> On 12/16/2016 11:39, Slawa Olhovchenkov wrote: >>>> On Fri, Dec 16, 2016 at 06:08:34PM +0100, Fernando Herrero Carr?n wrote: >>>>> Hi everyone, >>>>> >>>>> A few months ago I got myself a new box and I have been happily running >>>>> FreeBSD on it ever since. I noticed that the boot was not as fast as I had >>>>> expected and I've realized that, while my disk is GPT partitioned, the boot >>>>> process is still BIOS based: >>>>> >>>>> % gpart show >>>>> => 34 976773101 ada0 GPT (466G) >>>>> 34 6 - free - (3.0K) >>>>> 40 1024 1 freebsd-boot (512K) >>>>> 1064 984 - free - (492K) >>>>> 2048 67108864 2 freebsd-swap (32G) >>>>> 67110912 909662208 3 freebsd-zfs (434G) >>>>> 976773120 15 - free - (7.5K) > ... >> I would shrink ada0p1 down to 128K (size of gptzfsboot = 88K now) and place efi partition (~800K) on free space between new p1 and p2. No need to touch swap partition. > > Yes, this is almost exactly what I have done on a machine that was > originally installed with gptzfsboot on the first partition, which was > 512K. Since all the partitions on this SSD were aligned to 1M, I > reduced the size of the first partition to 224K, freeing up a hole of > exactly 800K for an EFI partition: > > => 40 976773088 ada0 GPT (466G) > 40 2008 - free - (1.0M) > 2048 448 1 freebsd-boot (224K) > 2496 1600 4 efi (800K) > 4096 33554432 2 freebsd-swap (16G) > 33558528 943214592 3 freebsd-zfs (450G) > 976773120 8 - free - (4.0K) > > Then I wrote the preformatted boot1.efifat image to it, using: gpart > bootcode -p /boot/boot1.efifat -i 4 ada0. You can also use dd of > course, but I prefer using gpart for these kinds of manipulations. > > This way, you can choose between booting in old school BIOS mode, or > UEFI mode. If the UEFI mode works flawlessly, you can always decide > later to dump the freebsd-boot partition, and use only an EFI partition. > > -Dimitry > > P.S.: The only thing that triggers my OCD here is that the EFI partition > has index 4, but is physically the second. But I can live with that, > until I finally delete the freebsd-boot partition. :) You likely want to carve out more like 50MB instead of 800k for UEFI partition. 800k is the minimum, but it also precludes many things you may need to do with UEFI applications down the line. Warner