How can I get the Volume Serial Number of a FAT volume?
For a FAT32 formatted disk, in Terminal, the following example compound command will output its volume serial number:
var=&quot;$(sudo dd if=/dev/diskNs1 skip=67 bs=1 count=4 2&gt;/dev/null | hexdump -e '4/4 &quot;%X&quot;')&quot;; echo &quot;${var:0:${#var}/2}-${var:${#var}/2}&quot;


Replace N in /dev/diskNs1 with the correct disk number.

You can use the mount command or diskutil list to ascertain the disk number of the target disk.


Note that the target disk needs to first be unmounted before running the example compound command.

Assuming the target disk is mounted as /dev/disk6s1, in Terminal use:
diskutil unmountDisk disk6

After the target disk is unmounted, then use:
var=&quot;$(sudo dd if=/dev/disk6s1 skip=67 bs=1 count=4 2&gt;/dev/null | hexdump -e '4/4 &quot;%X&quot;')&quot;; echo &quot;${var:0:${#var}/2}-${var:${#var}/2}&quot;

For my test disk, a USB flash drive formatted FAT32, the output was:
18E4-4FA7

I confirmed this with the vol command in Windows and the blkid command in Linux, and the output of vol and blkid matched the output of the example compound command above.

Notes:
With FAT32 volumes, the Volume Serial Number is stored in the Boot Sector at offset 67 (0x43), and is four bytes long.
Interesting Reading: Volume Serial Numbers
and Format Date/Time Verification
There may be a way to format the output of the dd command with hexdump to avoid the rest of the compound command, however, I didn't want to take the time to figure it out and chose to use parameter expansion and shell arithmetic instead for the final formatting.