From owner-freebsd-fs@FreeBSD.ORG  Mon Oct 29 05:02:06 2012
Return-Path: <owner-freebsd-fs@FreeBSD.ORG>
Delivered-To: freebsd-fs@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
 by hub.freebsd.org (Postfix) with ESMTP id 1AFE6723;
 Mon, 29 Oct 2012 05:02:06 +0000 (UTC)
 (envelope-from lstewart@freebsd.org)
Received: from lauren.room52.net (lauren.room52.net [210.50.193.198])
 by mx1.freebsd.org (Postfix) with ESMTP id 747AE8FC08;
 Mon, 29 Oct 2012 05:02:05 +0000 (UTC)
Received: from lstewart.caia.swin.edu.au (lstewart.caia.swin.edu.au
 [136.186.229.95])
 by lauren.room52.net (Postfix) with ESMTPSA id B7CB97E918;
 Mon, 29 Oct 2012 15:55:27 +1100 (EST)
Message-ID: <508E0C3F.8080602@freebsd.org>
Date: Mon, 29 Oct 2012 15:55:27 +1100
From: Lawrence Stewart <lstewart@freebsd.org>
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64;
 rv:16.0) Gecko/20121016 Thunderbird/16.0.1
MIME-Version: 1.0
To: freebsd-fs@freebsd.org
Subject: graid often resyncs raid1 array after clean reboot/shutdown
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY
 autolearn=unavailable version=3.3.2
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net
Cc: mav@FreeBSD.org
X-BeenThere: freebsd-fs@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Filesystems <freebsd-fs.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-fs>,
 <mailto:freebsd-fs-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-fs>
List-Post: <mailto:freebsd-fs@freebsd.org>
List-Help: <mailto:freebsd-fs-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-fs>,
 <mailto:freebsd-fs-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Oct 2012 05:02:06 -0000

Hi all,

I have a fairly new HP Compaq 8200 Elite desktop PC with 2 x 1TB Seagate
ST1000DM003 HDDs in raid1 using the on-board Intel Matrix RAID
controller. The system is configured to boot from ZFS off the raid1
array, and I use it as a KDE GUI (with on-cpu GPU + KMS) desktop.

Everything works great, except that after a "shutdown -r now" of the
system, graid almost always (I believe I've noted a few times where
everything comes up fine) detects one of the disks in the array as stale
and does a full resync of the array over the course of a few hours.
Here's an example of what I see when starting up:

Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Array
Intel-76494d3c created.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Disk ada0
state changed from NONE to ACTIVE.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Subdisk
lstewart:0-ada0 state changed from NONE to STALE.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Disk ada1
state changed from NONE to ACTIVE.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Subdisk
lstewart:1-ada1 state changed from NONE to STALE.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Array started.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Subdisk
lstewart:0-ada0 state changed from STALE to ACTIVE.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Subdisk
lstewart:1-ada1 state changed from STALE to RESYNC.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Subdisk
lstewart:1-ada1 rebuild start at 0.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Volume
lstewart state changed from STARTING to SUBOPTIMAL.
Oct 29 15:50:20 lstewart kernel: GEOM_RAID: Intel-76494d3c: Provider
raid/r0 for volume lstewart created.

lstewart@lstewart> graid status
   Name      Status  Components
raid/r0  SUBOPTIMAL  ada0 (ACTIVE (ACTIVE))
                     ada1 (ACTIVE (RESYNC 1%))


There's no obvious reason why the disks should become out of sync after
a clean reboot from FreeBSD immediately back into FreeBSD, so I'd
appreciate some help in figuring out what the problem might be and
ideally how to stop the rebuilds from happening. I don't reboot my
desktop frequently, but it would be nice to avoid the lengthy re-syncs
each time I do.

Relevant details about the system are below. Let me know if other
information would be useful.

Cheers,
Lawrence

########################################

lstewart@lstewart> uname -a
FreeBSD lstewart 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #1 r241919M: Tue
Oct 23 17:54:40 EST 2012
root@lstewart:/usr/obj/usr/src/sys/LSTEWART-DESKTOP  amd64

########################################

ahci0@pci0:0:31:2:      class=0x010400 card=0x1495103c chip=0x28228086
rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801 SATA RAID Controller'
    class      = mass storage
    subclass   = RAID

########################################

lstewart@lstewart> graid status
   Name   Status  Components
raid/r0  OPTIMAL  ada0 (ACTIVE (ACTIVE))
                  ada1 (ACTIVE (ACTIVE))

########################################

lstewart@lstewart> graid list
Geom name: Intel-76494d3c
State: OPTIMAL
Metadata: Intel
Providers:
1. Name: raid/r0
   Mediasize: 1000202043392 (931G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r2w2e3
   Subdisks: ada0 (ACTIVE), ada1 (ACTIVE)
   Dirty: Yes
   State: OPTIMAL
   Strip: 65536
   Components: 2
   Transformation: RAID1
   RAIDLevel: RAID1
   Label: lstewart
Consumers:
1. Name: ada0
   Mediasize: 1000204886016 (931G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   ReadErrors: 0
   Subdisks: r0(lstewart):0@0
   State: ACTIVE (ACTIVE)
2. Name: ada1
   Mediasize: 1000204886016 (931G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   ReadErrors: 0
   Subdisks: r0(lstewart):1@0
   State: ACTIVE (ACTIVE)

########################################

lstewart@lstewart> gpart show
=>        34  1953519549  raid/r0  GPT  (931G)
          34           6           - free -  (3.0k)
          40         256        6  freebsd-boot  (128k)
         296        1752           - free -  (876k)
        2048      204800        1  efi  (100M)
      206848      262144        2  ms-reserved  (128M)
      468992   109850624        3  linux-data  (52G)
   110319616    33554432        4  freebsd-swap  (16G)
   143874048  1809641472        5  freebsd-zfs  (862G)
  1953515520        4063           - free -  (2M)


- The system is dual boot Win 7 (EFI) and FreeBSD (BIOS + gptzfsboot).
EFI booting is completely disabled in the BIOS so the system always
boots directly into FreeBSD when turned on.

########################################