ZFS. Повреждение файловой системы. "Kernel panic" после импорта пула (ZFS pool got corrupted, kernel panic after import)
Ссылки
https://forums.freebsd.org/threads/zfs-pool-got-corrupted-kernel-panic-after-import.76485/
Задача
Беда, беда
При подключении пула zfs (zpool import <pool-name>) сервер перезагружается или зависает с KERNEL PANIC
Кажется, что всё кончено, но нет
Решение
Вариант 1:
Для начала пробуем подключить пул в режиме READ-ONLY
zpool import -o readonly=on <pool-name>
Если не получилось, то с другой точкой монтирования и дополнительными опциями:
-N : import without mounting
-o readonly=on : pool will be imported in readonly mode
-f : force import, this is needed if there is a sign that the pool is in use or there was a crash so export was not done properly, also needed if there are missing devices in the pool afaik
-R /mnt : altroot , and disables cachefile
-F : Recovery mode for a non-importable pool, zfs will try to discard the last few transactions
-T : I found no entry for this switch in the manual, but I found it in some articles and maillist threads that zfs will try to roll back to this transaction if given
zpool import -N -o readonly=on -f -R /mnt/TEST -F <pool-name>
Если пул подключился, то
- копируем с него все данные что можем
- пересобираем пул, копируем данные обратно
Вариант 2:
Подключаем с опцией -F
Режим восстановления ФС, скорее всего zfs удалит данные, которые вызывают проблемы - эти данные будут потеряны
Использовать на свой риск
zpool import -F -f <pool-name>
Если пул подключился - отключаем и переподлючаем как обычно
zpool import <pool-name>
Ура! но ура ли?..
Ждем когда найдется файл, которого больше нет...
Делай бэкапы КАЖДЫЙ ДЕНЬ, проверяй эти бэкапы КАЖДЫЙ ДЕНЬ!