implement recursive function which finds the base devices for GRUB