How to image USB drives without having OS X mount them afterwards
Download, install and start Disk-Arbitrator. Activate it in "block mount" mode.

Now execute sudo dd if=/path/to/file of=/dev/diskN [operands]. The resulting volume won't be mounted and no file will be created nor a folder will be changed:

sh-3.2# ls -laO
total 0
drwxrwxr-x  7 user      staff  -      306 17 Jan 22:21 .
drwxrwxrwt@ 8 root      admin  hidden 272 17 Jan 23:11 ..
drwx------  5 root      wheel  -      170 17 Jan 22:21 .Spotlight-V100
d-wx-wx-wt@ 2 root      wheel  hidden  68 17 Jan 22:21 .Trashes
drwx------  5 root      staff  -      170 17 Jan 22:21 .fseventsd


Original image content:

drwxrwxr-x  7 user      staff  -      306 17 Jan 22:21 .
drwxrwxrwt@ 9 root      admin  hidden 306 17 Jan 23:23 ..
drwx------  5 root      wheel  -      170 17 Jan 22:21 .Spotlight-V100
d-wx-wx-wt  2 root      wheel  hidden  68 17 Jan 22:21 .Trashes
drwx------  5 root      staff  -      170 17 Jan 22:21 .fseventsd


Don't forget to deactivate Disk Arbitrator after finishing the cloning.



My first proposal below modifies at least some metadata of the folders /Volumes/VolumeName/.Trashes and /Volumes/VolumeName/.fseventsd

Simply appending &amp;&amp; diskutil eject /dev/diskN after dd'ing should work:

sudo dd if=/path/to/file of=/dev/diskN [operands] &amp;&amp; diskutil eject /dev/diskN


Upon completion of the dd command this should immediately eject the thumb drive.