func canAPFSResize()

in internal/diskutil/grow.go [85:103]


func canAPFSResize(disk *types.DiskInfo) error {
	if disk == nil {
		return errors.New("no disk information")
	}

	// If the disk has ContainerInfo, check the FilesystemType
	if containerInfo := disk.ContainerInfo; (containerInfo != types.ContainerInfo{}) {
		if containerInfo.FilesystemType == "apfs" {
			return nil
		}
	}

	// Check if the disk has an APFS Container reference and APFS Physical Stores
	if disk.APFSContainerReference != "" && len(disk.APFSPhysicalStores) > 0 {
		return nil
	}

	return errors.New("disk is not apfs")
}