Since Apple has announced the Fusion drive, people have wondered if it’s possible to use the fusion drive on older machines with a SSD and HDD.

Fusion drive uses a core storage VolumeGroup as can be seen in this Apple support document

Well, let’s try create our own Fusion drive: Attached are a 120GB SSD (disk1) and a 750GB HDD (disk7) to my Mac. I attached the SSD via SATA to be sure that the system could figure out that it’s a SSD via SMART. The HDD is attached via USB. USB I chose to clearly see a difference in speed.

Part One - setting up a Fusion drive

Now enter the depths of diskutil by using Terminal:

TIN>diskutil cs create bla disk1 disk7
Started CoreStorage operation
$<3>Unmounting disk1
$<3>Repartitioning disk1
$<3>Unmounting disk
$<3>Creating the partition map
$<3>Rediscovering disk1
$<3>Adding disk1s2 to Logical Volume Group
$<3>Unmounting disk7
$<3>Repartitioning disk7
$<3>Unmounting disk
$<3>Creating the partition map
$<3>Rediscovering disk7
$<3>Adding disk7s2 to Logical Volume Group
$<3>Creating Core Storage Logical Volume Group
$<3>Switching disk1s2 to Core Storage
$<3>Switching disk7s2 to Core Storage
$<3>Waiting for Logical Volume Group to appear
$<3>Discovered new Logical Volume Group "DE85044F-EADA-4F26-93B7-8CD0ADF006EC"
$<3>Core Storage LVG UUID: DE85044F-EADA-4F26-93B7-8CD0ADF006EC
$<3>Finished CoreStorage operation


TIN>diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group DE85044F-EADA-4F26-93B7-8CD0ADF006EC
	=========================================================
	Name:         bla
	Size:         869502550016 B (869.5 GB)
	Free Space:   865776689152 B (865.8 GB)
	|
	+-< Physical Volume 682DCC34-74A4-4290-80AE-EB127BA24746
	|   ----------------------------------------------------
	|   Index:    0
	|   Disk:     disk1s2
	|   Status:   Online
	|   Size:     119690149888 B (119.7 GB)
	|
	+-< Physical Volume 5FA828A9-3EDD-4CBC-8C93-27C0E07C2E8A
		----------------------------------------------------
		Index:    1
		Disk:     disk7s2
		Status:   Online
		Size:     749812400128 B (749.8 GB)


TIN>diskutil coreStorage createVolume DE85044F-EADA-4F26-93B7-8CD0ADF006EC jhfs+ blub 500g                                                                                           (13:12:32)
Started CoreStorage operation
$<3>Waiting for Logical Volume to appear
$<3>Formatting file system for Logical Volume
$<3>Initialized /dev/rdisk8 as a 466 GB HFS Plus volume with a 40960k journal
$<3>Mounting disk
$<3>Core Storage LV UUID: 6CBDCB9F-A08E-4E79-BDA7-69853BA24C1E
$<3>Core Storage disk: disk8
$<3>Finished CoreStorage operation

Now in DiskUtility the individual disks no longer show, but the Logical Volume (LV) shows as one disk. Part One is finished, we’ve created a single Volume consisting of a SSD and a HDD.

Part Two - writing data to the fusion drive

Before we start testing let’s turn off spotlight on the volume:

TIN>sudo mdutil -i off /Volumes/blub
/Volumes/blub:
	Indexing disabled.

Let’s see how this Volume performs when writing data onto it:

TIN> cd /Volumes/bla
TIN> for d in {00..13}
do
mkdir $d                   
for f in {000..100}
mkfile 100m $d/$f
done

This will create directories 00 till 13 with 100 files each 100 Mbytes in size. So 14 times 10 GB a total of 140 GBytes. While this job runs, let’s see what happens on the disks:

TIN> iostat disk1 disk7 1
		  disk1           disk7       cpu     load average
	KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
  127.89 1138 142.14     0.00   0  0.00   2 13 84  2.36 1.75 1.23
  127.90 1180 147.39     0.00   0  0.00   2 13 84  2.36 1.75 1.23
  127.89 1147 143.21     0.00   0  0.00   2 13 84  2.36 1.75 1.23
  127.89 1178 147.15     0.00   0  0.00   4 14 83  2.49 1.79 1.25
  127.89 1150 143.66     0.00   0  0.00   5 15 81  2.49 1.79 1.25
  126.79 1192 147.59     0.00   0  0.00   3 15 82  2.49 1.79 1.25
  127.89 1096 136.91     0.00   0  0.00   4 17 79  2.49 1.79 1.25
  127.89 1176 146.85     0.00   0  0.00   3 15 82  2.49 1.79 1.25
  127.90 1183 147.77     0.00   0  0.00   2 13 84  2.53 1.81 1.26
  127.89 1144 142.90     0.00   0  0.00   2 13 84  2.53 1.81 1.26

So it’s clearly using disk1 ( the SSD ) which is expected. Later on directory 11 gets created ( a total of 120 GB had been written to the LV by then) it changes to look like this:

  127.89 1135 141.77     0.00   0  0.00   2 12 86  1.83 1.75 1.27
  127.89 1161 145.02     0.00   0  0.00   3 13 83  1.83 1.75 1.27
  127.90 1190 148.64     0.00   0  0.00   2 13 85  1.83 1.75 1.27
  127.79 1152 143.77     0.00   0  0.00   2 13 85  1.83 1.75 1.27
  127.90 1183 147.77     0.00   0  0.00   2 13 85  1.83 1.75 1.27
  127.90 1203 150.26     0.00   0  0.00   2 13 85  1.77 1.74 1.27
  121.93 1158 137.85     0.00   0  0.00   2 13 85  1.77 1.74 1.27
  127.89 1132 141.40     0.00   0  0.00   2 13 85  1.77 1.74 1.27
  127.89 1154 144.14     0.00   0  0.00   2 13 86  1.77 1.74 1.27
  127.90 1184 147.83     0.00   0  0.00   2 13 85  1.77 1.74 1.27
  127.78 1144 142.77     0.00   0  0.00   2 13 85  1.71 1.72 1.27
		  disk1           disk7       cpu     load average
	KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
  127.20 260 32.25     0.00   0  0.00   1  4 96  1.71 1.72 1.27
   28.00   6  0.16     0.00   0  0.00   1  0 99  1.71 1.72 1.27
	0.00   0  0.00     0.00   0  0.00   0  0 99  1.71 1.72 1.27
	0.00   0  0.00     0.00   0  0.00   0  0 99  1.71 1.72 1.27
	0.00   0  0.00     0.00   0  0.00   0  1 99  1.57 1.70 1.26
	0.00   0  0.00     0.00   0  0.00   2  1 96  1.57 1.70 1.26
	0.00   0  0.00     0.00   0  0.00   1  1 99  1.57 1.70 1.26
	0.00   0  0.00     0.00   0  0.00   0  0 99  1.57 1.70 1.26
  103.40 863 87.11   100.00   9  0.88   1  8 91  1.57 1.70 1.26
   92.77 490 44.41   127.76 165 20.55   1  6 93  1.68 1.72 1.27
   13.22  92  1.19   128.00 216 26.96   2  4 94  1.68 1.72 1.27
   12.62 104  1.28   128.00 227 28.33   1  3 96  1.68 1.72 1.27
   12.53 105  1.28   127.44 229 28.46   0  3 97  1.68 1.72 1.27
   13.83 103  1.39   128.00 228 28.45   1  3 96  1.68 1.72 1.27
   12.71 102  1.26   128.00 228 28.46   4  4 91  1.71 1.72 1.27

So it’s clearly using the HDD now. So to tell the System that we now want to have the data on the SSD we have to just access the data stored in directories 11-13:

TIN>while `true`
do
for d in {11..13}
for i in $d/*; do echo $i;
dd if=$i of=/dev/zero bs=1m
done
done

The iostat output on a different Terminal shows in the beginning:

		  disk1           disk7       cpu     load average
	KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
	0.00   0  0.00     0.00   0  0.00  14  1 85  0.80 0.79 0.86
	0.00   0  0.00     0.00   0  0.00  13  1 86  0.80 0.79 0.86
	0.00   0  0.00     0.00   0  0.00  14  1 85  0.82 0.80 0.86
	0.00   0  0.00     0.00   0  0.00  13  1 87  0.82 0.80 0.86
	0.00   0  0.00     0.00   0  0.00  13  1 86  0.82 0.80 0.86

which is expected as everything is in the warm caches of the OS. Let’s wait a while and we see that it begins to actually read from the disks:

		  disk1           disk7       cpu     load average
	KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
	0.00   0  0.00     0.00   0  0.00  13  1 87  1.09 0.86 0.88
	0.00   0  0.00     0.00   0  0.00  15  6 79  1.09 0.86 0.88
  128.00 1386 173.22     0.00   0  0.00  16  8 77  1.08 0.86 0.88
  127.94 654 81.70   127.48 170 21.13  13  3 83  1.08 0.86 0.88
	0.00   0  0.00   128.00 279 34.83  13  2 85  1.08 0.86 0.88
	0.00   0  0.00   128.00 280 34.95  13  2 85  1.08 0.86 0.88
	0.00   0  0.00   127.53 271 33.71  13  2 85  1.08 0.86 0.88
	0.00   0  0.00   128.00 280 34.94  14  2 84  1.16 0.88 0.88

and later in the process it reads data from the first disk as well ( presumably directory information ):

		  disk1           disk7       cpu     load average
	KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
   15.06  68  1.00   128.00 209 26.08   1  1 98  1.02 0.79 0.73
   16.22  73  1.15   128.00 221 27.58   1  1 98  1.02 0.79 0.73
   13.71  84  1.12   128.00 222 27.71   0  1 98  1.02 0.79 0.73
   16.70  69  1.12   128.00 215 26.86   2  1 96  1.02 0.79 0.73
   13.71  84  1.12   128.00 201 25.09   1  2 98  1.02 0.79 0.73
   14.67  72  1.03   128.00 211 26.34   1  1 98  0.93 0.78 0.72
   14.52  92  1.30   128.00 211 26.33   1  1 98  0.93 0.78 0.72
   16.70  69  1.12   128.00 215 26.83   1  1 98  0.93 0.78 0.72
   13.71  84  1.12   128.00 209 26.11   1  1 98  0.93 0.78 0.72

I left this running for quite some time to show the system that I really only read the files in 11 to 13. Then I stopped the process.

Part Three - Fusion starts working

Interesting enough the disks did not stop working ! Immediately the system began shovelling data from the SSD to the HDD (line 7 in this output was when I stopped the dd reading).

		  disk1           disk7       cpu     load average
	KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
   17.23  91  1.53   128.00 213 26.58   0  1 99  0.69 0.73 0.71
   15.06  68  1.00   128.00 217 27.08   2  2 96  0.80 0.76 0.71
   16.37  86  1.37   128.00 227 28.33   1  1 98  0.80 0.76 0.71
   15.06  68  1.00   128.00 204 25.46   1  2 97  0.80 0.76 0.71
   15.06  68  1.00   128.00 216 26.96   1  1 98  0.80 0.76 0.71
   41.35 169  6.81   126.80 103 12.73   5  2 92  0.80 0.76 0.71
  128.00 197 24.59   128.00 198 24.72   1  1 99  0.73 0.74 0.71
  128.00 199 24.84   128.00 198 24.71   0  1 98  0.73 0.74 0.71
  128.00 196 24.46   128.00 197 24.59   1  1 98  0.73 0.74 0.71
  128.00 236 29.46   128.00 236 29.46   1  1 98  0.73 0.74 0.71
  108.38 263 27.80   128.00 220 27.46   0  1 98  0.73 0.74 0.71
  128.00 197 24.59   128.00 196 24.46   1  1 99  0.68 0.73 0.71
  128.00 198 24.74   128.00 198 24.74   0  1 99  0.68 0.73 0.71
  128.00 215 26.84   128.00 217 27.08   0  1 99  0.68 0.73 0.71
  126.51 242 29.85   128.00 238 29.71   1  1 98  0.68 0.73 0.71
  106.31 260 26.95   128.00 212 26.46   1  1 98  0.68 0.73 0.71

The size on tranfered to/from the drive 1 and 7 is nearly identical. After around 600 seconds or around 14 GB of copying it stopped:

		  disk1           disk7       cpu     load average
	KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
  128.00 193 24.09   128.00 193 24.09   2  2 96  0.49 0.75 0.72
  128.00 190 23.72   128.00 190 23.72  20 14 66  0.49 0.75 0.72
  128.00 213 26.58   128.00 214 26.71   1  1 97  0.49 0.75 0.72
  128.00 236 29.46   128.00 236 29.46   2  2 96  0.49 0.75 0.72
  102.17 251 25.02   127.37 197 24.48   3  2 94  0.53 0.76 0.72
  128.00 192 23.96   128.00 192 23.96   1  1 98  0.53 0.76 0.72
  128.00 195 24.34   128.00 196 24.46   0  2 98  0.53 0.76 0.72
  128.00 216 26.96   128.00 216 26.96   0  1 99  0.53 0.76 0.72
  128.00 229 28.58   128.00 229 28.58   1  1 98  0.53 0.76 0.72
  111.75 251 27.35   128.00 216 26.96   1  1 98  0.49 0.74 0.72
  128.00 200 24.96   128.00 201 25.09   1  1 98  0.49 0.74 0.72
   86.39 124 10.44   128.00  81 10.11   0  1 99  0.49 0.74 0.72
	0.00   0  0.00     0.00   0  0.00   4  2 95  0.49 0.74 0.72
	0.00   0  0.00     0.00   0  0.00   3  1 95  0.49 0.74 0.72
	0.00   0  0.00     0.00   0  0.00   1  0 99  0.45 0.73 0.71
	0.00   0  0.00     0.00   0  0.00   3  1 96  0.45 0.73 0.71
	0.00   0  0.00     0.00   0  0.00   1  1 99  0.45 0.73 0.71
	0.00   0  0.00     0.00   0  0.00   1  0 99  0.45 0.73 0.71
	0.00   0  0.00     0.00   0  0.00   1  0 99  0.45 0.73 0.71
	0.00   0  0.00     0.00   0  0.00   1  1 98  0.41 0.72 0.71

Now, keeping fingers crossed I’ve started the readout of directories 11 to 13 again. After no longer reading from the memory cache it looked like this:

	  disk1           disk7       cpu     load average
KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
15.06  85  1.25   128.00 220 27.48   1  1 98  0.27 0.51 0.66
14.96  69  1.01   128.00 225 28.08   0  1 99  0.25 0.50 0.65
14.96  69  1.01   127.40 212 26.33   0  1 99  0.25 0.50 0.65
14.96  69  1.01   128.00 210 26.21   0  1 99  0.25 0.50 0.65
16.70  69  1.12   128.00 204 25.46   1  1 98  0.25 0.50 0.65
13.58  86  1.14   128.00 210 26.21   0  1 99  0.25 0.50 0.65

Bummer.

Then I keep reading files from direcories 11 to 13 and low and behold after about an hour of reading it looked like this:

	  disk1           disk7       cpu     load average
KB/t tps  MB/s     KB/t tps  MB/s  us sy id   1m   5m   15m
128.00 2105 263.18     0.00   0  0.00   2  5 93  0.75 0.67 0.68
128.00 2096 261.97     0.00   0  0.00   3  6 91  0.75 0.67 0.68
128.00 2097 262.07     0.00   0  0.00   4  6 90  0.69 0.66 0.68
128.00 2103 262.93     0.00   0  0.00   1  6 93  0.69 0.66 0.68
128.00 2096 262.05     0.00   0  0.00   1  5 94  0.69 0.66 0.68
128.00 2091 261.42     0.00   0  0.00   2  6 92  0.69 0.66 0.68
128.00 2112 263.95     0.00   0  0.00   2  6 92  0.69 0.66 0.68
128.00 2093 261.63     0.00   0  0.00   3  7 90  0.72 0.66 0.68

Success !

So after giving it some time it actually did transfer the data to disk 1.

Btw.: I will actually not use Fusion drive on a Mac as HFS+ is not really keeping my data safe (see my HFS+ fails miserably demo). Using two HFS+ disks concatenated just increases the risk of data failure. And TimeMachine as backup has failed me as well in the past.

I’m using ZFS to store my data ;-)

Addition 1: The SSD is a old Vertex2 so nothing Apple specific.

Addition 2: Mounting the drive with “-o noatime” does not change the caching behaviour, which is good.

Addition 3: I was using plain old 10.8.2, nothing special.

Addition 4: Before you see your drives in diskutil core storage you need to convert them with ‘diskutil cs convert’