Expanding a partition at the end of a drive to fill the entire drive
-
29-09-2020 - |
Question
I have an external HDD connected to a Lion iMac (though I can use my Mountain Lion Air if it will make the process simpler) that was split right down the middle with two partitions. The first was clear and the second was FileVault 2'd and was used as a Time Machine. My intent is to end up with one FileVault 2 partition spanning the entire drive.
I have already moved the data from the clear partition to the second and removed it, and I have already decrypted the FileVault 2 partition so that it can be resized. However, Disk Utility will only let me resize the second partition at its end, not move its top end up. (Once resized to fill the disk, I intend to re-encrypt the partition.) It seems I may have to move the second partition to the top of the drive first.
How would I go about expanding this partition to fill the entire drive? I think there is enough space that I could effectively copy the second partition into the free space at the top.
diskutil list
output (though this doesn't appear to show where the empty space is):
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *2.0 TB disk2
1: EFI 209.7 MB disk2s1
2: Apple_HFS Time Machine 999.9 GB disk2s2
3: Apple_Boot Boot OS X 134.2 MB disk2s3
diskutil cs list
shows nothing for the disk in question. It used to, before I decrypted the FileVault volume. It's my understanding that the disk was un-CoreStoraged (if that makes any sense—forgive me, I'm learning this stuff on the fly) after decryption.
Solution
The resizing can be finicky when there is a gap in the space between the partitions. Especially when if not all the logical volumes / partitions are HFS+ format.
It's not clear that you will be able to do this without seeing the core storage listing and the normal listing:
diskutil list
diskutil cs list
The first shows how the filesystems are mounted without core storage / FileVault 2 details. The second list is how the physical drive is actually partitioned. I've seen cases where you can image the secondary partition contents to a DMG on the free space in the first filesystem - then make the drive one filesystem and then grow the one logical volume to take all physical space.
I've also seen it where you need to undo the core storage - which implies an erase of the drive and backing up all the data elsewhere before proceeding.