1

My roll-your-own Fusion drive has become corrupted somehow, and I want to start all over. However, it won't unmount. When I run (from another startup disk, of course) diskutil cs delete <Logical Volume Group UUID>, Terminal returns

Unmounting Logical Volumes
Ejecting Logical Volumes
The disk disk2 couldn't be ejected
Error: -69691: Couldn't eject disk

How can I either unmount the Fusion drive, or erase it?

  • if you unmount rather than delete, is that successful? Try: sudo diskutil unmountDisk […] instead of delete. – Pete Cooper Mar 23 '19 at 18:12
  • No. Unmount of disk2 failed: at least one volume could not be unmounted – Calion Apr 3 '19 at 23:09
2
+50

Something may be mounting the disk on your startup system. Try to exclude the disk from spotlight, time machine and so on.

After that, there are a few unmount options in the terminal - sometimes, you have to unmount the volumes before you unmount the disks, or vice versa, and such.

Also, a few times in my past, the disk utility from the gui could unmount something which the diskutil command could not.

As a final recourse, try all this with the online recovery (it tends to be less likely to mount something) and/or the original version of MacOS your Mac shipped with (it may not understand new features of your Fusion Drive's file system, which is an advantage when deleting it).

On a sidenote, the zeroDisk option in Diskutil cleans up your disk more radically (and wears down the SSD more), but may help when issues remain. But it also only works when unmounting worked. You use it on both disks and let Disk Utility repair the Fusion Drive again. Use it only when deleting is unsuccessful. Be aware that a small error can delete the wrong disk, that there is no going back from it, that it takes a long time (though usually you can stop it with ctrl-c after the first percentage above 0 appears), and that it may destroy a disk (lots of zeros will be written).

| improve this answer | |
  • 1
    Brilliant. I should have thought of booting in an older OS; I already had a Snow Leopard disk attached to the computer. It worked great. – Calion Apr 9 '19 at 17:27
2

Below is the output from diskutil list of an the arrangement to be used in this example.

/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +128.0 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:          Apple_CoreStorage lvgDave                 127.7 GB   disk1s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk1s3

/dev/disk2 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +1.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:          Apple_CoreStorage lvgDave                 999.7 GB   disk2s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk2s3

/dev/disk3 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Dave                   +1.1 TB     disk3
                                 Logical Volume on disk1s2, disk2s2
                                 E6BEB7BA-4B92-4A10-A251-7C97589D4A2C
                                 Unencrypted

If you wish to destroy the Core Storage arrangement, then start by changing the partition type to Linux. One way to accomplish this is to use the gdisk command.

Note: The gdisk command is not part of macOS. You have to download and install gdisk.

Below are the commands to change disk1s2 and disk1s3 to Linux type partitions.

sudo gdisk /dev/disk1
p
t
2
8300
t
3
8300
p
w
q

The output is shown below.

GPT fdisk (gdisk) version 1.0.4

Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/disk1: 250000040 sectors, 119.2 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): B791964B-307B-49C4-850A-6C8410A44C1B
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 250000006
Partitions will be aligned on 8-sector boundaries
Total free space is 13 sectors (6.5 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       249737855   118.9 GiB   AF05  
   3       249737856       249999999   128.0 MiB   AB00  Booter

Command (? for help): t
Partition number (1-3): 2
Current type is 'Apple Core Storage'
Hex code or GUID (L to show codes, Enter = AF00): 8300
Changed type of partition to 'Linux filesystem'

Command (? for help): t
Partition number (1-3): 3
Current type is 'Recovery HD'
Hex code or GUID (L to show codes, Enter = AF00): 8300
Changed type of partition to 'Linux filesystem'

Command (? for help): p
Disk /dev/disk1: 250000040 sectors, 119.2 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): B791964B-307B-49C4-850A-6C8410A44C1B
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 250000006
Partitions will be aligned on 8-sector boundaries
Total free space is 13 sectors (6.5 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       249737855   118.9 GiB   8300  
   3       249737856       249999999   128.0 MiB   8300  Booter

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk1.
Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.

Below are the commands to change disk2s2 and disk2s3 to Linux type partitions.

sudo gdisk /dev/disk2
p
t
2
8300
t
3 
8300
p
w
q

The output has been omitted, since it is similar to that of disk1.

Below is the result from diskutil list.

/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +128.0 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:           Linux Filesystem lvgDave                 127.7 GB   disk1s2
   3:           Linux Filesystem Boot OS X               134.2 MB   disk1s3

/dev/disk2 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +1.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:           Linux Filesystem lvgDave                 999.7 GB   disk2s2
   3:           Linux Filesystem Boot OS X               134.2 MB   disk2s3

/dev/disk3 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Dave                   +1.1 TB     disk3
                                 Logical Volume on disk1s2, disk2s2
                                 E6BEB7BA-4B92-4A10-A251-7C97589D4A2C
                                 Unencrypted

Restart the Mac. No Core Storage volumes should mount. Next, the commands outlined below will covert the Linux partitions on each disk to a single Mac OS Extended (Journaled) volume. The volume name Dave0 was chosen arbitrarily.

The commands for disk1 are given below.

diskutil erasevolume jhfs+ Dave0 disk1s2
diskutil mergepartitions jhfs+ Dave0 disk1s2 disk1s3

The output is shown below.

$ diskutil erasevolume jhfs+ Dave0 disk1s2
Started erase on disk1s2
Unmounting disk
Erasing
Initialized /dev/rdisk1s2 as a 119 GB case-insensitive HFS Plus volume with a 16384k journal
Mounting disk
Finished erase on disk1s2 Dave0
$ diskutil mergepartitions jhfs+ Dave0 disk1s2 disk1s3
Merging partitions into a new partition
     Start partition: disk1s2 Dave0
     Finish partition: disk1s3
Started partitioning on disk1
Merging partitions
Waiting for partitions to activate
Growing disk
Finished partitioning on disk1
/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +128.0 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Dave0                   127.7 GB   disk1s2

The commands for disk2 are given below. The volume name Dave1 was chosen arbitrarily.

diskutil erasevolume jhfs+ Dave1 disk2s2
diskutil mergepartitions jhfs+ Dave1 disk2s2 disk2s3

The output has been omitted, since it is similar to that of disk1. The output of diskutil list is shown below.

/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +128.0 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Dave0                   127.7 GB   disk1s2

/dev/disk2 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +1.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS Dave1                   999.7 GB   disk2s2

Alternative to Using gdisk

The lastest versions of macOS contain a version of gpt that has a -f (force) option. Below is an example where gpt, with such an option, can be used instead of gdisk.

First, set the following variable.

LINUX=0FC63DAF-8483-4772-8E79-3D69D8477DE4

Next, enter the following commands to change disk1s2 and disk1s3 to Linux type partitions.

Note: The arguments for the -b (begin) and -s (size) options come from the output of sudo gpt -r show disk1.

sudo gpt -r show disk1
sudo gpt -f remove -i 2 disk1
sudo gpt -f add -i 2 -b 409640 -s 249328216 -t $LINUX disk1
sudo gpt -f remove -i 3 disk1
sudo gpt -f add -i 3 -b 249737856 -s 262144 -t $LINUX disk1

Below is an example output.

$ sudo gpt -r show disk1
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  249328216      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  249737856     262144      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  250000000          7         
  250000007         32         Sec GPT table
  250000039          1         Sec GPT header
Marlin:Desktop davidanderson$ sudo gpt -f remove -i 2 disk1
disk1s2 removed
$ sudo gpt add -i 2 -b 409640 -s 249328216 -t $LINUX disk1
disk1s2 added
$ sudo gpt -f remove -i 3 disk1
disk1s3 removed
$ sudo gpt -f add -i 3 -b 249737856 -s 262144 -t $LINUX disk1
disk1s3 added

Finally, enter the following commands to change disk2s2 and disk2s3 to Linux type partitions.

sudo gpt -r show disk2
sudo gpt -f remove -i 2 disk2
sudo gpt -f add -i 2 -b 409640 -s 1952453216 -t $LINUX disk2
sudo gpt -f remove -i 3 disk1
sudo gpt -f add -i 3 -b 1952862856 -s 262144 -t $LINUX disk2

The output has been omitted, since it is similar to that of disk1. The output from the command diskutil list is shown below.

/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +128.0 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:           Linux Filesystem                         127.7 GB   disk1s2
   3:           Linux Filesystem                         134.2 MB   disk1s3

/dev/disk2 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +1.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:           Linux Filesystem                         999.7 GB   disk2s2
   3:           Linux Filesystem                         134.2 MB   disk2s3

/dev/disk3 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Dave                   +1.1 TB     disk3
                                 Logical Volume on disk1s2, disk2s2
                                 E6BEB7BA-4B92-4A10-A251-7C97589D4A2C
                                 Unencrypted

Appendix

The basic gdisk commands are given below.

b   back up GPT data to a file
c   change a partition's name
d   delete a partition
i   show detailed information on a partition
l   list known partition types
n   add a new partition
o   create a new empty GUID partition table (GPT)
p   print the partition table
q   quit without saving changes
r   recovery and transformation options (experts only)
s   sort partitions
t   change a partition's type code
v   verify disk
w   write table to disk and exit
x   extra functionality (experts only)
?   print this menu
| improve this answer | |
  • 1
    Also good. I completely forgot that diskutil commands also have a force option, which might have helped with the unmounting, too. – Carl Dombrowski Apr 9 '19 at 19:00

You must log in to answer this question.

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