def unmounted_root_fs()

in daisy_workflows/export_metadata/export-metadata.py [0:0]


def unmounted_root_fs():
    # Searches for the unmounted root fs in the system, we know there'll be 2
    # block devices the worker's disk and the scanned image/disk so we test
    # for /dev/sda and /dev/sdb.
    process = subprocess.run(['mount'], capture_output=True, check=True)
    mounted_parts = process.stdout.decode().split()

    for curr in ['/dev/sda', '/dev/sdb']:
        device_node = root_fs(curr)
        if device_node is None:
            continue
        is_mounted = False
        for ln in mounted_parts:
            if device_node in ln:
                is_mounted = True
                break
        if not is_mounted:
            return device_node

    return None