Disk image creation from folder: error 28 - no space left on device I wanted to create a full copy of my MacBook Air in a disk image for archive.
I can't save the disk from the booted system, so I restarted my Mac in Recovery mode (keys Command and R) on boot.
From the recovery menu, I can launch Disk Utility, I select the 'Macintosh HD' drive, give the image a name, select the options "not compressed" and "read only". I select the destination disk and let the process begins...
After a long time, just before ending the process, I have a message "error 28: No space left on Device".

My MBA has a 250 GB SSD disk, I have a 50 GB iCloud account, so in the case iCloud Drive is saved too (I don't think so...), there is just about maximum 300 GB to save.
I tried to save on a Drobo (which claims being 64 TB in size, and have more than 2TB free), and on an empty 1TB Drive, and had the same result.
Well...
It seems that APFS and/or iCloud Drive has killed the ability to create a disk image from an entire disk...
I tried lots of things, even Disk Utility's Restore in a freshly-created disk-image failed.

So I did it the hard way, with the terminal


Creation of a disk image (lot bigger than the drive) hdiutil create -size 500g -fs HFS+ -volname Clone\ Macintosh\ HD /Volumes/WD\ 1To/Clone\ MBA.dmg
Mounting the disk image
hdiutil attach /Volumes/WD\ 1To/Clone\ MBA.dmg
Note the /dev/disk_s_ path to unmount it
Save the disk with RSYNC (options and exclusions found on the internet)
sudo rsync -vaEx /Volumes/Macintosh\ HD/ /Volumes/Clone\ Macintosh\ HD --exclude=/Volumes/* --exclude=/Network/* --exclude=/automount/* --exclude=/dev/* --exclude=/private/tmp/* --exclude=/private/var/run/* --exclude=/private/var/spool/postfix/* --exclude=/private/var/vm/* --exclude=.Spotlight-*/ --exclude=.Trashes --exclude=*/.Trash --exclude=/afs/* --exclude=/cores/*
The result was bigger than the original drive (probably due to APFS which have some tricks to not duplicate data when copying a file, and certainly due to the saving of documents that are on iCloud Drive but not really on the disk: icons with a cloud badge) 
Detach the image hdiutil detach /dev/disk3s2
Then I tried to shrink the disk image from the command-line, but neither hdiutil compact, not hdiutil resize worked (errors)
Then I tried to resize with Disk Utility, but it didn't work too (disk utility claimed it was done, but the size didn't change at all)
So I converted the image to read-only with Disk Utility (in fact, it duplicated the image), and now I have a shrinked disk-image of my entire startup disk!


Lot of wasted time, it used to be easyer