From owner-freebsd-fs@freebsd.org Mon Apr 6 11:56:20 2020 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D43A2AD2F3 for ; Mon, 6 Apr 2020 11:56:20 +0000 (UTC) (envelope-from artem@artem.ru) Received: from smtp5.mail.ru (smtp5.mail.ru [94.100.179.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48wpsZ3mSYz3R66 for ; Mon, 6 Apr 2020 11:56:18 +0000 (UTC) (envelope-from artem@artem.ru) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject; bh=VOrFxbClHN1meTFg2L/4T08VHdMJlbj7RW4x6GZUcy8=; b=oUpWFw0hO197bK1iQEhbHBWp7J0A02Gp/irNY5bmU+bPO0MJbaLZz+H7qb7yqrK2CsrDqk4IarRMgY7GDhEo4kAIO7t3PeEk+J3e1CS8s92lc5PCIPSZZpy4k0jdV3e/8dNeNr6agemvQskxLaY95bxqQP2oL0X3+RxiGL2FaV8=; Received: by smtp5.mail.ru with esmtpa (envelope-from ) id 1jLQMR-00072B-6I; Mon, 06 Apr 2020 14:56:15 +0300 Subject: Re: gpart bootcode Operation not permitted To: Miroslav Lachman <000.fbsd@quip.cz>, freebsd-fs@freebsd.org References: <27955efa-01f2-88f6-6a28-d9d8a62dfa2a@artem.ru> <48ba23fa-13dc-4a74-579c-2028479f302a@quip.cz> <1605a04a-ad2c-5b2c-445f-fb8ccd7211d6@artem.ru> <159cf2f5-1898-019e-9f02-29750ff7fa7e@quip.cz> From: Artem Kuchin Message-ID: <07de3b0c-cf60-f061-f2dd-33597ff576fd@artem.ru> Date: Mon, 6 Apr 2020 14:56:03 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <159cf2f5-1898-019e-9f02-29750ff7fa7e@quip.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: 646B95376F6C166E X-77F55803: 0A44E481635329DB0E1AA8A03B392317D32E5E48865217365060145B739F5F5CB3409941E66BE95BF688BCB05C26794D00EEFFA3BE1FE418D4222F2BC55466BB2D5C35E11E7FD390B659AE49F45CE3A7 X-7FA49CB5: 0D63561A33F958A56A8221842B0B777F915DEF13E7C17871AB3F61A9443B25348941B15DA834481FA18204E546F3947C5B63D382EEF4D896F6B57BC7E64490618DEB871D839B7333395957E7521B51C2545D4CF71C94A83E9FA2833FD35BB23D27C277FBC8AE2E8B972D20C7389F068BA471835C12D1D977C4224003CC8364767815B9869FA544D8D32BA5DBAC0009BE9E8FC8737B5C22493BD8BFB0F436B6B276E601842F6C81A12EF20D2F80756B5F012D6517FE479FCD76E601842F6C81A127C277FBC8AE2E8BD5E8704C5CAD72113AA81AA40904B5D99449624AB7ADAF37CCFFBAE954C2DE44725E5C173C3A84C34B08FA16E56A400835872C767BF85DA2F004C906525384306FED454B719173D6462275124DF8B9C9DE2850DD75B2526BE5BFE6E7EFDEDCD789D4C264860C145E X-D57D3AED: Y8kq8+OzVozcFQziTi/Zi1xwo7H2ZNxGP5qz8aO2mjTJzjHGC4ogvVuzB3zfVUBtENeZ6b5av1fnCBE34JUDkWdM6QxE+Ga5d8voMtmXfSoScvtxS3Y8PJuf5RTkiCWD X-Mailru-Sender: 0E9E14D9EC491FBA79C5613A73A5E7B2A57F58173E705661E3B46E400B9082C839E2C803C56CC8A98A4382C47DA47812C77752E0C033A69E376A1339FE8876DF1FC4F5A70058821069EB1F849E6DBC830DA7A0AF5A3A8387 X-Mras: Ok X-Rspamd-Queue-Id: 48wpsZ3mSYz3R66 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=mail.ru header.s=mail2 header.b=oUpWFw0h; dmarc=none; spf=none (mx1.freebsd.org: domain of artem@artem.ru has no SPF policy when checking 94.100.179.24) smtp.mailfrom=artem@artem.ru X-Spamd-Result: default: False [-2.33 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[mail.ru:s=mail2]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[artem.ru]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[mail.ru:+]; RCPT_COUNT_TWO(0.00)[2]; R_SPF_NA(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; RCVD_IN_DNSWL_LOW(-0.10)[24.179.100.94.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:47764, ipnet:94.100.176.0/20, country:RU]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.06)[ipnet: 94.100.176.0/20(0.06), asn: 47764(0.24), country: RU(0.01)] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 11:56:20 -0000 03.04.2020 22:44, Miroslav Lachman пишет: > Artem Kuchin wrote on 2020/04/03 21:23: >> 03.04.2020 17:42, Miroslav Lachman пишет: >>> >>> I think you can use "gmirror stop" on boot partition, then "gmirror >>> clear" and then update both individual boot partitions by gpart. >>> >>> >> >> I am afraid to do it. Gmirror stops mirroring, okay. What what >> gmirror clear does? What metadata is cleared and what it is used for? >> >> How to restart mirroring after that and how to make sure that mirror >> is 100% complete? >> >> Is it possible to exclude only boot partition from mirroring? > > Of course that's what I am suggesting - just split up mirroring of > boot partition and keep mirroring on swap and root! > > Gmirror clear deletes the very last sector on the given partition > where metadata of gmirror are stored. It does not touch the data on > the partitions. You don't need to worry. > > You have 3 mirrors. They are visible in /dev/mirror or by command > "gmirror status": > boot > swap > root > > As the "man gmirror" shows: >      gmirror stop [-fv] name ... > > You can run: gmirror stop -v boot > > It stops only the "boot" mirror. swap and root are still mirrored. > > Then you can clear metadata on each provider: > > gmirror clear ada0p1 > gmirror clear ada1p1 > > Or you can use "gmirror destroy -v boot" istead of 3 command above. It > should stop the "boot" mirror and then clear metadata on both providers. > > The you will have / your system will use 2 independent boot > partitions: ada0p1 and ada1p1. > The machine should be able to boot from any of those 2 disks because > each of them has valid boot partitions / boot code. > > Gpart bootcode should work for them on each system upgrade. > > gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0 > gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1 > > Kind regards > Miroslav Lachman Hmm. tried what you wrote but it went a little different, failed to clear  and needed to use destroy anyway # gmirror stop -v boot Done. # gmirror status        Name    Status  Components mirror/swap  COMPLETE  ada0p2 (ACTIVE)                        ada1p2 (ACTIVE) mirror/root  COMPLETE  ada0p3 (ACTIVE)                        ada1p3 (ACTIVE) mirror/boot  COMPLETE  gpt/boot1 (ACTIVE)                        gpt/boot0 (ACTIVE) # gmirror clear ada0p1 Can't clear metadata on ada0p1: Operation not permitted. gmirror: Not fully done. # gmirror clear ada1p1 Can't clear metadata on ada1p1: Operation not permitted. gmirror: Not fully done. # gmirror destroy -v boot Done. # gmirror status        Name    Status  Components mirror/swap  COMPLETE  ada0p2 (ACTIVE)                        ada1p2 (ACTIVE) mirror/root  COMPLETE  ada0p3 (ACTIVE)                        ada1p3 (ACTIVE) # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0 partcode written to ada0p1 bootcode written to ada0 # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1 partcode written to ada1p1 bootcode written to ada1 Now it can boot from any disk. Thank you. Artem