Add recovery partition back onto drive after drive change
Reinstalling over an existing system does not create a Recovery HD.

WARNING: This is low level disk editing code and will hurt your disk if not done properly. Make sure you recheck your calculations on every calculator you own.

You need to have a copy of Mountain Lion installer in your Applications folder for the following steps to work. Enter the following commands in Terminal, one by one, while following the related video. You need to fill all the X yourself by following the video. 


  sudo -i
  
  diskutil list
  
  diskutil info /dev/diskXsX
  
  XXXXXXXXX-700*1024*1024=
  
  diskutil resizeVolume /dev/diskXsX XXXXXXXXXB jhfs+ “Recovery HD" 650002432B
  
  diskutil resizeVolume diskXsX 650002432B
  
  mkdir /Volumes/Recovery\ HD/com.apple.recovery.boot
  
  hdiutil attach /Applications/Mac\ OS\ X\ Lion\ Installation.app/Contents/SharedSupport/InstallESD.dmg
  
  cp /Volumes/Mac\ OS\ X\ Install\ ESD/BaseSystem.dmg /Volumes/Recovery\ HD/com.apple.recovery.boot/
  
  cp /Volumes/Mac\ OS\ X\ Install\ ESD/.disk_label /Volumes/Recovery\ HD/com.apple.recovery.boot/
  
  cp /Volumes/Mac\ OS\ X\ Install\ ESD/boot.efi /Volumes/Recovery\ HD/com.apple.recovery.boot/
  
  cp /Volumes/Mac\ OS\ X\ Install\ ESD/kernelcache /Volumes/Recovery\ HD/com.apple.recovery.boot/
  
  cp /Volumes/Mac\ OS\ X\ Install\ ESD/Library/Preferences/SystemConfiguration/com.apple.Boot.plist /Volumes/Recovery\ HD/com.apple.recovery.boot/
  
  cp /Volumes/Mac\ OS\ X\ Install\ ESD/System/Library/CoreServices/PlatformSupport.plist /Volumes/Recovery\ HD/com.apple.recovery.boot/
  
  cp /Volumes/Mac\ OS\ X\ Install\ ESD/System/Library/CoreServices/SystemVersion.plist /Volumes/Recovery\ HD/com.apple.recovery.boot/
  
  umount -f /Volumes/Recovery\ HD/
  
  asr adjust —target /dev/diskXsX -settype "Apple_Boot"