Restore MacBook Air SSD with OS X 10.11 El Capitan

Backup /Users/ directory (with tar) and make a list of useful installed /Applications/.

Download El Capitan from App Store.

Format at least 8 GB usb drive to OS X Extended file system and create install media:

cd "/Applications/Install OS X El Capitan.app/Contents/Resources"
./createinstallmedia --volume /Volumes/new --applicationpath "/Applications/Install OS X El Capitan.app"

Optionally create a slim DMG from that install media:

cd "/Volumes/Install OS X El Capitan"
rm -R .Trashes/
hdiutil create -nospotlight -srcfolder "/Volumes/Install OS X El Capitan" -format UDBZ /Users/swegen/Desktop/ElCapitan.dmg

Download latest Ubuntu ISO and dd it to another at least 2 GB usb drive.

Boot to Ubuntu with option key pressed at boot. Put device to sleep by closing the lid and wake it up to unfreeze the SSD.

Open terminal and gain root rights with:

sudo passwd

Restore SSD memory cells to factory condition with ATA secure erase command (takes about six seconds):

hdparm -I /dev/sda
hdparm --user-master u --security-set-pass Eins /dev/sda
time hdparm --user-master u --security-erase-enhanced Eins /dev/sda

Optionally clear SMC and NVRAM to start install afresh.

Boot with El Capitan usb install media and start terminal to create 1MB aligned OS partition while preserving default EFI partition starting location and size to allow for future firmware updates (sizes are calculated for 250 GB SSD):

gpt create /dev/disk0
gpt add -b40 -s409600 -tefi /dev/disk0
gpt label -i1 -l "EFI System Partition" /dev/disk0
gpt add -b411648 -s488552448 -thfs /dev/disk0
gpt label -i2 -lSSD /dev/disk0
newfs_hfs -s -J -v SSD /dev/disk0s2
diskutil mount /dev/disk0s2
cd /Volumes/SSD
rm -R .Trashes/

Exit terminal and install El Capitan.

Installer replaces basic OS partition with unnecessary Core Storage volume manager. After installation is complete Remove Core Storage layer from GPT:

diskutil cs list
diskutil cs revert %lvuid%

Reboot and check again with above list command that it worked. Then restore your backups. Final partition layout (efi, hfs and recovery) is:

# gpt show /dev/disk0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640       2008         
     411648  488552448      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  488964096    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  490233632       1087         
  490234719         32         Sec GPT table
  490234751          1         Sec GPT header

No comments:

Post a Comment