]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC zfsboottest:
authormm <mm@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 7 Jan 2012 02:35:00 +0000 (02:35 +0000)
committermm <mm@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 7 Jan 2012 02:35:00 +0000 (02:35 +0000)
commit006481d6863430a21e1c824a946d5904d2e947e0
treef8b6a1d035235a07990422804488f524ad0184eb
parent72d7830c3ec7fe7db3a77627e8affb1619413a31
MFC zfsboottest:
r225608 (partial), r225609, r226611, r226612

MFC r225608 (avg, tools/ part):
zfstest: rename to zfsboottest and move to tools

MFC r225609 (avg):
zfsboottest: some additional enhancements

- redirect diagnostics printfs in the boot code to stderr
- do not read trailing garbage from a trailing block of a file

Also add my copyright to the file after making so many changes.

MFC r226611 (pjd):
- Allow to specify multiple files to check, eg.

zfsboottest gpt/system0 gpt/system1 - /boot/kernel/kernel /boot/zfsloader

- Instead of printing file's content calculate MD5 hash of the file,
  so it can be easly compared to the hash calculated via file system.
- Some other minor improvements.

MFC r226612 (pjd):
Because ZFS boot code was very fragile in the past and real PITA to debug,
introduce zfsboottest.sh script that will verify if it will be possible to boot
from the given pool.

# zfsboottest.sh system

Where "system" is pool name of the pool we want to boot from.

What is being verified by the script:
- Does the pool exist?
- Does it have bootfs property configured?
- Is mountpoint property of the boot dataset set to 'legacy'?

Dataset configured in bootfs property has to be mounted to perform more
checks:
- Does the /boot directory in boot dataset exist?
- Is this dataset configured as root file system in /etc/fstab or set
  in vfs.root.mountfrom variable in /boot/loader.conf?

By using zfsboottest tool the script will read all the files in /boot
directory using ZFS boot code and calculate their checksums.
Then, it will walk /boot directory using find(1) though regular file sytem
and also read all the files in /boot directory and calculate their checksums.
If any of the files cannot be looked up, read or checksum is invalid it will
be reported and booting off of this pool is probably not possible.

Some additional checks may be interesting as well. For example if the disks
contain proper pmbr and gptzfsboot code or if all expected files in /boot/
are present.

When upgrading FreeBSD, one should snapshot datasets that contain operating
system, upgrade (install new world and kernel) and use zfsboottest.sh to verify
if it will be possible to boot from new configuration. If all is good one
should upgrade boot blocks, by eg.:

# gpart -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

If something is wrong, one should rollback datasets and report the problems.

git-svn-id: svn://svn.freebsd.org/base/stable/8@229761 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
tools/tools/zfsboottest/Makefile [new file with mode: 0644]
tools/tools/zfsboottest/zfsboottest.c [new file with mode: 0644]
tools/tools/zfsboottest/zfsboottest.sh [new file with mode: 0755]