DIY Fusion Drive: an attempt to retrofit a pre-fall 2012 Mac with an SSD and a traditional hard disk

My LVM volume after restoring from Time Capsule

Just a couple days ago Apple released news that new Macs would have an option called Fusion Drive, a technology that would take a fast SSD and a traditional hard disk to bond the two together to create a “self optimizing” single volume. Apple announced that the new technology was included in Mountain Lion, which made me curious as to whether existing Macs may be able to use the technique and have a Fusion Drive “retrofitted”.

I did a quick search on the web to find this excellent article on Anandtech and a FAQ page by Apple, evidently showing that Fusion Drive is simply a volume created using LVM (Logical Volume Management) that aggregates two physical disks. This is a fairly common practice in the Unix world. It also turns out that Apple had introduced LVM support back in 10.7.4 and some previous analysis was already available on how to use diskutil to manage LVMs, but people had failed to use the addDisk command to add a second physical drive to a LVM group. It is possible that Apple made LVM smarter in 10.8 to distribute data over a group in a more efficient manner, maybe determined by the speed of the underlying physical storage technology. If this theory is correct, that would mean it should all be just a matter of creating a LVM and persuade the OS to run from it.

In the following guide I managed to create a LVM using an SSD and a traditional hard disk, to combine the two to one volume. The machine I used is a MacBook Pro, 17 inch, early 2011. I removed the optical drive and replaced it with a big, traditional hard disk. The original HDD was replaced with a fast, 240GB SATA-3 SSD.

It is difficult to prove that this is exactly the same as to having Apple’s new Fusion Drive enabled, as it is very difficult to determine where individual pieces of the file system are physically stored and if these pieces are actually managed between the two disks actively to achieve better performance. There is a fair chance that there really isn’t more to this than setting up the LVM. Unfortunately I don’t have access to a Mac with a real Fusion Drive to compare the outputs of commands such as”diskutil cs list”. It’s also possible that additional settings are required to enable the active management of the LVM, but according to Apple, every Mac running Mac OS X 10.8.2 should be able to read Fusion Drives in target mode, which at least seems to indicate that current Macs using the latest OS should technically be equipped to deal with a Fusion Drive without requiring further software.

So far the technique has proven itself to run at the speeds I was used to have when I was hosting all apps and the OS on the SSD exclusively. I will continue to verify the performance and see whether it behaves in the same manner as described by Apple and Anandtech. Suggestions on how to most efficiently verify this would be very welcome.

Be warned, this guide is for the tinkerer only and those that don’t mind a total loss of their data. Messing around with diskutil will wipe your disks and you have to rely on a functioning backup to get your data back.

  1. Make a full backup of your data, all of it! If you don’t know how to do this, don’t attempt to follow this guide any further. You have been warned! I used TimeMachine for the backup.
    1. In order to speed things up, you may want to connect your Mac to a Time Capsule using a wired Ethernet connection and turn WiFi off.
    2. If you have a bootcamp partition with Windows, make sure to also backup all of that data.
  2. Make sure you are on Mac OS X 10.8.2
  3. Create a USB restore key with the latest OS X version. You can find instructions on this article on CNET. Apple also provides a tool, but I have not verified whether it will create a key with the latest version of OS X. I downloaded Mac OS X 10.8.2 from the AppStore on a Mac OS X 10.7 machine. That ensured that the restore image (ESD) would be coming with the latest version of OS X available.
  4. Reboot to Recovery Mode with the USB key, holding Alt/Option and choosing the USB key to boot from. This takes you into the recovery mode from where you can access both physical drives properly.
  5. Delete all partitions on both physical drives. You can use Disk Utility for that.
  6. Now open the terminal by going to Utilities -> Terminal
  7. Create a new Logical Volume group with both disks
    1. Use “diskutil list” to identify the names of your physical disks. In my case it was disk0 (SSD) and disk1 (HDD)
    2. Run “diskutil coreStorage create FusionDrive disk0 disk1″. This is the step where others seem to have failed. I figured you could create the LVM by supplying both disks at the same time, instead to creating a LVM with one disk first and then trying to use “addDisk” for the second disk, which doesn’t seem to function. You can also replace the “FusionDrive” string with your own choice of LVM group name. It does not matter what the name is.
    3. List the new LVG using “diskutil coreStorage list”. You should see something like this:

      Get the overall group size and copy the UUID of your LVM, in my case “F628F010-3CFF-4BC7-90CE-CD61EC7C44E1″, then run “diskutil coreStorage createVolume F628F010-3CFF-4BC7-90CE-CD61EC7C44E1 jhfs+ MacintoshFD 975g”. Replace the UUID with your copied LVG UUID and replace 975 with the actual size of your LVG. You can also rename MacintoshFD to whatever you want your main volume to be named to. If the name contains spaces, make sure to contain the string in quotes (“”). Also, make sure to subtract some 10G from the size to leave enough room for a recovery partition.
  8. I did proceed to close the Terminal window and restore a fresh Mac OS X install. You should also be able to restore all your data from a Time Capsule at this point. I did install the OS first to see whether the LVM was bootable and then returned into Recovery Mode to restore from my Time Capsule. After a couple hours my machine booted back into my previous Mac OS X environment.
  9. Congratulations, now you have a Fusion Drive-esque volume. Not only will have higher performance from this setup, you also get the aggregate sizes of your mechanical disk and your SSD, together in one volume.

Like I pointed out earlier, this may just be all the magic behind the new Fusion Drive and I’m currently trying to verify whether this setup behaves the same, or I just created a dumb LVM that lacks the “secret sauce”, like a particular flag being set in the LVM header I don’t know yet about. It would be interesting to compare this setup with a real Fusion Drive and if you have access to a Mac with an actual Fusion Drive shipped by Apple, I encourage you to run the “diskutil coreStorage list/info” commands and post your results in the comments. I’d love to take a look at the real setup. Please let me know if you have an idea at a good strategy to test the setup and verify that it does indeed move data around between the SSD and the HDD in a smart manner.

UPDATE 10/31/2012:

While I wrote this on the weekend and didn’t have much time to dig into verifying whether this setup works like a real Fusion Drive this week ( I do have day job :) ), jollyjinx posted a guide on tumbler on how he went ahead to verify that the above setup does indeed work like you would expect a Fusion Drive to behave. I do have quite a bit of background IO “noise” on my machine, because the LVM is actually hosting the actual OS, but after following JollyJinx’s steps and verifying the results on my own machine and I am pretty much convinced at this point, that Fusion Drive just works “automagically” if you use it with an SSD and a plain old hard drive. After all, the OS has several ways to know that it is actually attached to an SSD by either checking the storage type (I’m sure there is some vendor PID that can be queried from the hardware) or by just keeping performance logs on how the hardware behaves, which would let the OS infer which drive is faster. Despite not leaving much control over whether such behavior is really desired, this is what I would expect from Apple; to employ such heuristics in order to just do what they think is the right thing to do on such hardware.

As to my own results, using iostat in a shell, I was able to see how the IO load was distributed to either one of the disk when writing/reading data, but rarely to both at the same time (which would indicate proper RAID 0 style striping). I could also see that data was moved over from the mechanical disk to the SSD, after accessing some data that was previously read from the HDD. The moment you stop reading such data you can observe IO activity transferring over to the SSD for a while, roughly to the amount of data you were accessing. Accessing the same data again then returns IO activity almost exclusively from the SSD instead of the HDD, which seems to indicate that the OS had decided to move the data over to the faster drive. This sure looks like it’s exactly what Apple was promising with the Fusion Drive.

Sweet, I think I’ll keep this setup!

  • http://www.facebook.com/sfoskett Stephen Foskett

    Excellent work here! I was wondering the same thing – Did Apple bury FusionDrive in CoreStorage and we just haven’t found it yet? It’s possible, but I suspect as you do that there’s more to it than just a drive spanning two drives…

  • Pingback: Is Apple’s Fusion Drive a Hybrid HDD or Tiering Software? – @SFoskett – Stephen Foskett, Pack Rat()

  • der_be

    i think the problem of your attempt is that you can’t tell the system which drive is the fast one. just can’t imagine that the system figures it out on it’s own.

    can’t wait for the first customers whining about 100% data loss they encountered…

    • Andy

      The IO subsystem knows about the parameters of each disk and its effective speed. iostat will show you just that kind of information. As to data loss, I think I stated often enough that this should not be attempted by anyone else than those with an academic interest in the matter.

      • der_be

        I just wrote this with all of that upset customers in mind that have bought a new mac with fusion drive enabled ootb. when it’s about dataloss, this is as insecure as a RAID 0…

        can you provide any benchmark that proves that writes are happening directly on the SSD?

        • Andy

          Oh, I see. Yes, the striping nature of this setup makes failures more likely to happen, that’s for sure!

          I wished I had a little more time to do more research in the matter right now. iostat seemed to show almost a 10:1 ratio of writes/reads happening on the SSD, but I wasn’t able to confirm that this isn’t just due to the data layout on the LVM or whether that was actually an optimization algorithm at work.

  • AlfaG4

    I would know how to incorporate in a Fusion Drive a bootcamp partition and recovery partition

    • Ben

      I would like to know the same. Thanks for the guide, i’ll try it out as soon as i get my hands on an internal SSD but i need bootcamp so i wonder how this is gonna work!
      Thanks a lot for your feedback!

    • AlfaG4

      Actually i’m using on an iMac 2009 a SSD for the Applications and the HDD for the data. The HDD is partitioned with a HFS+ (data) partiontion, Recovery HD partition and BOOTCAMP partition with WinXP installed.

      Creating a “fusion drive” with the entire SSD and HDD HFS+ partition the bootcamp partition should remain intact.

      Suppose for example:

      SSD disk1s2

      HDD data disk2s1

      HDD Recovery HD disk2s2

      HDD BOOTCAMP disk2s3

      Now with:

      diskutil coreStorage create Fusion disk1s2 disk2s1

      and

      diskutil coreStorage createVolume UUID jhfs+ MacintoshFD 100%

      Now i should have a FusionDrive (SSD+HDD) on the “core storage” side and a “classic” partition (RecoveryHD+BOOTCAMP).
      On startup now should be possible booting in WinXP or recovery HD. Probably from WinXP i’m not able to see the fusion drive how to before.

      My assumption can be confirmed?

      • adrian

        Did this work as expected? Did the Recovery and Bootcamp partitions remain intact? I assume the main data partition was destroyed by the “createVolume” command, and you had to reinstall the mac os.

      • adrian

        Another thought: If I partition the SSD in half, can I save the second part (disk1s3) for the BootCamp os and use ReadyBoost (SuperFetch) in the same manner as FusionDrive? Or would the complete SSD be available in bootcamp and I can just use it straight away?

  • Pingback: Fusion Drive - Strona 3()

  • http://www.facebook.com/matthieu.gaillet Matthieu Gaillet

    This Fusion Drive solution is exactly what I looked for when I planned upgrading my 2008 iMac by installing a SSD drive along with a HDD. I finally abandonned this idea because I didn’t want to move files manually between the two over and over.

    Now, my question is : since there is only one SATA port in this iMac, I’d like to install an SSD inside the machine and use an _external_ Firewire 800 – hard drive. Will this setup work as a Fusion Drive ? I’d like to try but I don’t have any SSD drive to test.

    • Andy

      I would not recommend using this approach with any external disk. Your volume will be corrupted the moment you cut the power by accident or trip a wire on your external disk. That makes this an unacceptable risk with external drives. You should consider swapping your optical drive bay for a hard disk and mount another disk internally. There are adapters available on ebay to do that.

      • http://www.facebook.com/matthieu.gaillet Matthieu Gaillet

        Thanks Andy. You comment makes sense although the contents of this machine aren’t really critical and that the disks are backed up constantly by TM.

        The main reason why I didn’t considered this option is that the superdrive is hooked to a PATA port on this model…. I could maybe use a SATA port multiplier, but the bandwidth available will still not be optimal for a SSD/Mechanical drive setup, does it ?

        The last option would be to remove the Wifi miniPCIe and install a SATA controller in place of it.

        • http://www.facebook.com/matthieu.gaillet Matthieu Gaillet

          Well it looks that this last options aren’t real one :

          – the ICH8 family SATA controller doesn’t support Port Multipliers AFAICS

          -the miniPCI SATA controllers available on the market aren’t well supported or expose poor performances.

          Technically, would my setup (external FW800 hard disk, internal SATA SSD) work following you ? Though I think I should accommodate or sell my good ol’ iMac.

          Thanks,

          • Luk

            Hi, im trying do get the Fuison Drive on this Setup.
            Imac 2011 ssd inside and FW800 1tb.

            But im getting en error when im on this Step:
            diskutil coreStorage create FusionDrive disk0 disk13
            output:
            Unmounting disk0

            Error: -69888: Coudnt unmount disk

    • id001

      Yes it works with FW.

  • http://www.facebook.com/finn.poulsen.399 Finn Poulsen

    Very interesting. Is it possible after you have made the fusion drive to boot from a external firewire drive and restore from a superduper clone backup. That will make things much easier. Is it a must to install a fresh system ?

    • http://www.facebook.com/matthieu.gaillet Matthieu Gaillet

      Good question. Another option would be to recover from a TM disk whenever booted on the install media.

    • Tom

      After creating the Fusion Drive I booted from my Firewire HD and restored the SuperDuper clone to the Fusion Drive. Works without problems…

  • Boris

    Hey, this guide is awesome!
    Is there a reason why, at the end of all the steps, mountain lion fails to re-install?
    It says “impossible to download additional components needed to install OS X”, and I can’t continue with the re-install.

  • Boris

    Hey, this guide is awesome!
    Is there a reason why, at the end of all the steps, mountain lion fails to re-install?
    It says “impossible to download additional components needed to install OS X”.
    How could I solve this issue?
    Thanks in advance!

    • Boris Perilli

      I discovered that the key prepared was corrupted. Downloaded again Mountain lion install, worked perfectly.

  • der_be

    can anybody confirm that filevault 2 works with a DIY fusion drive?

    • hacke

      *PUSH*

    • hacke

      yes: “One more thing I tried on the Fusion Drive: FileVault 2: I switched on FileVault, the Mac rebooted, started with the FileVault-login-screen and I logged on. At this moment it is encrypting the disk while I’m working on it.” (google hit)

  • Mario

    Very interesting. I have got a 120GB SSD and a 1TB HDD in my iMac and I will try the same.
    However, in the news, they write that there is a 4GB write buffer in the apple fusion drive (placed on the SSD). Any idea how this can be realized manually?

  • Dave rose

    Attempting this, I run the diskutil cs create FusionDrive disk1 disk0. It comes back with a logical volume group, and 2 sub groups, phys volume 0 and 1 listed by uuid. There is no logical volume family entry as shown above. Also, I can not get the diskutil cs createvolume uuid jhfs+ FusionLVM 735g to work. It just errors as error -69780 unable to create a new corestorage logical volume.

    Diskq
    1 is a 256 ssd and disk0 is a 500 magnetic hd.

    Any thoughts?

  • Pingback: Manual Fusion Drive Configuration | Ramblings in Code()

  • Luk

    Hi, im trying do get the Fuison Drive on this Setup.
    Imac 2011 ssd inside and FW800 1tb.

    But im getting en error when im on this Step:
    diskutil coreStorage create FusionDrive disk0 disk13
    output:
    Unmounting disk0

    Error: -69888: Coudnt unmount disk

    • Luk

      ok, i found my problem. I didnt used die USB recovery

  • TryPod Tech

    Here’s a video detailing the process : http://www.youtube.com/watch?v=I_odnNpv-FQ

  • John

    I’ve tried this approach to creating a fusion drive several times. While I can create the fusion drive and install a working OSX on it, the process does not seem to create a recovery partition. When I boot in option mode, I see MacintoshFD listed twice but no recovery partition. Clicking on either MacintoshFD icon boots to the normal OSX install but not the recovery partition. I’ve tried several permutations without success. Hopefully someone can identify the problem I’m having. (Andres, did you verify that you get a recovery partition when you tried this?)

    Hardware: iMac 27″ 2010 with added 256GB SSD and upgraded HDD to 3TB WD HDD. disk0 is the SSD and disk1 is the HDD.

    1st attempt using all disk space for 1 logical volume:
    Created one LGV with diskutil cs create FusionDrive disk0 disk1
    Ran diskutil cs createVolume jhfs+ MacintoshFD 100%
    Result: Successful OSX install but no recovery partition as described above.

    2nd attempt: Created LVG but left some unused space on it:
    Created one LGV with diskutil cs create FusionDrive disk0 disk1

    Ran diskutil cs createVolume jhfs+ MacintoshFD 3.1T (the volume size was 3.2T so this left about 100GB unused)
    Result: Successful OSX install but no recovery partition as described above.

    3rd attempt: Created LVG but left space outside LVG for recovery part ion
    First partitioned disk1 into a 100G jhfs+ partition and the rest of the space in the second partition.
    Created one LGV with diskutil cs create FusionDrive disk0 disk1s3 (the second partition of disk1 with 2.9TB of space)

    Ran diskutil cs createVolume jhfs+ MacintoshFD 3.1T
    Result: Successful OSX install but no recovery partition as described above.

    Here’s my current diskutil list and diskutil cs list from 3rd attempt attached as pictures

    Any ideas? Is the 3TB size of the HDD causing issues?

    Thanks for any help.

    John

    • der_be

      same issue here, had to clone a recovery hd manually to a second partition that I’ve added post-installation

      • John

        Thanks!
        How did you clone the recovery partition? Was the recovery partition on the LVG or the non LVG part of the disk?
        Thanks,
        John

        • der_be

          make a recovery stick using apple recovery disk assistant and make it visible (shell: defaults write com.apple.DiskUtility DUDebugMenuEnabled 1). add a partition (1gb) via disc utility and restore the new recovery hd to the spare partition (also using discutil).

          • John

            Thanks again. I found that the apple recovery disk assistant needs to work from an intact recovery partition on the hard drive so instead I installed OSX on the 100GB partition I left outside the LVG and it created a recovery partition. I then erased the extra copy of OSX and am good.

    • AlfaG4

      With Fusion Drive installed on startup the recovery partition is not visible, you can see only the two fusion drive and eventually the bootcamp partition. To boot in recovery mode you must press cmd+R after the startup chime.

      To be sure that the recovery partition is present type: “diskutil list”

      This is my output:

      /dev/disk0

      #: TYPE NAME SIZE IDENTIFIER

      0: GUID_partition_scheme *256.1 GB disk0

      1: EFI 209.7 MB disk0s1

      2: Apple_CoreStorage 255.7 GB disk0s2

      3: Apple_Boot Boot OS X 134.2 MB disk0s3

      /dev/disk1

      #: TYPE NAME SIZE IDENTIFIER

      0: GUID_partition_scheme *1.0 TB disk1

      1: EFI 209.7 MB disk1s1

      2: Apple_CoreStorage 929.4 GB disk1s2

      3: Apple_Boot Boot OS X 650.0 MB disk1s3

      4: Microsoft Basic Data BOOTCAMP 64.8 GB disk1s4

      /dev/disk2

      #: TYPE NAME SIZE IDENTIFIER

      0: Apple_HFS Fusion *1.2 TB disk2

      The disk1s3 is my Recovery Partition created with a clean ML install without any preexistent recovery partition.

      The only problem is that in my case (iMac2009) cmd+R does not works has expected and to enter the recovery i must reset the NVRAM with cmd+alt+P+R before pressing cmd+R.
      I must do this every time i want boot in recovery mode. Probably is an EFI bug or my iMac is unsupported.

  • http://ashleyw.co.uk Ashley Williams

    Thanks Andres, this is working great for me!

    I have a 2011 iMac (256GB SSD + 1TB HDD), and I wonder if it’d be possible to have the SSD and a 256GB partition on the HDD in a mirrored RAID, then join that RAID and 768GB HDD portion via LVM? Would that even be possible in software?

  • Pingback: Replacing Optical Drive with an SSD on Macbook Pro | 人肉联播()

  • Pingback: Fusion Drive on iMac 2011 » Niklas Saers' blog()

  • Pingback: My DIY Fusion Drive « Jack of All I.T.()

  • http://twitter.com/nathanchow Nathan Chow

    Thanks so much for this! I’m running a fusion drive on my 256 SSD + 2TB HD iMac and I love it!

    • http://www.facebook.com/chloe.sammo Chloe Sammo

      How is the fusion system? I am thinking about creating it myself.

  • Pingback: Deswegen ein Mac! | Gibt's doch garnicht()

  • Pingback: DIY: Apple´s Fusion Drive im Eigenbau | pixelbalztanz()

  • Bart

    Hi Andy, thanks for this excellent article! I set it up on a 2010 Macbook pro and it works like a charm! I didn’t dive to deep into iostat but all seems to work automagically indeed.

  • Fred

    OWC is reporting that this only creates “true” Fusion drive under 10.8.2 if you are using diskutil that came with the Mac Mini late 2012. Otherwise, it does not intelligently reallocated data between the disks. This seems at odds with jollyjix’s report, but OWC generally know what they’re about: http://blog.macsales.com/15617-creating-your-own-fusion-drive

  • George Abood

    Worked however my MBP now freezes whenever I open certain applications, any thought?

    • Jiri Hracek

      Hi George,

      the same for me. I have made the Fusion drive in iMac 2011, made a clean Mavericks installation and when I open certain app the OS X freezes (once its Safari, other time the other apps) and have to power it down by holding the power button.

      Have you figured it out somehow?

      Thanks.

  • Pingback: MBP 17″ HDD update | dirkvoorhoeve()

  • http://www.islamadel.com/ Islam Adel

    http://www.islamadel.com/en/notes/6-computer/30-operation-fusion-drive-on-macbook-pro

    for the size you can type 100% instead of actual size in g

    diskutil coreStorage createVolume 2B4EDB74-5842-40E4-8398-1567CD879127 jhfs+ FusionDrive 100%

  • http://twitter.com/pongstr Pongstr Ordillo

    hey man, I was wondering whether you can enable TRIM when in Fusion, is it necessary to have TRIM on?

  • Pingback: Fusion Drive - opinie, osiągi()

  • Pingback: Fusion Drive on an 27-inch, Mid 2011 iMac | Serious Piffle()

  • Pingback: SSD + HDD 混搭 Fusion Drive ( OS X 10.8.2) | AppleWalker 愛波沃克()

  • Otto

    I tried this on OS X 10.10 Yosemite and it didn’t work. The problem was in deleting the partitions on the drives (step 5), apparently the recovery partition can’t be deleted. Even booting from USB didn’t work. After some experimenting I made a bootable USB stick with Mavericks which did the job. The 2011 iMac is faster than ever!