func (c *DisksCheck) Run() (r *Report, err error) {
	r = &Report{name: c.GetName()}
	mountInfo, err := c.inspector.Inspect("/")
	if err != nil {
		r.result = Unknown
		r.Warn("Failed to inspect the boot disk. Prior to importing, verify that the boot disk " +
			"contains the root filesystem, and that the root filesystem isn't virtualized over " +
			"multiple disks (using LVM, for example).")
		return r, nil
	}
	r.Info(fmt.Sprintf("root filesystem mounted on %s", mountInfo.BlockDevicePath))
	if len(mountInfo.UnderlyingBlockDevices) > 1 {
		format := "root filesystem spans multiple block devices (%s). Typically this occurs when an LVM logical " +
			"volume spans multiple block devices. Image import only supports single block device."
		r.Fatal(fmt.Sprintf(format, strings.Join(mountInfo.UnderlyingBlockDevices, ", ")))
		return r, nil
	}
	bootDisk := mountInfo.UnderlyingBlockDevices[0]
	r.Info(fmt.Sprintf("boot disk detected as %s", bootDisk))
	var mbrData []byte
	if c.getMBROverride != nil {
		mbrData, err = c.getMBROverride(bootDisk)
	} else {
		mbrData, err = c.getMBR(bootDisk)
	}
	if err != nil {
		return nil, err
	}
	if mbrData[510] != 0x55 || mbrData[511] != 0xAA {
		r.Fatal("boot disk does not have an MBR partition table")
	} else {
		r.Info("boot disk has an MBR partition table")
	}
	if !bytes.Contains(mbrData, []byte("GRUB")) {
		r.Fatal("GRUB not detected in MBR")
	} else {
		r.Info("GRUB found in MBR")
	}
	return r, nil
}
Run executes the precheck step.
package precheck
import (
	"bytes"
	"fmt"
	"os"
	"strings"
	"github.com/GoogleCloudPlatform/compute-image-tools/cli_tools/common/mount"
)
type DisksCheck struct {
	getMBROverride func(devName string) ([]byte, error)
	inspector      mount.Inspector
}
func NewDisksCheck() Check {
	return &DisksCheck{inspector: mount.NewMountInspector()}
}
func (c *DisksCheck) GetName() string {
	return "Disks Check"
}