I'm in the process of trying to automate getting the LVGUUID and printing it as a string to a text file, or better piping it in terminal to other commands. All I can do right now is diskutil coreStorage list and then copy/paste the UUID as needed. Is there a faster way to do this?

  • What's the real issue here? The df . command will get you the raw filesystem device for the current directory. (disk1s1 for me at present) and diskutil info disk1s1 gets you the details about that filesystem. system_profiler SPStorageDataType | grep "LVG UUID" also works to dump just the existing UUID the system knows about right now. It's not clear why you'll want to know the enclosing group - but perhaps the existing answer is exactly what you want?
    – bmike
    Aug 7, 2017 at 19:15
  • What I'm trying to do is break Core Storage, as the Macs in question are being imaged for public use. Therefore I'm running a script from a removable hard drive and it just saves me a couple steps if I can auto-populate the command rather than copying and pasting.
    – Christian
    Aug 7, 2017 at 20:37
  • Excellent use case @christian - imaging is hard work. Check this guy for scripts, workflows, and more - derflounder.wordpress.com
    – bmike
    Aug 8, 2017 at 3:01

1 Answer 1


Note: This answer is just example code as I only have one Core Storage Volume to test against, however, if there's more then one, the awk command could be modified to accommodate accordingly. Although without the output of multiple Core Storage Volumes, I cannot give an example.

If it's the Logical Volume Group UUID, you can user the following example:

$ lvguuid="$(diskutil coreStorage list | awk '/Logical Volume Group/{print $5}')"
$ echo "$lvguuid"

In the awk command, you can substitute Logical Volume Group with Physical Volume, Logical Volume Family and change $5 as appropriate. Based on the order of the search string shown in this line, it will be $5, $4, $5.

For Logical Volume, you'll need to use a regex, as in the following example:

lvuuid="$(diskutil coreStorage list | awk '/Logical Volume [A-F0-9]{8}-/{print $4}')"

Understanding the regex:

  • Logical Volume [A-F0-9]{8}-

    • Logical Volume matches the characters Logical Volume literally (case sensitive).
  • [A-F0-9]{8} - Match a single character present in the list below.

    • {8} Quantifier — Matches exactly 8 times.
    • A-F a single character in the range between A (index 65) and F (index 70) (case sensitive).
    • 0-9 a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive).
    • - matches the character - literally (case sensitive).

So, in my example awk matches Logical Volume 38712F52- and returns:


The above examples set a variable that can be called from the command line or script, however, if you what the output to a file, then use the following example:

diskutil coreStorage list | awk '/Logical Volume Group/{print $5}' > /path/to/filename

On my system here's the output of the diskutil coreStorage list command on an encrypted USB Flash Drive:

$ diskutil coreStorage list
CoreStorage logical volume groups (1 found)
+-- Logical Volume Group 696AD841-1F53-4D33-9496-3E36D33AB270
    Name:         Encrypted
    Status:       Online
    Size:         15661490176 B (15.7 GB)
    Free Space:   16777216 B (16.8 MB)
    +-< Physical Volume E0E76F6B-A4E2-466D-B8E5-D5977ECD0522
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk3s2
    |   Status:   Online
    |   Size:     15661490176 B (15.7 GB)
    +-> Logical Volume Family EAF4984B-94C8-49B6-BCC6-76A8724E04D2
        Encryption Status:       Unlocked
        Encryption Type:         AES-XTS
        Conversion Status:       Complete
        Conversion Direction:    -none-
        Has Encrypted Extents:   Yes
        Fully Secure:            Yes
        Passphrase Required:     Yes
        +-> Logical Volume 38712F52-5967-4A49-87D6-C66D4B199F28
            Disk:               disk4
            Status:             Online
            Size (Total):       15325941760 B (15.3 GB)
            Size (Converted):   -none-
            Revertible:         Yes (unlock and decryption required)
            LV Name:            Encrypted
            Volume Name:        Encrypted
            Content Hint:       Apple_HFS
  • Also - APFS containers likely won't follow along the core storage path with LVG UUID - so I'm asking the OP to clarify what they actually want to do. This is likely an X Y problem - a useful and interesting one, but still XY.
    – bmike
    Aug 7, 2017 at 19:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .