OK here we go. I just got in two (of an order of 44?) new iMacs from Apple, and was befuddled by my inability to access it via target disk mode. After a bit of digging I discovered that the Macintoshes with USB-C on them will flat-out
IGNORE connections through a USB-C cable. Yes, you read that right.
No USB-C cable."But then, how...?" you ask! According to Apple, they will only work in target mode using USB-3.1 (aka Thunderbolt-3) cables. Important to note -
Apple's USB-C cables are no exception to this rule and cannot be used to connect a mac in target mode. So they now produce a computer with a feature that their own accessories don't support.... genius! I'm rather annoyed by this as I bought a spare USB-C cable when I ordered this retina
specifically for accessing macs in target mode.
So at home I have this new Oyen USB-3.1 enclosure that (to my surprise) came with an unmarked generic cable. Took lots of stuff home to test. Stopped by walmart on the way home for some minor groceries, swung through their computer department, and surprise, they carried a Belkin USB-3.1 cable ($30) so grabbed that too for testing. (I was really expecting walmart would have a lower price, but whatever, I'm not ordering one online, I want to test this NOW, saves me a trip to best-buy)
So as mentioned above, I didn't really know
HOW I was going to do this testing. I had a few scripts sort of suited to this but not really, and so ended up writing something new for just this purpose. And the results were VERY surprising.
# all test ran 2017-08-02 on MacBook Pro (15-inch, 2016) - external tests used rear left USB-C port
### OYEN USB-3.1 enclosure ("Oyen Digital Mini Pro") with SanDisk II 960GB SSD
# 385 MB/sec via generic bundled USB-C cable
# 456 MB/sec via generic bundled USB-C cable
# 454 MB/sec via belkin Thunderbolt-3/USB-C cable
#
39 MB/sec via Apple USB-C cable
### Retina internal storage model "APPLE SSD SM2048L" 2TB SSD
# 2096 MB/sec internal PCI-E
# 1993 MB/sec internal PCI-E
# 1937 MB/sec internal PCI-E
### LaCie Rugged Thunderbolt-2 enclosure with SanDisk II 512GB SSD
# 336 MB/sec via attached Thunderbolt-2 cable via Apple TB-2/TB-3 adapter
# 343 MB/sec via USB-3 cable via Nonda USB-3/USB-C adapter
# 337 MB/sec via USB-3 cable via Apple USB-3/USB-C adapter
# 335 MB/sec via USB-3 cable via Anker USB/Ethernet mini dock (model A8303)
# 286 MB/sec via USB-3 cable via OWC Thunderbolt2 Dock via Apple Thunderbolt-2 cable via Apple TB-2/TB-3 adapter
### DOES NOT WORK:
# - any Thunderbolt-3 Macintosh in target disk mode connected via Apple USB-C cable
# - any USB-C device connected via Apple TB-2/TB-3 adapter via Apple Thunderbolt-2 cable via Apple TB-2/TB-3 adapter
# the failure of target disk mode using USB-C (and not Thunderbolt-3) grade cables came as quite a shock to me and
# is the reason I wrote and performed thee tests
# the failure of the "adapt Thunderbolt-3 through Thunderbolt-2 cable" test was also a surprise, but is much less of a problem
Check out that Oyen via Apple's "USB-C" cable.... wow. In addition to not being a USB-3.1 cable,
THAT is NOT a USB-C cable. THAT is a USB-2.1 cable
pretending to be a USB-C cable. 39MB/sec is max USB-2.1 ("super-speed") speed.
A few of the tests show up more than once as I ran them again and got different numbers. I'm not sure why, as I'm being pretty careful to make sure things are ready and consistent. Nothing is too far off though to suggest a big problem. And oh my good lord, just look at those internal speeds! 2GB/sec! I don't have another mac here to test right now, but I'm wondering if I will continue to see speeds like that when I get back to work with my (real) USB-3.1 cable to test target mode?
My LaCie tests suggest that USB-3.0 and Thunderbolt-2 are about the same, performance-wise. The SSDs in the LaCie and the Oyen are about on par and should max out around the same speed, so the LaCie is capping out a bit on the USB-3.0 / Thunderbolt-2 interface.
and of course, here's my test code. Please feel free to use and submit your results. Try to be as specific as possible about the test you run, including the computer, any cables or adapters you use with as much detail as possible on them, as well as the enclosure AND the drive in the enclosure.
#!/bin/bash
vers=2017.08.02.A
# check read speeds on a disk
################################################################################
### SUBROUTINES
################################################################################
########################################
### SCAN DISKS
########################################
# display available disks and get disk selection
scan_disks () {
# display list of physical disks to user
clear
echo
echo "Physical disks:"
echo
diskutil list physical
echo
# load list of physical disks
diskutil list physical | grep "^/" > "$tempfile"
disks=0
while read x ; do
y=${x%% *} # "/dev/disk5
disk[disks]="/dev/r${y:5}" # "/dev/rdisk5
((disks++))
done < "$tempfile"
rm "$tempfile"
echo "loaded $disks disks"
echo
echo
}
########################################
### TEST AT
########################################
# perform one read test on a disk
# supply $1 as MB index to start scan at
# preset source to disk device, sample_mb amount of MB to scan
test_at () {
start_mb=$1
echo -n " testing read speed at $start_mb... "
dd if=$source bs=1m count=$sample_mb iseek=$start_mb of=/dev/null 2> "$tempfile"
speed=$(cat "$tempfile" | grep "transferred") # "1919942656 bytes transferred in 4.716991 secs (407026996 bytes/sec)"
speed=${speed#*(} # "407026996 bytes/sec)"
speed=${speed% *} # "407026996"
((speed=speed/1024/1024))
rm "$tempfile"
echo "$speed MB/sec"
echo
# add up for averge when we're done testing this disk
((average+=speed))
}
########################################
### TEST ONE
########################################
# select and test one disk
test_one () {
### select disk to test
if [ $disks == 1 ] ; then
source=${disk[0]}
else
scan_disks
PS3=$'\n'"Select disk to test, or 0 to rescan : "
source=""
while [ -z "$source" ] ; do
select source in ${disk[@]} ; do
# disk was selected
break
done
if [ -z "$source" ] ; then
# recan
scan_disks
fi
done
fi
echo
echo "Selected device: $source"
echo
### get capacity of selected disk
bytes=$(diskutil info -plist $source | grep -A1 "<key>Size</key>" | grep "integer" | cut -d ">" -f 2 | cut -d "<" -f 1) # "960197124096"
((mb=bytes/1024/1024))
echo "selected disk is $mb MB in size"
echo
### make sure drive is spun up and head is seeked to start before starting test
dd if=$source bs=1m count=1 of=/dev/null 2> /dev/null
### read 1MB to get an idea of the speed of this disk
dd if=$source bs=1m count=1 iseek=$((mb/2+1)) of=/dev/null 2> "$tempfile"
speed=$(cat "$tempfile" | grep "transferred") # "1919942656 bytes transferred in 4.716991 secs (407026996 bytes/sec)"
speed=${speed#*(} # "407026996 bytes/sec)"
speed=${speed% *} # "407026996"
((speed=speed/1024/1024)) # speed is now in MB/sec
rm "$tempfile"
### calculate sample size - we want our read tests to each take about five seconds
((sample_mb=speed*5))
echo "Will sample $sample_mb MB at the start, middle, and end of the disk:"
echo
# perform three read tests, display and average speed
average=0
test_at 0
test_at $((mb/2))
test_at $((mb-sample_mb))
((average/=3))
echo "average speed of $average MB/sec"
echo
echo
}
################################################################################
################################################################################
###
### PROGRAM START
###
################################################################################
################################################################################
tempfile="${TMPDIR}read_speeds.tmp"
### verify user is root
if [ $UID != 0 ] ; then
echo
if [ -z "$(echo " $(dscl . -read /Groups/admin | grep "GroupMembership: " | cut -d ':' -f 2) " | grep " $USER ")" ] ; then
echo "You will need to login as an admin to run this program."
echo
exit
fi
echo -n "Please enter your admin " # Password:
sudo "$0" "$1" "$2"
exit
fi
### test over and over
while [ true ] ; do
test_one
read -n1 -p "Press [RETURN] to scan for disks again : " x
done
### we never get here
################################################################################
################################################################################
###
### NOTES
###
################################################################################
################################################################################
# all test ran 2017-08-02 on MacBook Pro (15-inch, 2016) - external tests used rear left USB-C port
### OYEN USB-3.1 enclosure ("Oyen Digital Mini Pro") with SanDisk II 960GB SSD
# 385 MB/sec via generic bundled USB-C cable
# 456 MB/sec via generic bundled USB-C cable
# 454 MB/sec via belkin USB-C cable
# 39 MB/sec via Apple USB-C cable
### Retina internal storage model "APPLE SSD SM2048L" 2TB SSD
# 2096 MB/sec internal PCI-E
# 1993 MB/sec internal PCI-E
# 1937 MB/sec internal PCI-E
### LaCie Rugged Thunderbolt-2 enclosure with SanDisk II 512GB SSD
# 336 MB/sec via attached Thunderbolt-2 cable via Apple TB-2/TB-3 adapter
# 343 MB/sec via USB-3 cable via Nonda USB-3/USB-C adapter
# 337 MB/sec via USB-3 cable via Apple USB-3/USB-C adapter
# 335 MB/sec via USB-3 cable via Anker USB/Ethernet mini dock (model A8303)
# 286 MB/sec via USB-3 cable via OWC Thunderbolt2 Dock via Apple Thunderbolt-2 cable via Apple TB-2/TB-3 adapter
### DOES NOT WORK:
# - any Thunderbolt-3 Macintosh in target disk mode connected via Apple USB-C cable
# - any USB-C device connected via Apple TB-2/TB-3 adapter via Apple Thunderbolt-2 cable via Apple TB-2/TB-3 adapter
# the failure of target disk mode using USB-C (and not Thunderbolt-3) grade cables came as quite a shock to me and
# is the reason I wrote and performed thee tests
# the failure of the "adapt Thunderbolt-3 through Thunderbolt-2 cable" test was also a surprise, but is much less of a problem