Creating simple disk images under Mac OS X

From Wikistix

After trying to use Apple's very limited Disk Utility application to resize a disk image and getting many meaningless errors ("Image resize failed", "The selected disk image can not be resized"), I came up with a command line that did what I wanted - created a plain, resizeable disk image with no partition table and a case-sensitive filesystem, populated from an existing directory, to be used for unix development. Saved here for posterity:

hdiutil create -srcfolder /Volumes/olddisk -size 16g -layout NONE -format UDRW -fsargs -s new.dmg