Recently I was asked to look at a 4TB drive that was only showing less than 2TB available…. No problem, I said, this is easy to fix. Famous last words.
Just open up Disk Utility and resize the partition, or reformat the disk, right? Easy Peasey. Well, it took some troubleshooting to time to figure out and a trip to Terminal was required to solve this weird case, plus I learned a new command along the way. Fun.
The Problem:
Buying a 4TB hard drive then putting it into your external drive case for backups should be simple, but what if instead you got a nasty surprise and it showed up as less than 2TB?
Troubleshooting the issue:
4TB drives were presented to me and when I loaded them into an external SATA dock then showed as 4TB drives with a partitioned volume of less than 2TB.
I tried to delete the phantom partition, and I tried resize the volume to use the empty space in Disk Utility.app but it refused to budge. This needed a trip to Terminal.
man diskutil
Using “man” or “info” commands you can find out more about almost any particular command. Maybe some useful options or arguments would be listed or at least some examples would help.
NAME diskutil -- modify, verify and repair local disks SYNOPSIS diskutil [quiet] verb [options] DESCRIPTION diskutil manipulates the structure of local disks.
To find out more about what we’re faced with let’s ask diskutil what it sees:
diskutil list
/dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *4.0 TB disk2 1: EFI 209.7 MB disk2s1 2: Apple_HFS Backup 1.8 TB disk2s2
Looking through the man page the “resizeVolume” command caught my eye. Also the “limits” option seemed interesting. How
diskutil resizeVolume disk2s2 limits Resize limits for partition disk2s2 Backup: Current partition size on map: 1.8 TB (1801419800576 Bytes) Minimum (constrained by file usage): 846.4 MB (846426112 Bytes) Recommended minimum (if used for macOS):26.8 GB (26843545600 Bytes) Maximum (constrained by map space): 4.0 TB (4000442028032 Bytes)
The Answer:
Reading through the man page revealed that the best way, and new to me, was to resize the partition to use all available space with “R”. Of course, so intuitive.
sudo diskutil resizeVolume disk2s2 R
I did get some errors. But repairing the disk fixed those issues. And I was able to resize the disk in Terminal with diskutil where Disk Utility.app had failed.
sudo diskutil resizeVolume disk2s2 R Resizing to full size (fit to fill) Started partitioning on disk2s2 Backup Verifying the disk Verifying file system Volume was successfully unmounted Performing fsck_hfs -fn -x /dev/rdisk2s2 Checking Journaled HFS Plus volume Checking extents overflow file Checking catalog file Checking multi-linked files Checking catalog hierarchy Checking extended attributes file Checking volume bitmap Checking volume information The volume Backup appears to be OK File system check exit code is 0 Restoring the original state found as mounted Resizing Modifying partition map Growing file system Finished partitioning on disk2s2 Backup /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *4.0 TB disk2 1: EFI 209.7 MB disk2s1 2: Apple_HFS Backup 4.0 TB disk2s2
And lastly, the issue may have been caused by the old drive dock which refused to see the 4TB volumes even when correctly resized. A newer drive dock was required.