import typing


def filesystem_info(path: str) -> typing.Dict[str, typing.Any]:
    """Parse /proc/mounts (which has fstab format) to find out the type of a filesystem."""
    # Get the data and split into a list of mounts.
    with open("/proc/mounts", "r") as f:
        procmounts_raw = f.read()
    procmounts = procmounts_raw.strip().split("\n")

    # Find all mount points that match our path.
    possiblemounts = {}
    for mnt in procmounts:
        items = mnt.split()
        if path.startswith(items[1]):
            possiblemounts[items[1]] = items

    # Find the longest mountpoint that matches our path.
    if len(possiblemounts) > 0:
        ordered = sorted(possiblemounts.keys(), key=len, reverse=True)
        longest_key = ordered[0]
        longest = possiblemounts[longest_key]
        return {
            "fs_spec": longest[0],
            "fs_file": longest[1],
            "fs_vfstype": longest[2],
            "fs_mntops": longest[3],
            "fs_freq": longest[4],
            "fs_passno": longest[5],
        }
    raise FileNotFoundError