Apple fan boys won’t like to hear this, but Mac OS X was majorly deficient in an area near and dear to my heart. You see, unlike every other modern operating system, Mac OS X lacked a volume manager. This wouldn’t seem like a big deal to the average user, but it held back the operating system in many ways. A volume manager brings storage virtualization to an operating system, allowing storage capacity efficiently to be managed and manipulated. But all this has changed in Mac OS X 10.7 “Lion” with CoreStorage.
You probably also want to read Key Storage Features in Mac OS X 10.7 “Lion” and Three Key Storage Features Missing in Mac OS X “Lion”
Apple’s Storage Story: A Mixed Bag
Apple’s file system, HFS+, is quite long in the tooth, dating back even before Mac OS X! Introduced in 1998’s Mac OS 8.1, HFS+ was extension of the original hierarchical file system (HFS) used by classic Mac operating systems back to System 2.1. But HFS+ has been extended and updated dramatically since those days, including the introduction of journaling in Mac OS 10.2.2, Unicode in 10.3, access control list-based file security in 10.4, and compression in 10.6.
The storage technology that underlies HFS+ has also improved dramatically over the years. Apple adopted EFI firmware and the GUID partition table (GPT) much more rapidly than the PC world. This allows Mac OS to scale to larger storage capacities than Windows systems, and has made the adoption of 4K sectors (so-called “advanced format”) much easier. In fact, Apple is well ahead of the Windows world in these areas even as it lags with an outdated filesystem and no volume manager.
Mac OS never had much in terms of storage flexibility. Sure, AppleRAID brought some flexibility and redundancy to the server world, but the average Mac user never delved much into this technology. While Apple was asleep at the wheel, every other operating system vendor introduced a flexible volume manager. Even Microsoft, who is often criticized for slow innovation, is way ahead of Apple when it comes to data storage.
What is a volume manager? Volume managers add flexibility to operating system allocation of storage, acting as a virtualization layer between disks and file systems. This is important, since modern computer systems need to maintain a consistent filesystem image even as storage devices change. Volume managers like Symantec’s Veritas Volume Manager and the OSF LVM allow many operating systems this sort of flexible storage management. But Apple never had a volume manager of their own until the introduction of CoreStorage in Mac OS X “Lion”. Read more at Volume Management: Virtualizing Host Storage.
Introducing CoreStorage
All this has changed in Mac OS X 10.7 (“Lion”), however. Although Mac OS never did get ZFS, as was planned in 10.5, the storage enhancements found in 10.7 are getting awfully close in terms of features. Along with integrated file versions and full disk encryption comes a new technology called CoreStorage, including a full logical volume manager.
CoreStorage became necessary due to the inclusion of full volume encryption in Lion. Previously, Apple’s FileVault encryption technology relied on regular files to contain an encrypted filesystem. This worked fine until the need became apparent to encrypt an entire volume, whether it is the operating system disk or a removable drive. Although file-based technology can work in these scenarios, it is much less than ideal and also less than what competing operating systems offer.
But enabling full volume encryption requires an abstraction layer that Mac OS X simply did not have. Apple appears to have taken the long route, engineering a complete volume manager rather than hacking together some sort of kludgy mechanism. Although it is only used for FileVault 2 at the moment, CoreStorage appears to be a full volume manager that could, in the future, boast advanced features like mirroring, snapshots, and online storage migration.
CoreStorage Data Structures
Apple did not simply copy existing volume manager semantics, and it does not appear that CoreStorage is an OEM version of someone else’s product. Rather, there are some intriguing new innovations present in CoreStorage that point to exciting possibilities in the future.
Like most volume managers, the basic building block of CoreStorage is the “logical volume group” (LVG). Illustrated in blue and purple above, each LVG takes storage from a “physical volume” (PV) and presents it to the operating system as a “logical volume” (LV). In this way, storage from a physical disk is abstracted before used by the operating system, allowing a great deal of flexibility. This is somewhat analogous to a hypervisor presenting a virtual machine interface.
Apple goes a step further than most volume managers, however, with the introduction of a new concept, the “logical volume family” (LVF). The LVF specifies properties that will be inherited by logical volumes that it contains. Currently, the only property specified by an LVF is FileVault encryption, but one can imagine that performance characteristics or redundancy could also be specified in this manner.
CoreStorage Today and Tomorrow
Today, when full volume FileVault encryption is used, Mac OS X automatically converts the desired volume into a CoreStorage volume, and encapsulating the partition as a PV, importing it into an LVG, and setting up an LVF and LV to contain the new filesystem. Only one of each element is created in this way, and all capacity is allocated at creation time. So there isn’t much use for the entire stack right now.
The Disk Utility GUI is fairly limited as well. Volumes can be converted to use FileVault 2, but all data is lost in this process. Only boot volumes can be corrected nondestructively through the GUI, and this happens in the Security & Privacy preference pane rather than Disk Utility. When boot volumes are encrypted, Apple gives users the option to “escrow” the decryption key online using their MobileMe or iCloud account, but this is not allowed for other volumes.
Currently, whenever a volume is converted to using FileVault, it is also automatically converted to CoreStorage behind the scenes. And if encryption is turned off in the GUI, it is converted back (“reverted”) to whatever it was before. But it’s possible to convert a volume on the command line without encryption, and to remove encryption without reverting. It’s also possible to manually manipulate CoreStorage in other ways.
The fact that Apple included a full volume manager of their own making indicates a bright future for CoreStorage. Already, it is possible to use the command line utility, diskutil to nondestructively convert and encrypt volumes. It is also possible to manipulate volume groups, logical volume families (indirectly), and logical volumes to a limited extent using diskutil. One hopes that future versions of Mac OS X will include additional functionality, including the ability to manipulate physical volumes.
Stephen’s Stance
Either Apple has big plans for CoreStorage, or some Apple software engineer got way ahead of himself and designed a complete logical volume manager just to house FileVault data! I think the former is likely, since we know that Apple wanted to include ZFS, a flexible combination volume manager and file system, in Mac OS X 10.5 but was unable to due to licensing concerns. Now two versions later, Lion includes all of the basic technology needed to effectively manage storage volumes. It is likely that the GUI simply lags behind this core technology, and we will see additional functionality added in later operating system revisions.
Regardless of intent, Mac OS X now includes a fairly full storage stack, from EFI and GPT through CoreStorage and HFS+. No longer is Apple behind the times in terms of core storage (if you pardon the pun) features. Now if only we could get them to implement iSCSI!
Derek says
Interesting to see what Apple is doing with their technology. Being new to the Mac side of the house it is nice to know that Lion isnt just a pretty iOS-ish face on the same old OS.
John C. Randolph says
Apple hired a number of Sun engineers from the ZFS team back when Apple was planning on shipping ZFS. Those people are still at Apple. I haven’t gotten any details of the scope of their plans, but I know they have the capability in house to develop a generation of storage technology beyond what ZFS offered, and I know they’ve been at it for several years already. It will be interesting to see what they give us in 10.8 or 10.9.
-jcr
sfoskett says
It appears that Apple has big plans for CoreStorage in Mac OS X. Considering the advanced volume manager stack they’ve already implemented, it will be a full-featured flexible storage layer in the future. I wonder if this will wait for 10.8 or if it will be slowly implemented through 10.7!
Obsidian71 says
Stephen …excellent article, very informative. It appears that Core Storage could be the test run for some of these amazing features. Presumably 10.8 and beyond will “turn on” additional functionality as they become tested and greenlighted. I’m excited.
Kirk says
Great writeup. I ran across CoreStorage when I chose an option in TimeMachine to encrypt my backup.
I am now using commands from your related post to resize my backup volume. Although undocumented, it seems to be working.
Graham Perrin says
In Ask Different:
OS X 10.7.4 Core Storage for encryption, ZEVO for ZFS
Daniel Bethe says
Mac OS *did* get ZFS, as it’s free software. It’s just not distributed *with* Mac OS. Mac OS has had logical volume management and everything else for years.
http://maczfs.org/
Tom says
I guess the thinking behind CoreStorage is to enable things like today’s announced Fusion Drive?
handleym says
While Core Storage has some new features and more flexibility, it is not close to true, as the article asserts, that Apple had no logical volume manager beforehand.
Apple has had software RAID in OSX since very early days, maybe even OSX 10.0. There is the infamous article
http://mac-guild.org/raid.html
showing OSX RAID being used on a collection of USB floppy drives (and working — giving a larger,faster virtual drive)!
This early OSX RAID manager grew over the years, and offered mirroring, striping, and JBOD. The underlying format was changed slightly at some point (10.4?) to make it more robust, meaning that Apple wasn’t standing still with it.
It’s still supported, and still part of, OSX today; and as far as I know, it’s still the only way to get striping or mirroring, if that is what you want; while all Core Storage offers is JBOD.
Core Storage is compatible with Apple RAID, so you can, for example, create a striped set of three slow spinning disks, and then put Core Storage on top of this RAID volume to encrypt it.
The GUI for Apple RAID (the RAID tab of Disk Utility) has always been very limited, but the command line app (diskutil, with the verb ar) is very flexible.
putaro says
We actually introduced the framework for all of this back in Copland! All that was needed was the mapping plug-in. The diagrams from the Copland patent may look familar: http://www.google.com/patents/US5829053?pg=PA4&dq=5829053&hl=en&sa=X&ei=7_zGUObPMe-fmQW924CIBg&sqi=2&pjf=1&ved=0CDQQ6AEwAA#v=onepage&q=5829053&f=false
乐罗 says
I have tried the coreStorage on my macbook A1181(OS X Lion 10.7.6-11g63). But the “recovery HD” disappeared during boot even if press the option key. I even tried to convert the “recovery HD” using “diskutil cs …” command, but failed(I thought that’s impossible coz LVM is a logical component). How can I fix this to show the “recovery HD”? or delete the 650MB space occupied by “recovery HD ” directly to free the space?
In addition, can I install Windows 7 or 8 into a LVM?
Thanks alot.
ajaja says
Thank you for this great unique article. Any chance you would be willing to revisit and update us on Apple’s current state of CoreStorage along with a look at Apple File System?
ajaja says
LOL
I just got past the end of the article to find:
You might also want to read these other posts: macOS Sierra Includes a New Apple File System, APFS
http://blog.fosketts.net/2016/06/13/macos-sierra-includes-new-apple-file-system-apfs/
Jayden Lawson says
old link?