You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何定位Grub2中无法读取的hd0设备来源?

Fixing "error: failure reading sector 0x0 from `hd0'" on CentOS 7 ThinkServer

I’ve run into this exact issue on a brand-new ThinkServer with CentOS 7 installed—system boots fine, but that annoying error pops up every time I access the Grub menu or run search/ls in the Grub command line. After digging around and testing a few fixes, here’s what worked for me:

Step 1: Grab Your Root Partition UUID

First, log into your system and get the UUID of your root partition. This lets Grub target the correct disk directly instead of scanning all devices (which triggers the error):

blkid | grep /dev/mapper/centos-root  # Adjust the path if your root partition uses a different name

Copy the UUID string (looks like xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) for later use.

Step 2: Tweak Grub’s Configuration

Edit the main Grub config file:

vi /etc/default/grub

Make these key changes:

  • Add GRUB_DISABLE_OS_PROBER=true to turn off automatic scanning of other OSes (this stops Grub from probing the problematic hd0 device)
  • Update GRUB_CMDLINE_LINUX to include your root partition UUID, like this:
    GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet root=UUID=YOUR_ROOT_UUID_HERE"
    
  • Add GRUB_PRELOAD_MODULES="part_gpt part_msdos" to ensure Grub loads the right partition modules for UEFI mode

Step 3: Regenerate the Grub Config

Apply your changes by rebuilding the Grub EFI configuration:

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

If That Fails: Blacklist Problematic Disk Modules

If the error still shows up, your ThinkServer might have a disk controller module causing misidentification. Add this to GRUB_CMDLINE_LINUX in /etc/default/grub:

rd.blacklist=ahci

Then regenerate the config again with the command from Step 3.

Why This Happens

ThinkServers in UEFI mode often map the remote management controller (like iDRAC) as a virtual hd0 device. This device has no readable sectors, so when Grub scans all disks during boot or command-line operations, it throws the "failure reading sector 0x0" error. By disabling OS probing and targeting your actual root partition directly, Grub skips this invalid virtual disk entirely.

内容的提问来源于stack exchange,提问作者Geoffrey Wiseman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 04:28:19