Monday, 12 February 2018

 macOS - Disks and Core Storage

I've spent some of the past fortnight tinkering with a 2014 Mac Mini, which has a 1 TB Fusion drive; this is a combination of a conventional hard disk ( aka spinning rust ) and a smaller amount of solid-state disk (SSD).

As far as I can establish, macOS supports this via a technique called CoreStorage (CS), which has some similarities with other Logical Volume Managers (LVM), in that it creates a Logical Volume Group spanning multiple physical drives.

Long story short, I was trying/struggling to install a brand-new copy of macOS, whether the original as-shipped Yosemite or the latest High Sierra.

In both cases, having booted from a USB key, the installation would get most of the way through and then fail with a myriad of unintelligible exceptions.

For various reasons, I ended up decided that the problem was the Fusion drive, so I dug into a technique to "nuke" it, and then reconfigure it post-installation.

This is what I did: -

List the existing file systems

diskutil cs list

CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group 3A8C71B6-15A5-468F-88DC-24247FA4638F
    =========================================================
    Name:         Untitled
    Status:       Online
    Size:         1120333979648 B (1.1 TB)
    Free Space:   114688 B (114.7 KB)
    |
    +-< Physical Volume FFC8B753-839E-4AA9-B4D4-B4DB7CA3C91C
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk0s2
    |   Status:   Online
    |   Size:     120988852224 B (121.0 GB)
    |
    +-< Physical Volume 8FDAF8C0-C858-40EB-A4F4-B0FD929441BC
    |   ----------------------------------------------------
    |   Index:    1
    |   Disk:     disk1s2
    |   Status:   Online
    |   Size:     999345127424 B (999.3 GB)
    |
    +-> Logical Volume Family BEBC81CD-F707-4B71-9DCC-FDE50E08B0D3
        ----------------------------------------------------------
        Encryption Type:         None
        |
        +-> Logical Volume A9F2838E-4AB3-4F72-8F40-1282FF9395D7
            ---------------------------------------------------
            Disk:                  disk2
            Status:                Online
            Size (Total):          1114478608384 B (1.1 TB)
            Revertible:            No
            LV Name:               Yosemite
            Volume Name:           Yosemite
            Content Hint:          Apple_HFSX
            LVG Type:              Fusion, Sparse

Delete the CoreStorage Logical Volume Group

( I had, of course, backed up the important stuff BEFORE I did this )

diskutil cs delete 3A8C71B6-15A5-468F-88DC-24247FA4638F

Started CoreStorage operation
Unmounting Logical Volumes
Destroying Logical Volume Group
Erasing disk0s2
Initialized /dev/rdisk0s2 as a 113 GB case-insensitive HFS Plus volume with a 16384k journal
Mounting disk
Erasing disk1s2
Initialized /dev/rdisk1s2 as a 931 GB case-insensitive HFS Plus volume with a 81920k journal
Mounting disk
Finished CoreStorage operation

List the new file systems

diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Untitled                121.0 GB   disk0s2

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Untitled                999.3 GB   disk1s2

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:                  Apple_HFS SuperDuper              499.2 GB   disk3s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk3s3

/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *7.8 GB     disk4
   1:                        EFI EFI                     209.7 MB   disk4s1
   2:                  Apple_HFS Install OS X Yosemite   7.5 GB     disk4s2


Once I'd successfully installed macOS High Sierra onto the spinny disk ( /dev/disk1 ), I joined them back together again: -

Create new CoreStorage Logical Volume Group spanning both disks

diskutil cs create DaveHay disk0 disk1

Started CoreStorage operation
Unmounting disk0
Repartitioning disk0
Unmounting disk
Creating the partition map
Rediscovering disk0
Adding disk0s2 to Logical Volume Group
Unmounting disk1
Repartitioning disk1
Unmounting disk
Creating the partition map
Rediscovering disk1
Adding disk1s2 to Logical Volume Group
Creating Core Storage Logical Volume Group
Switching disk0s2 to Core Storage
Switching disk1s2 to Core Storage
Waiting for Logical Volume Group to appear
Discovered new Logical Volume Group "05899854-9FA2-4EF5-87F8-83BDAB96A1FE"
Core Storage LVG UUID: 05899854-9FA2-4EF5-87F8-83BDAB96A1FE
Finished CoreStorage operation

List the new file systems

diskutil cs list

CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group 05899854-9FA2-4EF5-87F8-83BDAB96A1FE
    =========================================================
    Name:         DaveHay
    Status:       Online
    Size:         1120849764352 B (1.1 TB)
    Free Space:   1114994507776 B (1.1 TB)
    |
    +-< Physical Volume 82119759-D8A4-449D-95A0-0B362DD72F5D
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk0s2
    |   Status:   Online
    |   Size:     120988852224 B (121.0 GB)
    |
    +-< Physical Volume E4FB1715-3F1E-4B23-8E05-211129D75A96
        ----------------------------------------------------
        Index:    1
        Disk:     disk1s2
        Status:   Online
        Size:     999860912128 B (999.9 GB)

Success !

No comments: