I have an encrypted dmg (Mac OS Extended Journaled) read/write and it shows a size of of 768.46 GB unmounted but only has a mounted capacity of 665.72 GB. I think something may have been corrupted when I resized it from 500GB to 650GB. I attempted through disk utility, which proceeded to appear to freeze, so I let it go for about 15 minutes and then I checked the log and it said "resize successful". I then proceeded to check the capacity of the image mounted and it still said 500GB. So next i tried resizing through hdutil
which led me to where I am now. Unmounted size of 768.46 GB but a 665.72 GB capacity. Any ideas how I could fix this?
DIsk Image shows larger size unmounted then when mounted. How to fix
disk-utilitydmg
Related Solutions
After gaining some experience with CoreStorage volumes, I reworked my first answer to generalize and facilitate it by adding some scenarios and deleting some dispensable steps.
Basically there is one undocumented command to resize or expand a CoreStorage volume group and an inherent logical volume:
diskutil cs resizeStack LVUUID size
The command expands or shrinks the whole CoreStorage Volume Group including the physical volume(s), the logical volume family and the logical volume in one step to the desired size.
While shrinking it down to the size of the occupied space in the logical volume shouldn't be problem at all (but not recommended because at least 10% free space should be left), any blocking partition except the recovery partition has to be deleted or diminished before expanding the CoreStorage stack.
The command comes in handy in several scenarios:
- expanding a CoreStorage volume after deleting a 2nd old-style JHFS+ volume on the same device (this may happen after splitting your disk in two partitions in Mavericks and then updating to Yosemite. The first partition - your system volume - might be converted to a CoreStorage volume, while the 2nd volume is left alone.)
- expanding a CoreStorage volume after manually deleting a Boot Camp NTFS volume
- resizing a CoreStorage volume to create 2nd old-style JHFS+ volume on the same device
Beware: The command is vastly undocumented and as such potentially destructive.
Preparation:
- Backup your data.
- Detach any external drive (especially your external Time Machine backup drive).
Restart to Internet Recovery Mode by pressing alt cmd R at startup.
The prerequisites are the latest firmware update installed, either ethernet or WLAN (WPA/WPA2) and a router with DHCP activated.
On a 50 Mbps-line it takes about 4 min (presenting a small animated globe) to boot to a recovery netboot image which usually is loaded from an apple/akamai server.I recommend ethernet because it's more reliable. If you are restricted to WIFI and the boot process fails, just restart your Mac until you succeed booting.
Alternatively you may start from a bootable installer thumb drive (Mavericks or Yosemite) or a thumb drive containing a full system (Mavericks or Yosemite).
Modify CoreStorage stack:
- Open in the menubar Utilities/Terminal
First you should get an overview of your disks and the partition layout:
Enter
diskutil list
Example listing:/dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *68.7 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_CoreStorage 53.7 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3 4: EFI No Name EFI 100.0 MB disk0s4 /dev/disk1 #: TYPE NAME SIZE IDENTIFIER 0: Apple_partition_scheme *1.3 GB disk1 1: Apple_partition_map 30.7 KB disk1s1 2: Apple_HFS OS X Base System *1.3 GB disk1s2 /dev/disk2 #: TYPE NAME SIZE IDENTIFIER 0: Apple_HFS System *53.5 GB disk2 /dev/disk3-disk12 ...belong to the OS X Base System (your recovery system you booted to previously)
Disk0 is your main internal disk device containing the EFI-partition (dis0s1), the CoreStorage partition (disk0s2) and the Recovery HD (disk0s3). The No Name EFI (disk0s4) only exists if you had a Boot Camp partition previously and deleted it manually.
Disk1 is a logical disk created by booting to the netboot image which contains a recovery system (OS X Base System = disk1s2) similar to the Recovery HD.
Disk2 is also a logical disk residing in disk0s2 and it contains the CoreStorage stack.
Enter
gpt -r -vv show /dev/disk0
Example listing:gpt show: /dev/disk0: mediasize=68719476736; sectorsize=512; blocks=134217728 gpt show: /dev/disk0: PMBR at sector 0 gpt show: /dev/disk0: Pri GPT at sector 1 gpt show: /dev/disk0: Sec GPT at sector 134217727 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B 409640 104974016 2 GPT part - 53746F72-6167-11AA-AA11-00306543ECAC 105383656 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC 106653192 204800 4 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B 106857992 27359703 134217695 32 Sec GPT table 134217727 1 Sec GPT header
The partition with the index number 1 is the regular EFI-partition, the partition with index number 2 is your CoreStorage partition and the partition with index number 3 is your Recovery HD.
The partition with index number 4 (=No Name EFI) only exists if you had a Boot Camp partition previously and deleted it manually. All the rest is unallocated free space (in the example 27359703 blocks à 512 B).Enter
diskutil cs list
Example listing:CoreStorage logical volume groups (1 found) | +-- Logical Volume Group A629E051-D7B0-4B8C-A803-074F62704636 ========================================================= Name: System Status: Online Size: 53946696192 B (53.9 GB) Free Space: 16777216 B (16.8 MB) | +-< Physical Volume 90C09FC0-4215-4871-901B-70E2C9C7D464 | ---------------------------------------------------- | Index: 0 | Disk: disk0s2 | Status: Online | Size: 53946696192 B (53.9 GB) | +-> Logical Volume Family F6962E38-50E4-4458-BFE6-CF2E179352F5 ---------------------------------------------------------- Encryption Status: Unlocked Encryption Type: None Conversion Status: NoConversion Conversion Direction: -none- Has Encrypted Extents: No Fully Secure: No Passphrase Required: No | +-> Logical Volume BD36C73D-860D-4DC6-B125-AD624F448B88 --------------------------------------------------- Disk: disk2 Status: Online Size (Total): 53496696192 B (53.5 GB) Conversion Progress: -none- Revertible: Yes (no decryption required) LV Name: System Volume Name: System Content Hint: Apple_HFS
to resize the CoreStorage volume you have to delete any blocking partition first (the Recovery HD doesn't count because it usually will be moved with the resizeStack command).
First you have to unmount all mounted volumes on disk0 (first the CoreStorage volume, which has its own disk identifier disk2 but resides on disk0, then all other mounted volumes on disk0 - check this withdf
):diskutil unmountDisk /dev/disk2
then additional volumes (if you have any at all). Example:
diskutil unmount /dev/disk0s5
If you have a NoName EFI partition delete it by entering:
gpt remove -i 4 disk0
Remount any previously unmounted volume in the reverse order with
diskutil mount /dev/disk0s5 diskutil mount /dev/disk2
Since any blocking partition is deleted you may now resize the CoreStorage volume with
diskutil cs resizeStack LVUUID size
with LVUUID: UUID of the logical volume and size: the final size of your CoreStorage volume.
Examples:diskutil cs resizeStack BD36C73D-860D-4DC6-B125-AD624F448B88 60g
to expand it to 60 GB
diskutil cs resizeStack BD36C73D-860D-4DC6-B125-AD624F448B88 40g
to shrink it to 40 GB
diskutil cs resizeStack BD36C73D-860D-4DC6-B125-AD624F448B88 0g
to expand it to the full available size (0g is a magic number here).
Your Recovery HD should be moved automatically - regardless of whether shrinking or expanding the CS volume - to the very end of it.
- In case of shrinking the CoreStorage volume you may now create a 2nd partition with gpt.
Enter the following to get the new partition scheme:
gpt -r -vv show /dev/disk0
and
gpt add -b StartBlock -s NumberOfBlocks disk0
to create a new partition. StartBlock is the number of the first block in the unallocated space and NumberOfBlocks is the number of free blocks or smaller. NumberOfBlocks has to be dividable through 8!
- Enter
exit
and quit Terminal. - Open Disk Utility (and format your newly created partition if you have created a new partition in the second last step).
- Then check your expanded CoreStorage volume for errors.
- Quit Disk Utility.
- Reboot to your main volume.
The Recovery Partition is created during OS X installation.
Normally that partition is hidden unless you are using the Debug mode in Disk Utility to show all partitions.
In other words, it should not be showing in your system as it is.
Turn off the show all partitions (in Debug menu), and check.
If it is still there back it up (for safety) then delete it.
Just in case you delete the original Recovery partition, you can get it back using the Internet recovery, or from reinstalling the OS X.
The way it should look like (notice the EFI and Recovery are grayed out but still showing on the side, since I have the Debug show all partition ON).
Related Question
- Disk Utility reading disk incorrectly; viewing ext4 as JHFS+ and seeing Recovery HD
- Change Mounted Disk Image Icon – How to Change Icon of Mounted Disk Image on macOS
- MacOS – Can not resize disk image file .dmg
- MacOS – Error when encrypting .dmg disk image
- Convert a plain disk “legacy image” so that it can be mounted
- Finder – Automatically Open When Disk Image is Mounted
- Shrinking a Core Storage volume without the booter partition
Best Answer
I figured it out!
Open Disk Utility.
In the left-hand panel, select the disk image you would like to resize (the DMG file), then click the Resize Image button in the toolbar, and then enter the new size. Click Log to ensure that it resized successfully.
Click Open to mount the volume. (You may also mount the volume manually by opening the disk image in the Finder.) Select the volume in the left-hand panel. Notice how the volume's Total Capacity is unchanged. This is where you got stuck.
Select the disk image again (not the volume). Now there are new tabs available. Click the tab labeled Partition. This essentially allots different partitions of storage space to the disk image. Select the volume you would like to resize and drag the ... draggy thing? or manually enter in a size. Then click Apply. Check the log to ensure the partition was resized successfully.
Select the volume in the left-hand panel. Check to ensure its Total Capacity is the correct size.
That's it! Now you can add more files to the volume. Remember to eject the volume when done.