How can I determine which is the first free nbd device?
Currently I have 2 ways to check if an device is connected: the first is calling file on the device and check if it is empty or not. The second is call lsblk and see if the device is in the list.
Rather than looping over all nbd devices until I find one free to use, I wondered if there's a way to immediately get the first free nbd device.