From owner-freebsd-cloud@freebsd.org Tue Sep 22 00:01:14 2020 Return-Path: Delivered-To: freebsd-cloud@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 57A24422781 for ; Tue, 22 Sep 2020 00:01:14 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (chez.mckusick.com [70.36.157.235]) (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 4BwM0T2ctLz48BK for ; Tue, 22 Sep 2020 00:01:13 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (localhost [IPv6:::1]) by chez.mckusick.com (8.15.2/8.15.2) with ESMTP id 08M02YQ3054819; Mon, 21 Sep 2020 17:02:34 -0700 (PDT) (envelope-from mckusick@mckusick.com) Message-Id: <202009220002.08M02YQ3054819@chez.mckusick.com> From: Kirk McKusick To: Colin Percival Subject: Re: Fwd: filesystem checksum problems on AWS EC2 instances cc: ericr , freebsd-cloud@freebsd.org X-URL: http://WWW.McKusick.COM/ Reply-To: Kirk McKusick In-reply-to: <01000174b15f88a5-8de101fb-8f1b-4adb-bd7e-3c752bf86d61-000000@email.amazonses.com> Comments: In-reply-to Colin Percival message dated "Mon, 21 Sep 2020 15:54:22 -0000." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <54817.1600732954.1@chez.mckusick.com> Content-Transfer-Encoding: quoted-printable Date: Mon, 21 Sep 2020 17:02:34 -0700 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,MISSING_MID, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on chez.mckusick.com X-Rspamd-Queue-Id: 4BwM0T2ctLz48BK X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of mckusick@mckusick.com has no SPF policy when checking 70.36.157.235) smtp.mailfrom=mckusick@mckusick.com X-Spamd-Result: default: False [-0.27 / 15.00]; HAS_REPLYTO(0.00)[mckusick@mckusick.com]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FREEFALL_USER(0.00)[mckusick]; NEURAL_HAM_LONG(-0.97)[-0.966]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[mckusick.com]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.40)[0.404]; AUTH_NA(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.61)[-0.606]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:46375, ipnet:70.36.128.0/19, country:US]; FREEMAIL_CC(0.00)[gmail.com,freebsd.org]; MAILMAN_DEST(0.00)[freebsd-cloud]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-cloud@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "FreeBSD on cloud platforms \(EC2, GCE, Azure, etc.\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Sep 2020 00:01:14 -0000 > Date: Fri, 18 Sep 2020 20:00:49 -0700 > From: Colin Percival > Subject: Re: filesystem checksum problems on AWS EC2 instances > To: ericr , freebsd-cloud@freebsd.org, > Kirk McKusick > = > [Adding Kirk since this seems like a UFS issue...] > = > On 2020-09-16 15:15, ericr wrote: >> On Tue, Sep 15, 2020 at 6:24 PM Colin Percival w= rote: >>> On 2020-09-15 14:30, ericr wrote: >>>> Sep 1 20:50:15 freebsd kernel: UFS /dev/gpt/rootfs (/) >>>> cylinder checksum failed: cg 0, cgp: 0x9c14700e !=3D bp: 0x27bfa3d0 >>>> Sep 1 20:50:15 freebsd syslogd: last message repeated 1 >>> times >>>> Sep 1 20:50:15 freebsd kernel: UFS /dev/gpt/rootfs (/) >>>> cylinder checksum failed: cg 7, cgp: 0x43ed3fa1 !=3D bp: 0xe9b0182e >>>> >>>> and from there on, I get cylinder checksum errors pretty often. >>> >>> Do you get this if you launch from the non-Marketplace AMIs listed in = the >>> release announcement? >>> https://www.freebsd.org/releases/12.1R/announce.html >> = >> = >> Yes. I just tried both of these AMI's from the release notes: >> us-east-1 region: ami-0de268ac2498ba33d >> us-east-2 region: ami-0a44f10b2c6deb365 >> = >> I got the same errors. > = > I've managed to reproduce this, with a filesystem which I've > verified is clean (at least, which passes fsck) before resizing > up to ~ 200 GB: > = >> root@freebsd:/usr/home/ec2-user # fsck_ufs /dev/nvd1p2 = >> ** /dev/nvd1p2 >> ** Last Mounted on /releng/12-amd64-GENERIC-release/usr/obj/usr/src/amd= 64.amd64/release/cw-ec2/new >> ** Phase 1 - Check Blocks and Sizes >> ** Phase 2 - Check Pathnames >> ** Phase 3 - Check Connectivity >> ** Phase 4 - Check Reference Counts >> ** Phase 5 - Check Cyl groups >> 25701 files, 758977 used, 229774 free (9654 frags, 27515 blocks, 1.0% f= ragmentation) >> = >> ***** FILE SYSTEM IS CLEAN ***** >> root@freebsd:/usr/home/ec2-user # gpart recover /dev/nvd1 >> nvd1 recovered >> root@freebsd:/usr/home/ec2-user # gpart resize -i 2 /dev/nvd1 >> nvd1p2 resized >> root@freebsd:/usr/home/ec2-user # growfs -y /dev/nvd1p2 >> super-block backups (for fsck_ffs -b #) at: >> [snip] >> root@freebsd:/usr/home/ec2-user # fsck_ufs /dev/nvd1p2 >> ** /dev/nvd1p2 >> ** Last Mounted on = >> ** Phase 1 - Check Blocks and Sizes >> ** Phase 2 - Check Pathnames >> ** Phase 3 - Check Connectivity >> ** Phase 4 - Check Reference Counts >> ** Phase 5 - Check Cyl groups >> CG 0: BAD CHECK-HASH 0x9c14700e vs 0xc9441f74 >> SUMMARY INFORMATION BAD >> SALVAGE? [yn] n >> = >> CG 7: BAD CHECK-HASH 0xad168305 vs 0x74ba48a >> 25701 files, 758977 used, 50019285 free (9661 frags, 6251203 blocks, 0.= 0% fragmentation) >> = >> ***** FILE SYSTEM MARKED DIRTY ***** >> = >> ***** PLEASE RERUN FSCK ***** > = > This seems like a bug in UFS and/or growfs, but I'm not familiar enough > with either to say any more. > = > Kirk, are you aware of any issues on FreeBSD 12.1-RELEASE which can caus= e > cylinder checksum errors after growfs? (On amd64 if it matters.) If it > would help I can provide you with SSH access to an affected EC2 instance= . > = > -- = > Colin Percival > Security Officer Emeritus, FreeBSD | The power to serve > Founder, Tarsnap | www.tarsnap.com | Online backups for the truly parano= id I have managed to reproduce a similar problem in one of my rather ancient 12.0 bhyve images that I have lying around: FreeBSD 12.0-STABLE (GENERIC) #5 r350458M: Sat Oct 26 21:18:51 UTC 2019 The follow patch fixes it in that instance. Could you please try this in the EC2 instance and see if it also resolves your problem. Kirk McKusick =3D-=3D-=3D Index: sbin/growfs/growfs.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sbin/growfs/growfs.c (revision 365971) +++ sbin/growfs/growfs.c (working copy) @@ -572,6 +572,7 @@ updjcg(int cylno, time_t modtime, int fsi, int fso if (sblock.fs_magic =3D=3D FS_UFS1_MAGIC) acg.cg_old_ncyl =3D sblock.fs_old_cpg; = + cgckhash(&acg); wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); DBG_PRINT0("jcg written\n"); @@ -947,6 +948,7 @@ updcsloc(time_t modtime, int fsi, int fso, unsigne * Now write the former cylinder group containing the cylinder * summary back to disk. */ + cgckhash(&acg); wtfs(fsbtodb(&sblock, cgtod(&sblock, ocscg)), (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); DBG_PRINT0("oscg written\n"); @@ -1039,6 +1041,7 @@ updcsloc(time_t modtime, int fsi, int fso, unsigne * Write the new cylinder group containing the cylinder summary * back to disk. */ + cgckhash(&acg); wtfs(fsbtodb(&sblock, cgtod(&sblock, ncscg)), (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); DBG_PRINT0("nscg written\n");