disk/mdraid1x: Fix >2TB RAID detection with BIOS
PATCH 1/1 disk/mdraid1x: Fix >2TB RAID detection with BIOS
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 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.
--- grub-core/disk/mdraid1x_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/disk/mdraid1x_linux.c +1 -1
@@ -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)
Signature · 1 line
2.10.1
17.11.2016 23:09, Robert LeBlanc пишет:
Quoted 6 lines
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?
Quoted 27 lines
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 <[email protected]>--- grub-core/disk/mdraid1x_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/disk/mdraid1x_linux.c +1
-1@@ -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)
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').
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
Quoted 38 lines · Andrei Borzenkov
17.11.2016 23:09, Robert LeBlanc пишет:
Quoted 6 lines
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?
Quoted 27 lines
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 <[email protected]>--- grub-core/disk/mdraid1x_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/disk/mdraid1x_linux.c +1
-1@@ -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)
18.11.2016 19:49, Robert LeBlanc пишет:
Quoted 6 lines
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: sector0x27fffffc8(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")?
Quoted 71 lines
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 B9F1Quoted 38 lines · Andrei Borzenkov
17.11.2016 23:09, Robert LeBlanc пишет:
Quoted 6 lines
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?
Quoted 27 lines
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 <[email protected]>--- grub-core/disk/mdraid1x_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/disk/mdraid1x_linux.c +1
-1@@ -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)
Quoted 11 lines · Andrei Borzenkov
18.11.2016 19:49, Robert LeBlanc пишет:
Quoted 6 lines
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: sector0x27fffffc8(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")?
# gdisk -l /dev/sda GPT fdisk (gdisk) version 1.0.1
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 10737418240 sectors, 5.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 939F7AAD-AADD-481D-8896-DA0B4033C70C Partition table holds up to 128 entries
First usable sector is 2048, last usable sector is 10737418206 Partitions will be aligned on 2048-sector boundaries Total free space is 0 sectors (0 bytes)
Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 2 4096 10737418206 5.0 TiB FD00
partition # is a mdadm RAID 1 member partitioned as follows...
# sgdisk -l /dev/md123 # parted /dev/md123 print free Model: Linux Software RAID Array (md) Disk /dev/md123: 5497GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
1 1049kB 2097kB 1049kB bios_grub
2 2097kB 5371MB 5369MB linux-swap(v1)
3 5371MB 6371MB 1000MB ext2
4 6371MB 5497GB 5491GB ext4
5497GB 5497GB 966kB Free Space/dev/sdb is partitioned identically to /dev/sda
Quoted 68 lines
Quoted 68 lines
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 B9F1Quoted 34 lines · Andrei Borzenkov
17.11.2016 23:09, Robert LeBlanc пишет:
Quoted 6 lines
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?
Quoted 24 lines
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 <[email protected]>--- grub-core/disk/mdraid1x_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/disk/mdraid1x_linux.c +1
-1@@ -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 ;
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
grub-core/disk/mdraid1x_linux.c grub_mdraid_detect (grub_disk_t disk, · line 154
Quoted 3 lines
grub-core/disk/mdraid1x_linux.c +0
-0if (sb.magic !=grub_cpu_to_le32_compile_time (SB_MAGIC ) ||grub_le_to_cpu64 (sb.super_offset) != sector)
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1
18.11.2016 21:06, Robert LeBlanc пишет:
Quoted 46 lines · Andrei Borzenkov
Quoted 11 lines
18.11.2016 19:49, Robert LeBlanc пишет:
Quoted 6 lines
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: sector0x27fffffc8(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")?# gdisk -l /dev/sda GPT fdisk (gdisk) version 1.0.1Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: presentFound valid GPT with protective MBR; using GPT.
Disk/dev/sda: 10737418240 sectors, 5.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 939F7AAD-AADD-481D-8896-DA0B4033C70C Partition table holds up to 128 entries
First usable sector is 2048, last usable sector is 10737418206 Partitions will be aligned on 2048-sector boundaries Total free space is 0 sectors (0 bytes)Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 2 4096 10737418206 5.0 TiB FD00partition # is a mdadm RAID 1 member partitioned as follows...
# sgdisk -l /dev/md123 # parted /dev/md123 print free Model: Linux Software RAID Array (md) Disk /dev/md123: 5497GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:Number Start End Size File system Name Flags
Quoted 9 lines
17.4kB 1049kB 1031kB Free Space 1 1049kB 2097kB 1049kB bios_grub 2 2097kB 5371MB 5369MB linux-swap(v1) 3 5371MB 6371MB 1000MB ext2 4 6371MB 5497GB 5491GB ext4 5497GB 5497GB 966kB Free Space
/dev/sdbis partitioned identically to/dev/sda
OK, could you please also show "ls -l" in grub CLI; if you cannot capture serial console, attach screenshot(s). You may want to "set pager=1" so output does not scroll off screen.
Do you want this with or without my patch?
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1
Quoted 62 lines · Andrei Borzenkov
18.11.2016 21:06, Robert LeBlanc пишет:
Quoted 46 lines · Andrei Borzenkov
Quoted 11 lines
18.11.2016 19:49, Robert LeBlanc пишет:
Quoted 6 lines
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: sector0x27fffffc8(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")?# gdisk -l /dev/sda GPT fdisk (gdisk) version 1.0.1Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: presentFound valid GPT with protective MBR; using GPT.
Disk/dev/sda: 10737418240 sectors, 5.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 939F7AAD-AADD-481D-8896-DA0B4033C70C Partition table holds up to 128 entries
First usable sector is 2048, last usable sector is 10737418206 Partitions will be aligned on 2048-sector boundaries Total free space is 0 sectors (0 bytes)Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 2 4096 10737418206 5.0 TiB FD00partition # is a mdadm RAID 1 member partitioned as follows...
# sgdisk -l /dev/md123 # parted /dev/md123 print free Model: Linux Software RAID Array (md) Disk /dev/md123: 5497GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:Number Start End Size File system Name Flags
Quoted 9 lines
17.4kB 1049kB 1031kB Free Space 1 1049kB 2097kB 1049kB bios_grub 2 2097kB 5371MB 5369MB linux-swap(v1) 3 5371MB 6371MB 1000MB ext2 4 6371MB 5497GB 5491GB ext4 5497GB 5497GB 966kB Free Space
/dev/sdbis partitioned identically to/dev/sdaOK, could you please also show "ls -l" in grub CLI; if you cannot capture serial console, attach screenshot(s). You may want to "set pager=1" so output does not scroll off screen.
18.11.2016 21:19, Robert LeBlanc пишет:
Quoted 1 line
Do you want this with or without my patch?
It does not matter, I want to see what grub thinks about physical disks and their partitions.
Quoted 68 lines
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1Quoted 62 lines · Andrei Borzenkov
18.11.2016 21:06, Robert LeBlanc пишет:
Quoted 46 lines · Andrei Borzenkov
Quoted 11 lines
18.11.2016 19:49, Robert LeBlanc пишет:
Quoted 6 lines
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: sector0x27fffffc8(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")?# gdisk -l /dev/sda GPT fdisk (gdisk) version 1.0.1Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: presentFound valid GPT with protective MBR; using GPT.
Disk/dev/sda: 10737418240 sectors, 5.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 939F7AAD-AADD-481D-8896-DA0B4033C70C Partition table holds up to 128 entries
First usable sector is 2048, last usable sector is 10737418206 Partitions will be aligned on 2048-sector boundaries Total free space is 0 sectors (0 bytes)Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 2 4096 10737418206 5.0 TiB FD00partition # is a mdadm RAID 1 member partitioned as follows...
# sgdisk -l /dev/md123 # parted /dev/md123 print free Model: Linux Software RAID Array (md) Disk /dev/md123: 5497GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:Number Start End Size File system Name Flags
Quoted 9 lines
17.4kB 1049kB 1031kB Free Space 1 1049kB 2097kB 1049kB bios_grub 2 2097kB 5371MB 5369MB linux-swap(v1) 3 5371MB 6371MB 1000MB ext2 4 6371MB 5497GB 5491GB ext4 5497GB 5497GB 966kB Free Space
/dev/sdbis partitioned identically to/dev/sdaOK, could you please also show "ls -l" in grub CLI; if you cannot capture serial console, attach screenshot(s). You may want to "set pager=1" so output does not scroll off screen.
I could not get GRUB rescue to use the serial console so I'm attaching a screenshot for the unpatched version of GRUB.
Here is the patched version of GRUB
GNU GRUB version 2.02~beta3
Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions. ESC at any time exits.
grub> ls -l
Device hd0: No known filesystem detected - Sector size 512B - Total size 2147483648KiB
Partition hd0,gpt2: No known filesystem detected - Partition start at
2048KiB - Total size 5368707055.5KiB
Partition hd0,gpt1: No known filesystem detected - Partition start at
1024KiB - Total size 1024KiB
Device md/123: No known filesystem detected - Sector size 512B - Total size 5368575936KiB
Partition md/123,gpt4: Filesystem type ext* - Last modification time
2016-11-18 20:00:50 Friday, UUID dd584910-dab0-4d06-b768-9e7d8edf83ed -
Partition start at 6221824KiB - Total size 5362353152KiB
Partition md/123,gpt3: Filesystem type ext* - Last modification time
2016-11-18 20:05:14 Friday, UUID 9e5fd3bf-cd08-4086-8d9e-73ac278e4a4c -Partition start at 5244928KiB - Total size 976896KiB
Partition md/123,gpt2: No known filesystem detected - Partition start
at 2048KiB - Total size 5242880KiB
Partition md/123,gpt1: No known filesystem detected - Partition start
at 1024KiB - Total size 1024KiB
grub>
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1
Quoted 75 lines · Andrei Borzenkov
18.11.2016 21:19, Robert LeBlanc пишет:
Quoted 1 line
Do you want this with or without my patch?
It does not matter, I want to see what grub thinks about physical disks and their partitions.
Quoted 68 lines
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1Quoted 62 lines · Andrei Borzenkov
18.11.2016 21:06, Robert LeBlanc пишет:
Quoted 46 lines · Andrei Borzenkov
Quoted 11 lines
18.11.2016 19:49, Robert LeBlanc пишет:
Quoted 6 lines
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: sector0x27fffffc8(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")?# gdisk -l /dev/sda GPT fdisk (gdisk) version 1.0.1Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: presentFound valid GPT with protective MBR; using GPT.
Disk/dev/sda: 10737418240 sectors, 5.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 939F7AAD-AADD-481D-8896-DA0B4033C70C Partition table holds up to 128 entries
First usable sector is 2048, last usable sector is 10737418206 Partitions will be aligned on 2048-sector boundaries Total free space is 0 sectors (0 bytes)Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 2 4096 10737418206 5.0 TiB FD00partition # is a mdadm RAID 1 member partitioned as follows...
# sgdisk -l /dev/md123 # parted /dev/md123 print free Model: Linux Software RAID Array (md) Disk /dev/md123: 5497GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:Number Start End Size File system Name Flags
Quoted 9 lines
17.4kB 1049kB 1031kB Free Space 1 1049kB 2097kB 1049kB bios_grub 2 2097kB 5371MB 5369MB linux-swap(v1) 3 5371MB 6371MB 1000MB ext2 4 6371MB 5497GB 5491GB ext4 5497GB 5497GB 966kB Free Space
/dev/sdbis partitioned identically to/dev/sdaOK, could you please also show "ls -l" in grub CLI; if you cannot capture serial console, attach screenshot(s). You may want to "set pager=1" so output does not scroll off screen.
18.11.2016 23:43, Robert LeBlanc пишет:
Quoted 8 lines
grub> ls -l
Device hd0: No known filesystem detected - Sector size 512B - Total size 2147483648KiB
Partition hd0,gpt2: No known filesystem detected - Partition start at
2048KiB - Total size 5368707055.5KiB
Partition hd0,gpt1: No known filesystem detected - Partition start at
1024KiB - Total size 1024KiB
Oh. Could you please run attached patch on top of pure GIT (without your patch) and send me output. It adds some debug print to biosdisk driver so we can try to guess what happens. After building, generate minimal image to avoid too much output
bor@bor-Latitude-E5450:~/build/grub$ echo "set debug=biosdisk" > /tmp/load.cfg bor@bor-Latitude-E5450:~/build/grub$ pkgdatadir=$PWD ./grub-mkimage -O i386-pc -d grub-core -o grub.img -p "(md/xxx)/" -c /tmp/load.cfg biosdisk mdraid1x
Actual array name is irrelevant and is there simply to force raid scan. After that copy it to /boot, go to GRUB CLI and run
multiboot /boot/grub.img
boot
From: Andrei Borzenkov <[email protected]>
Subject: [PATCH] biosdisk: debug output for disk parameters
Add debug output to track BIOS behavior with 4Kn disks.
--- grub-core/disk/i386/pc/biosdisk.c | 45 +++++++++++++++++++++++++++++++++++---- include/grub/i386/pc/biosdisk.h | 1 + 2 files changed, 42 insertions(+), 4 deletions(-)
grub-core/disk/i386/pc/biosdisk.c +41 -4
@@ -84,6 +84,8 @@ grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap)grub_bios_interrupt (0x13 , ®s);return (regs.eax >>8 ) &0xff ; +// return regs.flags & GRUB_CPU_INT_FLAGS_CARRY ? (regs.eax >> 8) & 0xff : 0; + }/*
@@ -335,6 +337,7 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)grub_uint64_t total_sectors =0 ;int drive;struct grub_biosdisk_data *data; +int ret; drive =grub_biosdisk_get_drive (name);if (drive <0 )
@@ -369,11 +372,17 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)struct grub_biosdisk_drp *drp = (struct grub_biosdisk_drp *)GRUB_MEMORY_MACHINE_SCRATCH_ADDR ; +grub_dprintf ("biosdisk" ,"%s: int13 version=%u\n" , disk->name, version);/* Clear out the DRP. */ grub_memset (drp,0 ,sizeof (*drp)); drp->size =sizeof (*drp); -if (!grub_biosdisk_get_diskinfo_int13_extensions (drive, drp)) +if (! (ret =grub_biosdisk_get_diskinfo_int13_extensions (drive, drp))) { +grub_dprintf ("biosdisk" ,"%s: DRP size=%u flags=%x c=%u h=%u s=%u t=%" + PRIuGRUB_UINT64_T" bpi=%u\n" , + disk->name, drp->size, drp->flags, drp->cylinders, drp->heads, + drp->sectors, drp->total_sectors, drp->bytes_per_sector); + data->flags =GRUB_BIOSDISK_FLAG_LBA ;if (drp->total_sectors)
@@ -394,16 +403,22 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) disk->log_sector_size++); } } +else +grub_dprintf ("biosdisk" ,"%s: int13 get ext failed %x\n" , disk->name, ret); } +else +grub_dprintf ("biosdisk" ,"%s: int13 check ext failed\n" , disk->name); }if (! (data->flags &GRUB_BIOSDISK_FLAG_CDROM )) { -if (grub_biosdisk_get_diskinfo_standard (drive, +if ((ret =grub_biosdisk_get_diskinfo_standard (drive, &data->cylinders, &data->heads, - &data->sectors) !=0 ) + &data->sectors)) !=0 ) { +grub_dprintf ("biosdisk" ,"%s: get_diskinfo failed %x\n" , disk->name, ret); +if (total_sectors && (data->flags &GRUB_BIOSDISK_FLAG_LBA )) { data->sectors =63 ;
@@ -419,6 +434,9 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)return grub_error (GRUB_ERR_BAD_DEVICE ,"%s cannot get C/H/S values" , disk->name); } } +else +grub_dprintf ("biosdisk" ,"%s: C/H/S=%lu/%lu/%lu\n" , disk->name, + data->cylinders, data->heads, data->sectors);if (data->sectors ==0 ) data->sectors =63 ;
@@ -461,6 +479,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, unsigned segment) {struct grub_biosdisk_data *data = disk->data; +int ret;/* VirtualBox fails with sectors above 2T on CDs. Since even BD-ROMS are never that big anyway, return error. */
@@ -501,19 +520,37 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, disk->name); }else -if (grub_biosdisk_rw_int13_extensions (cmd +0x42 , data->drive, dap)) +if ((ret =grub_biosdisk_rw_int13_extensions (cmd +0x42 , data->drive, dap))) { +grub_dprintf ("biosdisk" ,"%s: ext sec=%" PRIuGRUB_UINT64_T" size=%" + PRIuGRUB_SIZE" ret=%u\n" , + disk->name, sector, size, ret); +/* Fall back to the CHS mode. */ data->flags &= ~GRUB_BIOSDISK_FLAG_LBA ; disk->total_sectors = data->cylinders * data->heads * data->sectors;return grub_biosdisk_rw (cmd, disk, sector, size, segment); } +else if (!(data->flags &GRUB_BIOSDISK_FLAG_DPRINT )) + { +grub_dprintf ("biosdisk" ,"%s: ext sec=%" PRIuGRUB_UINT64_T" size=%" + PRIuGRUB_SIZE"\n" , + disk->name, sector, size); + data->flags |=GRUB_BIOSDISK_FLAG_DPRINT ; + } }else {unsigned coff, hoff, soff;unsigned head; +if (!(data->flags &GRUB_BIOSDISK_FLAG_DPRINT )) + { +grub_dprintf ("biosdisk" ,"%s: legacy sec=%" PRIuGRUB_UINT64_T" size=%" + PRIuGRUB_SIZE"\n" , + disk->name, sector, size); + data->flags |=GRUB_BIOSDISK_FLAG_DPRINT ; + }/* It is impossible to reach over 8064 MiB (a bit less than LBA24) with the traditional CHS access. */ if (sector >
include/grub/i386/pc/biosdisk.h +1 -0
@@ -24,6 +24,7 @@#define GRUB_BIOSDISK_FLAG_LBA 1#define GRUB_BIOSDISK_FLAG_CDROM 2 +#define GRUB_BIOSDISK_FLAG_DPRINT 4#define GRUB_BIOSDISK_CDTYPE_NO_EMUL 0#define GRUB_BIOSDISK_CDTYPE_1_2_M 1
Signature · 1 line
tg: (0d663b5..) t/biosdisk (depends on: master)
Quoted 1 line · Andrei Borzenkov
biosdisk mdraid1x
Here is the screenshot of the output.
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1
19.11.2016 20:57, Robert LeBlanc пишет:
Quoted 5 lines · Andrei Borzenkov
Quoted 1 line
biosdisk mdraid1x
Here is the screenshot of the output.
So it does not even mask LBA to 32 bit, it really returns 2TB. What system (motherboard) is it? What is disk controller? How drives are connected (directly to motherboard or some external adapter)?
This is on super micro and KVM. You can replicate it on a VM.
Sent from a mobile device, please excuse any typos.
Quoted 13 lines · Andrei Borzenkov
19.11.2016 20:57, Robert LeBlanc пишет:
Quoted 1 line
On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <[email protected]>
Quoted 4 lines · wrote:
Quoted 1 line
biosdisk mdraid1x
Here is the screenshot of the output.
So it does not even mask LBA to 32 bit, it really returns 2TB. What system (motherboard) is it? What is disk controller? How drives are connected (directly to motherboard or some external adapter)?
The super micro is iSCSI boot off Intel adapters. KVM is SCSI disks.
Sent from a mobile device, please excuse any typos.
Quoted 20 lines · Robert LeBlanc
This is on super micro and KVM. You can replicate it on a VM.
Sent from a mobile device, please excuse any typos.
Quoted 13 lines · Andrei Borzenkov
19.11.2016 20:57, Robert LeBlanc пишет:
Quoted 1 line
On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <[email protected]>
Quoted 4 lines · wrote:
Quoted 1 line
biosdisk mdraid1x
Here is the screenshot of the output.
So it does not even mask LBA to 32 bit, it really returns 2TB. What system (motherboard) is it? What is disk controller? How drives are connected (directly to motherboard or some external adapter)?
20.11.2016 05:47, Robert LeBlanc пишет:
Quoted 2 lines
This is on super micro and KVM. You can replicate it on a VM.
I can't without more details. 5TB drive is correctly shown as 5TB in QEMU KVM 2.5 here.
Quoted 18 lines
Sent from a mobile device, please excuse any typos.
Quoted 13 lines · Andrei Borzenkov
19.11.2016 20:57, Robert LeBlanc пишет:
Quoted 1 line
On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <[email protected]>
Quoted 4 lines · wrote:
Quoted 1 line
biosdisk mdraid1x
Here is the screenshot of the output.
So it does not even mask LBA to 32 bit, it really returns 2TB. What system (motherboard) is it? What is disk controller? How drives are connected (directly to motherboard or some external adapter)?
Andrei,
I sent a VM that displays the problem. It bounced from the listserv (I kind of expected that), but should have been sent to your email directly as well.
For my own curiosity are you against the patch I submitted? I understand that you are trying to figure out why the sectors can't be accessed as a larger issue. Is there something I can do to help get this resolved?
Some more details on the hardware:
SuperMicro SYS-6028TP-HTFR
BIOS 1.1 American Megatrends Inc 08/03/2015
Intel I350 NIC firmware 1.63 (iSCSI boot)
For KVM I'm running Debian stretch with
ii qemu-kvm
1:2.7+dfsg-3+b1 amd64 QEMU Full
virtualization on x86 hardware
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1
Quoted 26 lines · Andrei Borzenkov
20.11.2016 05:47, Robert LeBlanc пишет:
Quoted 2 lines
This is on super micro and KVM. You can replicate it on a VM.
I can't without more details. 5TB drive is correctly shown as 5TB in QEMU KVM 2.5 here.
Quoted 18 lines
Sent from a mobile device, please excuse any typos.
Quoted 13 lines · Andrei Borzenkov
19.11.2016 20:57, Robert LeBlanc пишет:
Quoted 1 line
On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <[email protected]>
Quoted 4 lines · wrote:
Quoted 1 line
biosdisk mdraid1x
Here is the screenshot of the output.
So it does not even mask LBA to 32 bit, it really returns 2TB. What system (motherboard) is it? What is disk controller? How drives are connected (directly to motherboard or some external adapter)?
What is the verdict on getting the RAID detection fixed?
Thanks,
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1
Quoted 55 lines · Robert LeBlanc
Andrei,
I sent a VM that displays the problem. It bounced from the listserv (I kind of expected that), but should have been sent to your email directly as well.
For my own curiosity are you against the patch I submitted? I understand that you are trying to figure out why the sectors can't be accessed as a larger issue. Is there something I can do to help get this resolved?
Some more details on the hardware:
SuperMicro SYS-6028TP-HTFR
BIOS 1.1 American Megatrends Inc 08/03/2015
Intel I350 NIC firmware 1.63 (iSCSI boot)For KVM I'm running Debian stretch with
ii qemu-kvm
1:2.7+dfsg-3+b1 amd64 QEMU Full
virtualization on x86 hardware----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1Quoted 26 lines · Andrei Borzenkov
20.11.2016 05:47, Robert LeBlanc пишет:
Quoted 2 lines
This is on super micro and KVM. You can replicate it on a VM.
I can't without more details. 5TB drive is correctly shown as 5TB in QEMU KVM 2.5 here.
Quoted 18 lines
Sent from a mobile device, please excuse any typos.
Quoted 13 lines · Andrei Borzenkov
19.11.2016 20:57, Robert LeBlanc пишет:
Quoted 1 line
On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <[email protected]>
Quoted 4 lines · wrote:
Quoted 1 line
biosdisk mdraid1x
Here is the screenshot of the output.
So it does not even mask LBA to 32 bit, it really returns 2TB. What system (motherboard) is it? What is disk controller? How drives are connected (directly to motherboard or some external adapter)?
Can we get this fix merged in?
Thanks
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1
Quoted 35 lines · 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 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 <[email protected]>--- grub-core/disk/mdraid1x_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/disk/mdraid1x_linux.c +1
-2@@ -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) --2.10.1
This fix is buggy as you don't reset grub_errno on this path. Also you probably want to ignore only a single error type GRUB_ERR_OUT_OF_RANGE as others are likely still fatal.
Quoted 53 lines · On Wed, 11 Jan 2017, 20:26 Robert LeBlanc <[email protected]> wrote:
Can we get this fix merged in?
Thanks
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1Quoted 14 lines · 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 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.
Review
Quoted 6 lines
Signed-off-by Robert LeBlanc <[email protected]>--- grub-core/disk/mdraid1x_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/grub-core/disk/mdraid1x_linux.cgrub-core/disk/mdraid1x_linux.c grub_mdraid_detect (grub_disk_t disk, · line 149
Quoted 6 lines
index 7cc80d3..cc7350c 100644
grub-core/disk/mdraid1x_linux.c +0
-0@@ -148,7 +148,7 @@ grub_mdraid_detect (grub_disk_t disk, if (grub_disk_read (disk, sector, 0, sizeof (struct
grub_raid_super_1x),Quoted 9 lines
grub-core/disk/mdraid1x_linux.c +1
-2&sb)) -return NULL ; +continue ;if (sb.magic !=grub_cpu_to_le32_compile_time (SB_MAGIC ) ||grub_le_to_cpu64 (sb.super_offset) != sector) --2.10.1
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
OK, I'll rework the patch and resubmit it. Thanks for the feedback.
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1
Quoted 58 lines · Vladimir 'phcoder' Serbinenko
This fix is buggy as you don't reset
grub_errnoon this path. Also you probably want to ignore only a single error typeGRUB_ERR_OUT_OF_RANGEas others are likely still fatal.Quoted 53 lines · On Wed, 11 Jan 2017, 20:26 Robert LeBlanc <[email protected]> wrote:
Can we get this fix merged in?
Thanks
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1Quoted 34 lines · 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 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 <[email protected]>--- grub-core/disk/mdraid1x_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/disk/mdraid1x_linux.c +1
-1@@ -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)Quoted 3 lines
--
2.10.1_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel