我在 Supermicro X9DRW-3LN4F+/X9DRW-3TF+ 上安装了 ubuntu 20.04,配有 2 个 NMVe 驱动器和 4 个 SATA 驱动器。我在 4 个 SATA 驱动器上设置了 zfs 池,如下所示:
$ sudo zpool status
[sudo] password for igdvs:
pool: data
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
data ONLINE 0 0 0
scsi-SATA_Hitachi_HUA72303_MK0371YHK2E0XA ONLINE 0 0 0
scsi-SATA_Hitachi_HUA72303_MK0371YHK2L7NA ONLINE 0 0 0
scsi-SATA_Hitachi_HUA72303_MK0371YHK1ME0A ONLINE 0 0 0
scsi-SATA_Hitachi_HUA72303_MK0331YHGZHD7A ONLINE 0 0 0
errors: No known data errors
因为我的 lxc 容器在 zfs 池上运行,并且我想升级 ubuntu 20.04 主机内核,以便我的一个 lxc 容器可以受益于新的主机内核功能。所以我决定安装 5.15.0-69-generic
包,然后重新启动主机,但重新启动后,5.15.0-69-generic
无法检测到 zfs 管理的驱动器。
然后我决定将主机升级到 Ubuntu 22.04,但升级后,主机仍然无法检测到 zfs 管理驱动器,SATA 驱动器完全消失了,没有显示在fdisk -l
、lsblk
、 中/dev/disk/by-id
。
$ ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root 9 Apr 22 20:48 ata-BP5_FEB40771110806776224 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 22 20:48 ata-BP5_FEB40771110806776224-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 22 20:48 ata-BP5_FEB40771110806776224-part2 -> ../../sda2
lrwxrwxrwx 1 root root 9 Apr 22 20:48 md-name-ubuntu-server:0 -> ../../md0
lrwxrwxrwx 1 root root 11 Apr 22 20:48 md-name-ubuntu-server:0-part1 -> ../../md0p1
lrwxrwxrwx 1 root root 9 Apr 22 20:48 md-uuid-b99cfa1b:4631aff7:91f67a2d:dc09cb51 -> ../../md0
lrwxrwxrwx 1 root root 11 Apr 22 20:48 md-uuid-b99cfa1b:4631aff7:91f67a2d:dc09cb51-part1 -> ../../md0p1
lrwxrwxrwx 1 root root 13 Apr 22 20:48 nvme-BPX_8B71076C020835003325 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Apr 22 20:48 nvme-BPX_8B71076C020835003325-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Apr 22 20:48 nvme-BPX_8B71076C020835003325-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 13 Apr 22 20:48 nvme-nvme.1987-3842373130373643303230383335303033333235-425058-00000001 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Apr 22 20:48 nvme-nvme.1987-3842373130373643303230383335303033333235-425058-00000001-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Apr 22 20:48 nvme-nvme.1987-3842373130373643303230383335303033333235-425058-00000001-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 9 Apr 22 20:48 scsi-0ATA_BP5_FEB40771110806776224 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 22 20:48 scsi-0ATA_BP5_FEB40771110806776224-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 22 20:48 scsi-0ATA_BP5_FEB40771110806776224-part2 -> ../../sda2
lrwxrwxrwx 1 root root 9 Apr 22 20:48 scsi-1ATA_BP5_FEB40771110806776224 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 22 20:48 scsi-1ATA_BP5_FEB40771110806776224-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 22 20:48 scsi-1ATA_BP5_FEB40771110806776224-part2 -> ../../sda2
lrwxrwxrwx 1 root root 9 Apr 22 20:48 scsi-SATA_BP5_FEB40771110806776224 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 22 20:48 scsi-SATA_BP5_FEB40771110806776224-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 22 20:48 scsi-SATA_BP5_FEB40771110806776224-part2 -> ../../sda2
lrwxrwxrwx 1 root root 9 Apr 22 20:48 usb-Generic_Flash_Disk_C8A76757-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 22 20:48 usb-Generic_Flash_Disk_C8A76757-0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Apr 22 20:48 usb-Generic_Flash_Disk_C8A76757-0:0-part9 -> ../../sdb9
从 BIOS 中,我可以看到 4 个 SATA 驱动器。
答案1
问题是升级后,我有内核 grub 启动顺序:
$ sudo grub-mkconfig | grep -iE "menuentry 'Ubuntu, with Linux" | awk '{print i++ " : "$1, $2, $3, $4, $5, $6, $7}'
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-70-generic
Found initrd image: /boot/initrd.img-5.15.0-70-generic
Found linux image: /boot/vmlinuz-5.15.0-69-generic
Found initrd image: /boot/initrd.img-5.15.0-69-generic
Found linux image: /boot/vmlinuz-5.4.0-147-generic
Found initrd image: /boot/initrd.img-5.4.0-147-generic
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
0 : menuentry 'Ubuntu, with Linux 5.15.0-70-generic' --class ubuntu
1 : menuentry 'Ubuntu, with Linux 5.15.0-70-generic (recovery mode)'
2 : menuentry 'Ubuntu, with Linux 5.15.0-69-generic' --class ubuntu
3 : menuentry 'Ubuntu, with Linux 5.15.0-69-generic (recovery mode)'
4 : menuentry 'Ubuntu, with Linux 5.4.0-147-generic' --class ubuntu
5 : menuentry 'Ubuntu, with Linux 5.4.0-147-generic (recovery mode)'
并且/etc/default/grub
有:
$ cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
#GRUB_DEFAULT=0
GRUB_DEFAULT="1>2"
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
因此5.15.0-69-generic
成为默认启动内核,注意这不是 Ubuntu 操作系统升级的错误,而是我/etc/default/grub
在不知情的情况下更改了默认启动内核。因此,教训是,当您拥有 zfs 管理磁盘时,不要单独安装新的内核包,并在升级操作系统后检查您的默认启动内核,以及您是否之前更改了默认启动内核。这种情况不常见,应该很少发生,但人们确实会犯错误