Recently I have tried to do a fresh install of Lion on my Macbook Pro,
When trying to restore InstallESD.dmg to the USB drive as I did the first time, I got an error in Disk Util which stated “Invalid Argument” at the end of the restore process.
After doing some searching I found that something has changed in a recent version of the InstallESD provided with the latest Mac OSX Installer, which prevents you from successfully restoring it to a usb drive. but I’ve found a way to do it anyway
To do this, simply format your disk with Disk Util with a single Mac Formatted partition, with the GUID Partition map type. name it something like “Lion USB Install”
Double-click your InstallESD.dmg file so it mounts, then open up a terminal and type
# sudo rsync -avlrHt “/Volumes/Mac OS X Install ESD/” “/Volumes/Lion USB Install”
This will copy all of the files required for the OSX installer to your USB drive, once that’s done run
# sudo bless --folder “/Volumes/Lion USB Install/System/Library/CoreServices” --bootefi
You should now be able to use the USB key to run the Lion installer
Thanks to Morten, who has confirmed that this same method works with Mountain Lion too.