By Keith Mitnick on Tuesday, 07 June 2016
Category: General

How to resize a read only dmg file

There are times when you come across a dmg image that has a larger disk geometry size than needed.  This can cause issues if you try to restore a monolithic disk image to a volume smaller than your total dmg size.  This is a common issue if Disk Utility was used to capture an Image of a Macintosh HD. To fix this issue, follow the commands below.

#Find out the resize limits

sudo hdiutil resize -limits /Users/username/Desktop/Read.dmg 


#Convert the dmg to read write
sudo hdiutil convert /Users/username/Desktop/Read.dmg -format UDRW -o Write.dmg


#Resize the DMG
sudo hdiutil resize -size 50g /Users/username/Desktop/Write.dmg


#Convert back to read only DMG
sudo hdiutil convert /Users/username/Desktop/Write.dmg -format UDRO -o Read.dmg

#Scan image for restore
sudo asr imagescan --source /Users/username/Desktop/Read.dmg

Leave Comments