
我在 MDADM RAID1 設定之上有 LVM 邏輯磁碟區。我正在嘗試透過以下方式將 SSD 設備作為快取添加到該邏輯磁碟區:
vgextend dataVG /dev/sdd
lvcreate --type cache --cachemode writethrough -L 120G -n dataLV_cachepool dataVG/dataLV /dev/sdd
一切似乎都很好,直到我重新啟動系統。重新啟動後,它無法啟動,我進入恢復模式(Ubuntu)。
我在啟動過程中看到以下錯誤:
lvm[740]: dataVG: autoactivation failed.
systemd[1]: lvm2-pvscan@9:2.service: Main process exited, code=exited, status=5/NOTINSTALLED
systemd[1]: lvm2-pvscan@9:2.service: Failed with result 'exit-code'.
systemd[1]: Failed to start LVM2 PV scan on device 9:2.
lvm[774]: /usr/sbin/cache_check: execvp failed: No such file or directory
lvm[774]: Check of pool dataVG/dataLV_cachepool failed (status:2). Manual repair required!
lvm[774]: 0 logical volume(s) in volume group "dataVG" now active
lvm[774]: dataVG: autoactivation failed.
systemd[1]: Started File System Check on /dev/mapper/BACKUPVG-mainbackup.
systemd[1]: lvm2-pvscan@8:16.service: Main process exited, code=exited, status=5/NOTINSTALLED
systemd[1]: lvm2-pvscan@8:16.service: Failed with result 'exit-code'.
systemd[1]: Failed to start LVM2 PV scan on device 8:16.
systemd[1]: Mounting /mnt/mainbackup...
systemd[1]: Mounted /mnt/mainbackup.
kernel: EXT4-fs (dm-1): mounted filesystem with ordered data mode. Opts: (null)
systemd[1]: dev-mapper-dataVG\x2dataLV.device: Job dev-mapper-dataVG\x2dataLV.device/start timed out.
systemd[1]: Timed out waiting for device dev-mapper-dataVG\x2dataLV.device.
systemd[1]: Dependency failed for /mnt/dataLV.
systemd[1]: Dependency failed for Local File Systems.
systemd[1]: local-fs.target: Job local-fs.target/start failed with result 'dependency'.
systemd[1]: local-fs.target: Triggering OnFailure= dependencies.
systemd[1]: mnt-dataLV.mount: Job mnt-dataLV.mount/start failed with result 'dependency'.
systemd[1]: Dependency failed for File System Check on /dev/mapper/dataVG-dataLV.
systemd[1]: systemd-fsck@dev-mapper-dataVG\x2dataLV.service: Job systemd-fsck@dev-mapper-dataVG\x2dataLV.service/start failed with resu
systemd[1]: dev-mapper-dataVG\x2dataLV.device: Job dev-mapper-dataVG\x2dataLV.device/start failed with result 'timeout'.
只有當我從 VG 中刪除快取驅動器時它才有效:
lvconvert --uncache dataVG/dataLV
不知道如何處理這個問題...
LVM版本:
LVM version: 2.02.176(2) (2017-11-03)
Library version: 1.02.145 (2017-11-03)
答案1
我在 Debian 8 上遇到了同樣的問題。
首先,由於在引導期間未載入所需的模組,因此系統會導致以非活動狀態 LVM 的方式引導快取的 LV。
嘗試手動啟動它們,會導致錯誤:
vgchange -a y vg0/home_cache
/usr/sbin/cache_check: execvp failed: No such file or directory
Check of pool vg0/home_cache failed (status:2). Manual repair required!
事實上,指令 /usr/sbin/cache_check 不存在。透過安裝修復它:
apt-get install thin-provisioning-tools
其次,修正導致 LVM 快取卷未啟動的問題。 initramfs 啟動映像中需要存在幾個模組。將它們添加到強制模組中以包含:
sudo echo "dm_cache" >> /etc/initramfs-tools/modules
sudo echo "dm_cache_mq" >> /etc/initramfs-tools/modules
sudo echo "dm_persistent_data" >> /etc/initramfs-tools/modules
sudo echo "dm_bufio" >> /etc/initramfs-tools/modules
之後執行以下操作:
update-initramfs -k `uname -r` -u -t
最後透過以下方式保護自己:
update-grub
檢查兩次,最後重新啟動。
答案2
我認為你的 init ramdisk 中需要快取核心模組 (dm-cache) 和 /usr/sbin/cache_* 工具。在 Fedora 中,它由 debian(和 ubuntu)initramfs-tools 套件中的 dracut 處理。