Received: from list by lists.gnu.org with archive (Exim 4.71) id 1c7n0w-0000Rh-IU for mharc-grub-devel@gnu.org; Fri, 18 Nov 2016 12:31:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7n0r-0000Pc-UY for grub-devel@gnu.org; Fri, 18 Nov 2016 12:31:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7n0o-0007jK-O5 for grub-devel@gnu.org; Fri, 18 Nov 2016 12:31:45 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35892) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c7n0o-0007ic-Da for grub-devel@gnu.org; Fri, 18 Nov 2016 12:31:42 -0500 Received: by mail-wm0-x243.google.com with SMTP id m203so8317769wma.3 for ; Fri, 18 Nov 2016 09:31:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=3pgv77rbSEFv5OR4e/zfVRZkWxurYV/PMja9b9bA5z4=; b=uX36r8BZ4+AKVKr1zEQV0PgMYhSd68Qmwj5TvOZDK9tpIL1WryvfhlRnuDyOF6oX81 GdiOPIV0YHmo2ZDIt3CvMkvnFN8oZKUQ4Z3fnomrkHQtCaKiyP4wrmBLzyp9RMkXnfhX fyPKrAir7GB9ZPScQjz1MLH7dWaskZQinzmS6NcJMNsjZrHC+Pmd1YAoCm4QqfMOBMEb +lYcqZkWNJqKvDz4C1wwHz+Rite1ltb6/4nEKkj0jBRwS7VPBb4gYLVkJyyyGJ4FKifJ 1ZA0fqP6d5QvrJTUwPr22sh0jZEOLmSQO3XIWzh3eO2HM/pSai0AEAsR3zBmFkuJiR28 ofVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=3pgv77rbSEFv5OR4e/zfVRZkWxurYV/PMja9b9bA5z4=; b=NmWeuGlcdRPSGpik7DW5hZdOBVcMvS1F10ZYoR02gyPUDWeaQrKsFM6DVsS+BbNtDD vzv+rjsqxpcCn9qJGvgYKIB7yo3ZMlNacqVqHD1ZGo/mAASY0MerZ/xWHjdtFoaJQ/rr ottnaVc4Jto4OpRvRBPmYmyKnotDbPPMWoOqAmy0LTa1qEO5I1e52c5QondFaVJLVr/g eKZHyV1Q5+o75fTyau9pQmNt5rAnRfp861cg+Gr2Eb/oHRrbH7H0s3pgIgD6nX648Fc/ om0e2kpTuzZBWZwmxw6Wi7rw8zvcC9B/IFlIU+FCTmVEBLassZpJUz3BirWz7WPLxCSe 1CTw== X-Gm-Message-State: AKaTC03gRrJnmrL/69izHtlBIBaPQuBewKPWR5CEXka2hxsyl2w9n5vENj4TvDOV8sxkXg== X-Received: by 10.46.9.5 with SMTP id 5mr524401ljj.23.1479490299765; Fri, 18 Nov 2016 09:31:39 -0800 (PST) Received: from [192.168.1.44] (ppp109-252-90-55.pppoe.spdop.ru. [109.252.90.55]) by smtp.gmail.com with ESMTPSA id g84sm2511663ljg.31.2016.11.18.09.31.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Nov 2016 09:31:39 -0800 (PST) Subject: Re: [PATCH] disk/mdraid1x: Fix >2TB RAID detection with BIOS To: Robert LeBlanc References: <20161117200907.18342-1-robert@leblancnet.us> Cc: The development of GNU GRUB From: Andrei Borzenkov Message-ID: <3d20e6ef-8c14-fea3-84a7-96b28c648fef@gmail.com> Date: Fri, 18 Nov 2016 20:31:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2016 17:31:49 -0000 18.11.2016 19:49, Robert LeBlanc пишет: > Based on debug info, GRUB is requesting to read the end of the drive > to read the mdadm 1.0 superblock and gets the following message: > > kern/disk.c:421: Read out of range: sector 0x27fffffc8 (attempt to > read or write outside of disk 'hd0'). > Is MD RAID on whole disk or partition? What partition label - MBR or GPT? Could you post fdisk -l from Linux (if your fdisk does not support GPT, use "gdisk -l /dev/sdX")? > My understanding is that BIOS can only access 2TB of disk so this > makes sense. This patch turns this error from fatal in detecting mdadm > RAID arrays into a non-critical error so that other versions of > metadata can still be checked. Where I was running into the problem > was that we have a 5TB disk with mdadm metadata version 1.2 and we > could not get the md/0 to show up in GRUB because after the error, it > never tried to check the other mdadm metadata versions. Once this > patch was in place, the md/0 showed up and we were able to boot the > box because /boot on the mdadm RAID was below the 2TB BIOS limit. > > mdadm metadata 1.0 superblock is located 8-12KB from the end of the disk > mdadm metadata 1.1 superblock is located at sector 0 of the disk/partition > mdadm metadata 1.2 superblock is located at sector 8 of the disk/partition > > The loop was > for i=0; i<3; i++{ > check for the metadata > if error { > return NULL > } > return superblock info > } > > So if an error occurs when checking one type of metadata, it does not > try the other types to see if they exist. This patch fixes that. > > I hope that clears things up, let me know if you have additional questions. > ---------------- > Robert LeBlanc > PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1 > > > On Thu, Nov 17, 2016 at 9:16 PM, Andrei Borzenkov wrote: >> 17.11.2016 23:09, Robert LeBlanc пишет: >>> When a mdadm RAID array is on a drive larger than 2TB, the array is not >>> able to be detected and as such even if the array has a partition that >>> holds /boot under the 2TB limit, it is unable to boot the machine. This >>> is caused by metadata 1.0 being tested first which allocates the >>> superblock at the end of the device. When it tries to access the end of >>> the device it throws an error and the code returns without trying to >> >> Why read returns error here and how it is related to device size? >> >>> find the superblock at other locations (metadata 1.1 and 1.2). This >>> patch changes the error to not be fatal and allow for the checking for >>> the other metadata versions and allowing the machine to boot as long as >>> /boot is under the 2TB BIOS limit. This won't cause issues with 1.0 >>> metadata because GRUB is able to read the partitions from the front of >>> the drive/partition without having to determine the data offset, since >>> the data for metadata 1.0 starts at sector 0. >>> >>> Signed-off-by: Robert LeBlanc >>> --- >>> grub-core/disk/mdraid1x_linux.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/grub-core/disk/mdraid1x_linux.c b/grub-core/disk/mdraid1x_linux.c >>> index 7cc80d3..cc7350c 100644 >>> --- a/grub-core/disk/mdraid1x_linux.c >>> +++ b/grub-core/disk/mdraid1x_linux.c >>> @@ -148,7 +148,7 @@ grub_mdraid_detect (grub_disk_t disk, >>> >>> if (grub_disk_read (disk, sector, 0, sizeof (struct grub_raid_super_1x), >>> &sb)) >>> - return NULL; >>> + continue; >>> >>> if (sb.magic != grub_cpu_to_le32_compile_time (SB_MAGIC) >>> || grub_le_to_cpu64 (sb.super_offset) != sector) >>> >>