November 2012 Archives

DIY Mac Fusion Drive

One of the recent announcements from Apple is that you can get some of the new Macs with Fusion Drive, which combines a fast but small SSD (Solid State Disk) with a large, slow, but cheap conventional hard drive. Other companies have done this, but one of the neat things is that Fusion Drive is built right into OSX 10.8 Mountain Lion and instead of being a cache, it migrates files back and forth between the drives in the background, putting the stuff that's most beneficial to performance on the SSD. Being part of the OS it has much better knowledge of this than at the drive level. Neat!

There were also reports that it's also not some special drive, it's pretty much an off-the-shelf SATA SSD plus a regular SATA hard disk. I got some hints that it was possible from this article which referenced the great work here which made me pretty confident that it would work.

So, the obvious question is: can you build one yourself and use it on an older Mac? YES!

I should point out that this is highly experimental, there is a high risk of accidentally destroying all of the data on your hard drive and who knows how stable it actually is, though I have been impressed so far. You should probably think twice about doing this on a computer you use for real work, because it's experimental. I did do it on my main computer, but I also have several others I can rely on while restoring the machine back to working order.

But I will say that it's FAST. Seriously fast. It's like getting a brand new computer.

There are some updates to this post, scroll down to the bottom before you embark!


What You Need

You'll need a Mac running OSX 10.8 "Mountain Lion." I tested it on a 2010 MacPro with 10.8.1 and even did the upgrade from 10.8.1 to 10.8.2 running off the new Fusion Disk successfully, and very quickly!

fusion1.jpg
You need room for at least two internal hard drives. This pretty much rules out most of the laptops, except if you have a  MacBookPro with a DVD drive, Other World Computing has a mounting bracket that allows you to remove your DVD drive and replace it with an SSD. I'm thinking about getting one, since I never use the DVD drive. OWC has brackets for all sorts of machines, so you should check there.

You may need an adapter to mount a 2 1/2" SSD in a 3 1/2" drive bay. OWC has a replacement sled that will directly mount a 2 1/2" SSD in a MacPro, but I didn't know about it at the time, and instead I used a Icy Dock 2.5" to 3.5" SSD HDD Converter. It's pretty cool, and less than $ 20.

fusion2.jpg
You'll need an SSD. I really wasn't sure if this was going to work so I got a 128 GB OCZ Vertex 4 for $ 105, which was on the recommended list at Tom's Hardware.

Note that many 2 1/2" SSDs include a 3 1/2" adapter bracket, however the one that came with my OCZ drive only has side mount holes for screws. The MacPro sled uses the bottom mount screw holes, so I needed the more elaborate adapter above.


You'll need another hard drive. I could not figure out how to build a Fusion Disk without wiping out the contents of the drive, so you'll probably want to get another drive, which would also come in handy if disaster occurs, which it certainly might. I don't recommend only relying on your Time Machine backup to restore your data. Not only will it take longer, but this is risky enough that I recommend having two backups.

If you only have room for 2 drives, you'll also need an external case because you'll need to be able to plug in your old drive as well as your new drive to do the copy. I used a MacPro and had enough free drive bays to do everything internally.


You'll need the OSX Mountain Lion Installer. If you didn't make a copy of it before running it when you upgraded from Lion to Mountain Lion, you'll have to download it from the App Store again, as the installer deletes itself after running.


You'll need pretty good Mac knowledge and comfort with the command line prompt, as you cannot create a Fusion Disk from the regular Disk Utility program (at least as of 10.8.2). You gotta go to the command line.


Here we go!

Do whatever you need to get your drives installed. This is super easy on the Mac Pro, much less so on some other machines. Here are my drives mounted on their sleds ready to go back in. Make sure the machine is shut down! Actually, you probably should have done that before opening it to remove the sleds.


fusion3.jpg
Since I was using a MacPro my regular hard disk was still installed so I was able to boot off that. If you've moved your real hard drive to an external case you may need to hold down the Option key when starting up to select that drive as your startup disk, though maybe it will find it automatically.

Once running you'll probably be prompted to format your newly attached drives, and it's okay to do so. It only takes a few minutes. If you're doing it manually from Disk Utility you probably want GUID Partition Table with a HFS (Journaled) format. Initially I named these volumes "SSD" and "Empty."

Here's where we deviate a little from what jollyjinx did. Since he was only testing and didn't need to boot off his Fusion Drive, he didn't have to do this. There is probably an easier way to do this, but this didn't take long and I was more confident this would work.

I should point out what does not work: Making the Fusion Disk use the entirety of both disks and then using SuperDuper to make the drive bootable. I suspect that SuperDuper modifies the partition table to add the EFI partition but has no idea what to do with the CoreStorage volume and makes it smaller in a way that corrupts it. So don't do that. I did that first and got a Kernel panic. Not good.

Run the Mountain Lion installer and select the Other Disks option to install onto the SSD. This is very fast. You will have to reboot onto the SSD to finish the installation.
When you create a new user for your fresh Mountain Lion install do not use the same username you normally use to log in! Create a temporary one with administrator privileges and use that. It will make your life easier later on. Don't do your data migration yet, either.

On my MacPro, it took less than 20 minutes to do a clean Mountain Lion install, which is quite impressive. If you want, play around with your new install for a few minutes. It's crazy how you click on the Safari icon and it just pops open like it was already running!


Now boot back onto your real system. Run Disk Utility.

Select the SSD volume (the one one level indented, not the drive) and click the New Image icon at the top of the screen. Select a place to save a copy of the image on your hard disk. You'll need this because creating the Fusion Drive erases the contents of the drives or partitions and you'll need to restore a working system on your new drive.

Now would also be a good time to turn off Time Machine (temporarily) and if you use Time Machine to an external drive, disconnect the drive now. Typing a character wrong into command line diskutil can obliterate a disk in less than a second, so you want to make sure you at least can't delete your backup as well as your main disk, accidentally.

Here's where things get scary. You'll need to run the Terminal program to get at the command line so you can use the command line diskutil. The GUI Disk Utility doesn't have support for creating CoreStorage volumes, which are (apparently) the technology behind Fusion Drive.

The first command you'll need is

diskutil list

This will get you a nice list of all of your drives and partitions. In particular, you'll want to locate the Apple_HFS partitions on your SSD and your new, blank drive. Also, make sure you've figured out which disk is your real, working boot drive and never issue any commands directed at it!

For example, this is my SSD after installing Mountain Lion on it:

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *128.0 GB disk0

1: EFI 209.7 MB disk0s1

2: Apple_HFS SSD 127.2 GB disk0s2

3: Apple_Boot Recovery HD 650.0 MB disk0s3


Line #2 says Apple_HFS SSD and is the right size. We'll need that disk number ("disk0s2") later on. Note that it says "SSD" not because it knows it's an SSD, but because when I formatted it, I named the volume "SSD."

I installed Mountain Lion on the SSD to get the correct EFI, partitions and even a recovery disk. We don't really need recovery on the SSD, but it's pretty small and I was afraid I'd either break something removing it or a future OS update would break something trying to put it back. Best to leave things alone!

Here's scary command #1. Note: Yours will almost certainly be different! Don't just copy and paste this command. Very bad things can happen!

diskutil cs create fusion disk0s2 disk3s2


This creates a CoreStorage ("cs") volume named "fusion" (you can change this name) across the partitions disk0s2 and disk3s2. You won't actually see this name except in diskutil or Disk Utility.

In the jolyjinx experiment he used entire volumes (disk1 and disk7) but you can't do that and make a working bootable volume. You must only use the HFS partitions to make the CoreStorage volume if you want to make a bootable volume!

Now see what we got.

diskutil cs list


MacPro-2:~ rickk$ diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group 67E24127-58DA-482E-94D5-4A4E964FA546
    =========================================================
    Name:         fusion
    Size:         2126715092992 B (2.1 TB)
    Free Space:   57344 B (57.3 KB)
    |
    +-< Physical Volume FD16A15C-13E4-4240-99B2-97E29B329851
    |   ----------------------------------------------------
    |   Index:    0
    |   Disk:     disk0s2
    |   Status:   Online
    |   Size:     127175917568 B (127.2 GB)
    |
    +-< Physical Volume F37D9F24-607E-45C5-B5E6-A1DDBB942612
    |   ----------------------------------------------------
    |   Index:    1
    |   Disk:     disk3s2
    |   Status:   Online
    |   Size:     1999539175424 B (2.0 TB)

You'll need the GUID for the Logical Volume group ("67E24127-58DA-482E-94D5-4A4E964FA546" for me) in the next step.

Here's scary command #2. Don't copy and paste this. Your GUID will be different!

diskutil cs createVolume 67E24127-58DA-482E-94D5-4A4E964FA546 jhfs+ Fusion 100%

 
This creates a CoreStorage volume on the Logical Volume Group with the specified GUID. Formatted as jhfs+ (Journaled HFS+). With the volume name "Fusion" (feel free to change). With the volume using 100 % of the available space.

Now if you do another diskutil cs list, you'll see another section at the bottom:

    +-> Logical Volume Family 2FC04E0E-4B55-43DB-8035-5E640BCBA4B4
        ----------------------------------------------------------
        Encryption Status:       Unlocked
        Encryption Type:         None
        Conversion Status:       NoConversion
        Conversion Direction:    -none-
        Has Encrypted Extents:   No
        Fully Secure:            No
        Passphrase Required:     No
        |
        +-> Logical Volume EC00B418-C9A1-4590-B6E3-0C77822D6B13
            ---------------------------------------------------
            Disk:               disk4
            Status:             Online
            Size (Total):       2119203815424 B (2.1 TB)
            Size (Converted):   -none-
            Revertible:         No
            LV Name:            Fusion
            Volume Name:        Fusion
            Content Hint:       Apple_HFS

Note that the logical volume has a size of 2.1TB, the size of the two drives put together! Neat!

We're done with the command line diskutil command, and you probably want to fire up the GUI Disk Utility app.

There should be a new drive, in my case the drive is named "fusion" and it's formatted as a volume "Fusion" (capital F, and indented one level). If I click on the Fusion drive then then Restore I want to restore from the SSD image we created earlier and put it on the Fusion volume (not the drive). This should take less than a minute.

Now go into the System Preferences and select Startup Disk. Select Fusion as your startup disk. You could use use the Option key while booting, but the Startup Disk control panel does some extra checks to make sure everything is good, so it's not a bad idea to try this out. Then reboot.

If everything is good, with any luck your machine will boot really quickly into your clean Mountain Lion install like it did before. But now if your Get Info on the Fusion hard disk you'll notice that it's the size of your two drives put together! In my case, 2.1 TB but it boots super fast like it's using the SSD, which it is!

You now have a working Fusion Drive boot drive! Congratulations!

By the way, if you want to watch what's going on with your SSD and HD, run a command like this from the command line:

iostat -w 1 disk0 disk3

This will output once per second (-w 1) the activity on disk0 and disk3. Substitute the disk numbers for your disks, of course.

MacPro-2:~ rickk$ iostat -w 1 disk0 disk3
          disk0           disk3       cpu     load average
    KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
   59.70  57  3.33   254.78  90 22.36   3  2 95  0.74 0.77 0.81
    6.67   3  0.02     0.00   0  0.00   2  1 97  0.74 0.77 0.81
    6.67   6  0.04     0.00   0  0.00   1  0 98  0.74 0.77 0.81
    0.00   0  0.00     0.00   0  0.00   2  1 97  0.74 0.77 0.81

You can use this to see how much data is being read or written to each disk. It's kind of fun!

The last step is getting all of your data over. You could use a program like SuperDuper or boot into the recovery disk and use Disk Utility to copy the HFS partition from your old drive to your new Fusion drive. What I did instead was use Migration Assistant. Interestingly it was faster than SuperDuper was, and it's kind of nice to start out with a clean install of Mountain Lion since I'd upgraded this machine one or two major versions already.

I ran the Migration Assistant in Applications/Utilities and told it I wanted to copy from a disk, which it happily and pretty quickly did. It took somewhere between 5 and 7 hours. I fell asleep while it was copying so I don't know exactly how long it took to copy 1.5 TB of data.

After that, I shut down the machine, popped the old, working, non-Fusion disk and set it aside for safe keeping/emergencies. I renamed the new "Fusion" volume to the old drive name ("Macintosh HD").

I also swapped out my Time Machine backup disk for a new, blank one, though that wasn't strictly necessary. I wasn't sure if backing up the new disk was going to trigger all of the files to be updated in the backup or not, so I just played it safe and swapped in a new backup set. I was due to do that so I could rotate a backup disk off-site anyway.


Closing Thoughts

I think this will be the future of storage in the near term, at least for people who have a need for big data, especially in desktop computers. Just a guess but as more stuff moves into the cloud and flash gets cheaper future generations of laptops will probably only have flash, like the MacBook Air.

One of the complaints about this setup is that if one drive fails, the whole volume is shot. This is true. But the SSD tends to be very reliable and you need a backup in case the hard disk dies, anyway, so i don't see it as a big deal.

There is a complaint that this is software and it might fail. True enough, but CoreStorage is the technology behind the Apple software RAID, and it's been used for quite some time pretty successfully. Besides people have managed to corrupt a regular HFS+ volume with no CoreStorage, so you still need to have a backup in case something bad happens. That's what hourly TimeMachine backups are for.

What are the downsides? Well aside from being uncertain whether it will suddenly fail, I haven't really found any.

Did I mention that the new setup is fast? Booting is unreal. I normally have 15 or so apps running, and I used to hate to reboot because it would take forever to boot and even longer for all of the apps to restart. If a lot of apps were starting up, sometimes the dock icon would bounce maybe a dozen times before popping open. Now, pretty much everything opens in one bounce.

Aperture is wonderful. I have a reasonably large (93 GB) Aperture library and it now it not only launches but to a state where I can do work in under 3 seconds. Same for Photoshop. Neat stuff.


Update

It's November 26, 2012 and I've been using this setup for almost 3 weeks. It's amazing! It's so fast, and I haven't had any unexplained crashes or kernel panics, so I'm getting more confident that this is pretty stable. Still, the act of creating one is fraught with peril, so still beware when doing it.

Update October 23, 2013: I've been using the same drive setup since last year and it's still working great. I upgraded from Mountain Lion to Mavericks yesterday evening, and everything is still working properly!

Update June 3, 2014: It worked great until yesterday, when I tried to install Yosemite developer preview. The installation made it almost all the way through, but then something horrible happened. It froze, then I got a kernel panic early in boot. The core storage volumes had become separated. It was tempting fate to do an upgrade to an early developer preview, but it worked so smoothly in the past! I don't currently have the Fusion Disk installed because I didn't realize it had broken the core storage volume when I restored the machine, and I didn't want to recreate the volume and restore it again. So this technique is currently no longer being actively tested.

Update June 15, 2014: I reinstalled the Fusion drive. It's remarkable how much slower my computer is with just a regular hard drive! And it's not a slow drive, either, it's a Western Digital Caviar Black 7200 RPM drive with 64 MB cache. But it's noticeably faster with the Fusion Drive, so much so that I couldn't take the slowness anymore and reinstalled. Also, the Fusion Drive makes the computer significantly quieter!

Update October 19, 2014: Upgraded to Yosemite 10.10, and it worked perfectly. No problems with installation and it seems to be running smoothly!

About this Archive

This page is an archive of entries from November 2012 listed from newest to oldest.

October 2012 is the previous archive.

December 2012 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages