How to encrypt a disk where diskutil cs convert reports “a problem”, leaves disk unreadable

core-storagedisk-utilityencryptionhard drivepartition

I'm trying to encrypt my Time Machine backup volume, but diskutil refuses, and leaves the disk unreadable (but repairable using Linux). How can I proceed?

It's a Western Digital Elements 107C 3TB USB3 disk.

It has a single HFS+ partition and has been working fine.

diskutil verifyDisk and diskutil verifyVolume report no problems. I have also used Alsoft DiskWarrior to repair discrepancies, without problems.

If I try to convert the volume, diskutil report "a problem", like this:

rb@Silverbird$ /usr/sbin/diskutil cs convert /Volumes/RB3TB1/
Started CoreStorage operation on disk4s2 RB3TB1
Resizing disk to fit Core Storage headers
Creating Core Storage Logical Volume Group
Attempting to unmount disk4s2
Switching disk4s2 to Core Storage
Waiting for Logical Volume to appear
Mounting Logical Volume
A problem occurred; undoing all changes
Switching partition from Core Storage type to original type
Undoing creation of Logical Volume Group
Reclaiming space formerly used by Core Storage metadata
Error: -69842: Couldn't mount disk

This leaves the disk unreadable. diskutil cs list shows the disk as a Core Storage volume which is "online" and "revertible" but it cannot be mounted or acted on, neither can the parent physical volume. Disk Utility hangs on launch when the disk is connected. diskutil repairDisk on the parent volume reports:

Repairing the partition map might erase disk4s1, proceed? (y/N) y
Started partition map repair on disk4
Checking prerequisites
Problems were encountered during repair of the partition map
Error: -69808: Some information was unavailable during an internal lookup

In fact, all access to the disk appears to be broken at this point.

rb@Silverbird$ sudo /usr/sbin/gpt show /dev/disk4
gpt show: unable to open device '/dev/disk4': Input/output error

You can't even read the device using hexdump. The kernel seems mightily confused.

I was able to recover the disk by mounting it in Linux and using the "gdisk" utility to change the partition type from AF02 (Core Storage) to AF00 (HFS+). After that, diskutil verifies both the disk and the volume as OK.

I suspect Apple has a bug where diskutil fails to revert the partition type.

But this gets me no closer to encrypting my backup volume.

Does anyone have any idea what the "problem" might be and how I might proceed?

rb@Silverbird$ /usr/sbin/diskutil info /Volumes/RB3TB1
  Device Identifier:        disk5s2
  Device Node:              /dev/disk5s2
  Whole:                    No
  Part of Whole:            disk5
  Device / Media Name:      RB3TB1

  Volume Name:              RB3TB1

  Mounted:                  Yes
  Mount Point:              /Volumes/RB3TB1

  File System Personality:  Journaled HFS+
  Type (Bundle):            hfs
  Name (User Visible):      Mac OS Extended (Journaled)
  Journal:                  Journal size 229376 KB at offset 0x8f07408000
  Owners:                   Enabled

  Partition Type:           Apple_HFS
  OS Can Be Installed:      Yes
  Media Type:               Generic
  Protocol:                 USB
  SMART Status:             Not Supported
  Volume UUID:              F096E831-F27D-3433-9BBE-6B65F4F69FA5
  Disk / Partition UUID:    FE09034E-6AA0-4490-82A1-1F7E894ACD91

  Total Size:               3.0 TB (3000110108672 Bytes) (exactly 5859590056 512-Byte-Units)
  Volume Free Space:        78.1 GB (78142939136 Bytes) (exactly 152622928 512-Byte-Units)
  Device Block Size:        4096 Bytes
  Allocation Block Size:    4096 Bytes

  Read-Only Media:          No
  Read-Only Volume:         No

  Device Location:          External
  Removable Media:          No

The disk contains around 732000000 files, according to Disk Utility (actually directory entries).

This is OS X 10.11.2, all up to date, based on a clean install of OS X 10.11 last month.

Edit: Here is the output of gpt when the disk is repaired.

rb@Silverbird$ sudo /usr/sbin/gpt -r show /dev/disk3
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2          4         Pri GPT table
          6      76800      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      76806  732448757      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  732525563      32768      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  732558331          4         Sec GPT table
  732558335          1         Sec GPT header

When the disk was unreadable (after the failed revert) nothing in OS X could read it, including gpt. Linux "gdisk" reported it as having these same partitions, but the second partion with type "AF02" (Core Storage).

Best Answer

The disk is mounted in an enclosure which doesn't properly report a logical block size of 512 bytes. Instead 4096 bytes are used. The disk itself has a physical block size (Device Block Size) of 4096 bytes.

If the disk/volume don't show any errors in Disk Utility, I would assume that CoreStorage and the enclosure & hard disk aren't compatible.

I propose to use another method to encrypt your Time Machine backup:

  • encrypted sparse image
  • encrypted sparsebundle image (similar to FileVault1)
  • encrypted image