Skip to content
September 30, 2017 / lasseathome

Upgrading the HDD of a Mac Mini (mid 2011) from 500 GB to 2 TB

I ran out of HDD space on my 500 GB Mac Mini while backing up my iPhone and 256 GB iPad so I needed more space and did an upgrade. For the physical switch there were several excellent guides with photos, but there were very few instructions about how to grow the HFS+ partitions of the drive, so I had to test and find a solution and this blog post documents my steps in the hope that it can be useful for someone else. For the hardware part I used the ifixit guide, for mid 2011, the steps are the same for 2012 models, but 2014 models have a new internal design.

Disk removal

Disk removal is pretty straight forward if you have some small Torx tools. In the ifixit guide there were some steps that I could skip, these were steps 13-15, disconnecting the IR sensor and extracting the logic board out of the case (that requires a special Mac Mini Logic Board Removal Tool), I could get the HDD out without these steps. The ifixit guide has many good images, in plain text the steps are as follows ((steps X,Y) below refers to the steps in the ifixit guide):

  1. Remove Bottom cover (steps 1,2).
  2. Remove the Fan with the two T6 Torx screws and remove the connector (steps 3-5).
  3. Remove the Cowling  with one T6 Torx and gently pry it out (steps 6,7).
  4. Remove the Antenna Plate with two T8 Torx that hold the HDD and two T8 Torx that hold the plate itself. Lift the antenna plate and disconnect the antenna cable (steps 8-11).
  5. Disconnect the integrated power and SATA connector from the Logic board (step 12).
  6. I did not need to extract the Logic board out of the case so i skipped steps 13-15, I could wiggle the HD out of its place without doing this. If you have two HDDs mounted you need to extract the logic board to get access to the lower HDD, but this was not necessary for me.
  7. Remove the HDD from the case and remove the two place holder screws that fixes the disk to the case (steps 17-19).

To get it all together it is just needed to reverse the order. There was one thing that took me a little time to figure out, the place holder screws on the HDD should fit into the black rubber holes closest to the bottom of the case, see the red arrows in the picture below. Originally I thought they should go into the other two bigger metal holes but I could not get the disk in place without removing the Logic Board (these are where a second disk should be placed). To get a second disk in place at that “top position” in the case one needs to extract the Logic board out of the case which gives more space to wiggle a disk into place.

Clone Mac HDD and grow the partition

Now I come to the difficult part where there were no simple guides, so I had to Google and experiment my way to a solution. What I ended up using was a linux computer with two SATA connections with the dd and GParted programs, a Mac and a USB HDD case with the diskutil and Disk Utility programs.

The core of the problem is that it is difficult to grow a Mac HFS+ partition since the original disk has a size of the partition table that is limited to the original size of the disk so that Mac “diskutil resizeVolume ...” gives the error message “Error: -5341: MediaKit reports partition (map) too small“. Research shows that there are some alternatives, one is to destroy and rebuild a sufficiently large partition table with the Mac tool GPT and then resize the disk with “diskutil resizeVolume /dev/disk2s2 R” which fills the partition, I failed this once and ended up erasing the disk, due to a mistake on my side. So I had to start over making a new clone with dd and then went on another venue aiming at using “diskutil mergePartitions” which worked nicely.

So the steps taken to clone the disk and grow it to get one single large partition on the 2TB disk were the following:

  1. Insert the 500 GB and 2 TB disks into a Linux computer. Identify the disks with the lsblk command.
    $ lsblk
    NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sdb    8:16   0 465,8G  0 disk 
    ├─sdb1 8:17   0   200M  0 part 
    ├─sdb2 8:18   0   465G  0 part 
    └─sdb3 8:19   0 619,9M  0 part 
    sdd    8:48   0   1,8T  0 disk

    Here I have removed the output for my other disks (sda and sdc), to avoid cluttering up the blog. The old mac disk sits at /dev/sdb and has three partitions. The new one is at /dev/sdd/ and it does not have any partitions.

  2. Then I do a complete disk clone using the dd disk copy command, which is very powerful and should thus be used with care, the command is so powerful that it has earned the name disk destroyer.
    $ sudo dd if=/dev/sdb of=/dev/sdd bs=1M
    500107862016 bytes (500 GB, 466 GiB) copied, 7727,8 s, 64,7 MB/s
    

    it took about 2 hours 9 minutes for dd to complete the cloning even though I used SATA connections in a fairly fast computer. (This could be done using USB HDD enclosures too but then the rate would be limited by the USB data transfer rate). The new disk now has the three original partitions and 1,4 TB free space at the end. The partitions are: sdd1 – the EFI boot partion, sdd2 – the Macintosh HD (main hard disk), and sdd3 – the Recovery HD.

  3. Then I opened GParted that shows the partitions and their names together with the unallocated space.gparted
  4. I now need to move the Recovery HD to the end of the disk and insert a new partition in the free space. This was easily done in GParted, but for some reason I got a tiny unallocated space at the end, but it was so small (close to 1ppm of the disk) that I didn’t bother with it. The new partition I created was named Customer2 and labelled Macintosh HD2.gparted2
  5. I now had the partitions on the disk finished and could look at the disk contents with lsblk, that shows that my third partition had ended up at sdd4 even though that it is physically placed between sdd2 and sdd3 (this is also seen in GParted above).
    $ lsblk
    NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT 
    sdd     8:48  0   1,8T  0 disk 
    ├─sdd1  8:49  0   200M  0 part 
    ├─sdd2  8:50  0   465G  0 part 
    ├─sdd3  8:51  0 619,7M  0 part 
    └─sdd4  8:52  0   1,4T  0 part
  6. GParted could not resize the HFS+ partitions so I disconnected the drive from the Linux Machine and inserted it in a USB HDD enclosure that I connected to my Macbook, where I could use the Mac diskutil to merge the partions. The nice thing is that diskutil mergePartitions can create a large enough partition table when it has two partitions to work with. The command and its output were:
    $ diskutil mergePartitions JHFS+ 'Macintosh HD' /dev/disk2s2 /dev/disk2s4
    Merging partitions into a new partition
     Start partition: disk2s2 Macintosh HD
     Finish partition: disk2s4 Macintosh HD2
    Started partitioning on disk2
    Merging partitions
    Waiting for partitions to activate
    Growing disk
    Finished partitioning on disk2
    /dev/disk2 (external, physical):
     #: TYPE NAME SIZE IDENTIFIER
     0: GUID_partition_scheme *2.0 TB disk2
     1: EFI EFI 209.7 MB disk2s1
     2: Apple_HFS Macintosh HD 2.0 TB disk2s2
     3: Apple_Boot Recovery HD 649.8 MB disk2s3

    This operation was very fast some few seconds since it didn’t have to move a lot of data.

  7. Then I opened the graphical user interface Disk Utility and performed a First Aid check on the disk which made some small corrections to the disk and partitions automatically.
  8. Then I removed the disk from the USB HDD enclosure and mounted the new disk in the Mac Mini (reversing the order above) and it booted wonderfully. The machine runs fine and I have not noticed any data loss, writing this blog from the machine. I still keep the old HDD as backup in the book shelf just in case something happens. So, I now have a 2 TB HDD (hybrid) in my Mac Mini which gives me some space for the future and the hybrid technology also seems to give me improved performance.

Concluding Remarks and Summary

Hope this can help some one else that has the same problem of growing a partition on a Mac HDD where the size of the partition table is the limiting factor. The trick is to create a new large partition and use diskutil mergePartitions. The whole process could probably be performed on a Mac. In steps 2 & 3 below I used GParted mainly since I have access to it and it is easy to use and I am comfortable with it. In step 5 i used the graphical interface Disk Utility since it is also simple to use. In summary the steps for cloning and growing a Mac HD are:

  1. Clone disk with dd.
  2. Move the Recovery HD to the end of the disk.
  3. Add a new HFS+ partition.
  4. Merge the two HFS+ partitions using diskutil.
  5. Check the disk so that it is clean.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: