Detecting Fusion Drives from the command line

franton
Valued Contributor III

As the title says, how do you detect the presence of a fusion drive from the command line? I don't have any fusion drive computers to experiment on.

1 ACCEPTED SOLUTION

nicktong
New Contributor III

diskutil cs list should do for checking for a spanned CoreStorage volume / a Logical Volume Group (LVG) with multiple physical volumes I believe:

$ diskutil cs list
No CoreStorage logical volume groups found

$ diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group DE85044F-EADA-4F26-93B7-8CD0ADF006EC
    =========================================================
    Name:         bla
    Size:         869502550016 B (869.5 GB)
    Free Space:   865776689152 B (865.8 GB)
    |
    +-< Physical Volume 682DCC34-74A4-4290-80AE-EB127BA24746
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk1s2
    |   Status:   Online
    |   Size:     119690149888 B (119.7 GB)
    |
    +-< Physical Volume 5FA828A9-3EDD-4CBC-8C93-27C0E07C2E8A
        ----------------------------------------------------
        Index:    1
        Disk:     disk7s2
        Status:   Online
        Size:     749812400128 B (749.8 GB)

Could also make your own spanned CS volume along the lines of: http://www.macworld.com/article/2014011/how-to-make-your-own-fusion-drive.html

View solution in original post

13 REPLIES 13

nicktong
New Contributor III

diskutil cs list should do for checking for a spanned CoreStorage volume / a Logical Volume Group (LVG) with multiple physical volumes I believe:

$ diskutil cs list
No CoreStorage logical volume groups found

$ diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group DE85044F-EADA-4F26-93B7-8CD0ADF006EC
    =========================================================
    Name:         bla
    Size:         869502550016 B (869.5 GB)
    Free Space:   865776689152 B (865.8 GB)
    |
    +-< Physical Volume 682DCC34-74A4-4290-80AE-EB127BA24746
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk1s2
    |   Status:   Online
    |   Size:     119690149888 B (119.7 GB)
    |
    +-< Physical Volume 5FA828A9-3EDD-4CBC-8C93-27C0E07C2E8A
        ----------------------------------------------------
        Index:    1
        Disk:     disk7s2
        Status:   Online
        Size:     749812400128 B (749.8 GB)

Could also make your own spanned CS volume along the lines of: http://www.macworld.com/article/2014011/how-to-make-your-own-fusion-drive.html

franton
Valued Contributor III

Oh man this is going to be a grep'ing hell.

yellow
Contributor

A little late, but someone might find this of use down the road:

If you use "diskutil cs list", you will get the output above on FusionDrives. If it's not a FusionDrive, then you will get "No CoreStorage logical volume groups found" as a result.

For me, I was using this to test whether a drive was a FusionDrive and if it was, then checking to see it's FIleVault status. This is an Extension Attribute (and forgive me if this is inelegant shell scripting, it's not my forte)

#!/bin/sh

fusionCheck=`diskutil cs list`
osCheck=`/usr/bin/sw_vers | grep ProductVersion | cut -c 17-20`

if [ "$osCheck" != "10.8" ]; then
        result="Unsupported OS"
elif [ "$fusionCheck" == "No CoreStorage logical volume groups found" ]; then
        result="This drive is not a Fusion Drive"
else
        result=`diskutil cs list | awk '/Fully Secure:/ { print $3}'`
fi

echo ${result}

(note: the last line should be "echo '<result>'${result}'</result>'" to function as an Extension Attribute, I changed it so the above functions as a plain shell script.)

The else statement uses awk to find the line "Fully Secure:" and print the output of word #4, in this case, Yes or No.

yellow
Contributor

SAD TROMBONE:

I just realized that this is NOT the way to check for a Fusion Drive.
You will get output like this if the drives are RAID'd, or if they're using FileVault, as CoreStorage is for both FV and FDs.

Back to the drawing board.

rtrouton
Release Candidate Programs Tester

I had to filter out unencrypted CoreStorage drives as part of the latest rev of my FileVault 2 check EA. My script is available here if you want to see how I handled it:

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/filevault_2_encryption_che...

tlarkin
Honored Contributor

I don't have a core storage supported device at the moment, and testing the exit status is not an option to see if it is enabled.

Does the system profiler binary list any information on these?

yellow
Contributor

I think this is a better way...

diskutil cs list | awk '/Name:/ {if (NR <=5) {print $2, $3, $4}}'

The first "Name" field will (apparently) ALWAYS be "Virtual Whole Disk" if the drive is a Fusion Drive. Otherwise it will simply be the name of the hard drive.

Problems:
1) RAIDed drives might? also return a false positive. 2) We presume that the hard drive has not been renamed to Virtual Whole Disk

In our case, #1 doesn't really matter since this is how we check for a Fusion Drive and NOT apply PGP to it. Since PGP doesn't work with RAIDed drives (hence, not working on a Fusion Drive), we just want to be able to exclude everything in that criteria.

yellow
Contributor

<SIGH> I already know this won't work. It appears this will work with older Fusion Drives.. but not newer ones. I see a 3TB one right here that returns "Macintosh HD" but it's a fusion drive.

yellow
Contributor

How about this? Florin came up with this one.. pretty ingenious methinks.

#!/bin/sh

#  fusionDriveCheck.sh

# Assume that we are not dealing with a Fusion drive:
result="No"

# Check if there are at least two Physical Volumes
if [ 2 -le `diskutil cs list | grep "Physical Volume" | wc -l` ]; then
    # Get the size of the Logical Volumes and the sizes of the Phyisical Volumes
    sizes=(`diskutil cs list | awk -F: '/  Size:/ {print $2}' | awk '{print $1}'`)
    # Add the 2 sizes together, do they equal the first size we grabbed?
    if [ ${sizes[0]} -eq `expr ${sizes[1]} + ${sizes[2]}` ]; then
        result="Yes"
    fi
fi

echo "<result>$result</result>"

yellow
Contributor

As of 10.10, "diskutil list" will now indicate that it's a fusion drive:

diskutil list /dev/disk2
/dev/disk2 #: TYPE NAME SIZE IDENTIFIER 0: Apple_HFS NullSauce *1.1 TB disk2 Logical Volume on disk1s2, disk0s2 AD676CFE-61C2-422C-8A1D-7C841F43D937 Unlocked Encrypted Fusion Drive

tlarkin
Honored Contributor

Good find.

You could use grep with an exit status now to see if it is a Core Storage Volume. Simple one-liner would be (as root or sudo):

diskutil info /dev/disk0s2 | grep 'Apple_CoreStorage' 2>&1 > /dev/null ; echo $?
0

If grep returns successful it will have an exit status of 0, if not successful it will return 1 like so:

diskutil info /dev/disk0s2 | grep 'Apple_coreStorage' 2>&1 > /dev/null ; echo $?
1

I just made it fail on purpose by changing the "C" to a lowercase "c" since grep by default checks for strings that are case sensitive.

Verducci
New Contributor

This worked for me :

diskutil cs list | grep "Index:" | grep "1"

A FileVaulted volume or non-Fusion drive returns an empty string; a Fusion drive returns

"Index: 1"

bass
New Contributor

On a 10.12.3 system, a "diskutil cs list" will include "Fusion" as a result under "LVG Type". You can adjust the @tlarkin one-liner a bit to make a tidy extension attribute. This works for me:

#!/bin/bash

RESULT="No"

fusionDrive=$( diskutil cs list | grep Fusion 2>&1 > /dev/null ; echo $? )

if [ "$fusionDrive" == "0" ]; then
    RESULT="Yes"
fi

echo "<result>$RESULT</result>"

Not exactly sure when this new reporting was added but the smart money is on initial release of Sierra.