We could maybe use a loop that look into /sys/block/<disk>/. If inside this directory you see a <disk><num>. It means that the disks has partitions so we probably do not want to touch it.