I have to find a way to mount the first "external" vfat partition on 250 different headless hosts via shell. It could be sdb sdb1 sdc sdc1 etc. I need the device name to mount it with ansible for further processing.

Normally I would go like

lsblk -lno PATH,HOTPLUG,FSTYPE | awk '/sd.*1.*vfat/{print $1}'


  • Some of the hosts don't have lsblk, they are to old (util-linux-2.17)
  • Some of the sticks are FAT16 some FAT32
  • The partitions dont have a special label or UUID
  • sometimes it is even the whole device instead of a partition.
  • it has to run in ansible, so better no loops

Any ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.