I've recently been given a Mac book pro retina with SSD drive.
This is what I've done to have both OS X and linux working on this laptop.
INSTALLATION:
1 - First of all, resize you disk through the OS X "Disk Utility", and create free space for linux.
2 - Download and install refit from here
3 - Reboot twice, the second time round, you will see the refit menu during boot.
4 - Grab a 2GB (or bigger) usb drive.
5 - Download the latest MAC Ubuntu 13.04 image
6 - Create a bootable usb with the downloaded image using dd:
dd if=/home/me/Downloads/raring-desktop-amd64+mac.iso of=/dev/sdX bs=4M
7 - Lower the chime sound upon computer boot:
From OS X terminal, run:
sudo nvram SystemAudioVolume=%10
8 - Make sure your ethernet thunderbolt adapter is plugged in.
9 - Plug the usb drive into your Mac, and press the power key, the installation process should begin.
10 - Partition the free space as you pleased.
Take into account the partitions aligning
11 - Upon reboot, you should see a linux icon on the reFit menu, which you should select.
12 - By editing /efi/refit/refit.conf on OS X, you can make linux the default OS, and change the timeout for loading the default OS.
laptop:~ user$ diff /efi/refit/refit.conf /efi/refit/refit.conf.orig
9c9
< timeout 1
---
> timeout 20
104c104
< default_selection L
---
> #default_selection L
13 - After the reFit menu, you'll be presented with the GRUB menu, I suggest you also change GRUBs timeout to 1 sec on linux.
vi /etc/default/grub
[...]
GRUB_TIMEOUT=1
GRUB_CMDLINE_LINUX_DEFAULT="elevator=deadline"
[...]
Update grub setting:
update-grub2
CUSTOMIZATIONS:
1 - Remap left/right cmd keys to right click and middle click:
root@laptop:# apt-get install xkbset
root@laptop:~/Documents/scripts# cat keyboardReMap.sh
#!/bin/bash
#Left cmd for for right click
xmodmap -e "keycode 133 = Pointer_Button3"
#Right cmd for middle click
xmodmap -e "keycode 134 = Pointer_Button2"
xkbset m
Give it exec permissions, and launch it from your session manager startup.
In xfce this is, Settings manager - Sessinon and startup - Application autostart
2 - Create a script to disable bluetooth on startup
root@av:~# cat Documents/scripts/stopBlueTooth.sh
#!/bin/bash
/usr/sbin/rfkill block bluetooth
Give it exec permissions, and launch it from your session manager startup.
In xfce this is, Settings manager - Sessinon and startup - Application autostart
3 - Setup a cpu governor to increase battery life.
In my case I use xfce desktop, so I need to do:
apt-get install xfce4-cpufreq-plugin
apt-get install cpufrequtils
And set every cpu to "on demand"
OPTIMIZATIONS FOR THE SSD:
1 - Enable noatime, nodiratime (man mount). This is specially important if you are using a SSD disk:
# cat /etc/fstab
UUID=103968de-aa6c-4d57-a335-6ac416f42766 / ext4 noatime,nodiratime,errors=remount-ro 0 1
# /home was on /dev/sda6 during installation
UUID=41cc4555-6fae-4a66-a798-ad3abd388978 /home ext4 defaults,noatime,nodiratime 0 2
# swap was on /dev/sda5 during installation
UUID=89d17444-01a3-42cb-9680-22520a6e9f3a none swap sw 0 0
- If you have enough RAM, you can have certain directories in RAM, they will get lost upon reboot. This way you also avoid unnecessary writes to your SSD.
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/spool tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
2 - Create a filesystem trimming script:
root@laptop:~/Documents/scripts# cat trimFS.sh
#!/bin/bash
#Check if the script has run the current day
grep "were trimmed" /var/log/syslog 2>&1 > /dev/null
#Run the script if it hasnt run today already
if [ $? != 0 ]; then
for mount in `mount|grep ext|awk '{print $3}'`; do
/sbin/fstrim -v $mount 2>&1 >> /var/log/syslog
done
fi
3 - Give executable permissions to the script:
chmod a+x /home/user/Documents/scripts/trimFS.sh
4 - Run the trimming script from cron
echo "# Try to trim filesystem every two hours." >> /etc/cron.d/FStrim
echo "27 */2 * * * root /home/hummy/Documents/scripts/trimFS.sh" >> /etc/cron.d/FStrim
5 - Add the following line to "/etc/rc.local" before "exit 0" to enable the "deadline" scheduler on the internal SSD.
echo deadline > /sys/block/sda/queue/scheduler
6 - Keep a swap partition available, but not in use unless necessary. Add the following to your /etc/rc.local file:
echo 0 > /proc/sys/vm/swappiness
OTHER:
1 - External display:
The external display is recognized differently when attaching the VGA thunderbolt to the upper and lower left sockets.
I could only get the external monitor to work, when attaching the VGA thunderbolt on the upper left socket, leaving the bottom left thunderbolt for the ethernet adapter.
At the default resolution of 2800 the desktop is very small.
I had to reduce the resolution to 1900, and increase the default fonts for the system.
TODO:
THANKS:
root@ubuntu:~# parted /dev/sda unit s p free
Model: ATA APPLE SSD SD512E (scsi)
Disk /dev/sda: 977105060s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
34s 39s 6s Free Space
1 40s 409639s 409600s fat32 EFI system partition boot
2 409640s 375409639s 375000000s hfs+ Customer
3 375409640s 376679175s 1269536s hfs+ Recovery HD
376679176s 392304639s 15625464s Free Space
4 392304640s 425506815s 33202176s ext4
5 425506816s 433319935s 7813120s linux-swap(v1)
6 433319936s 977104895s 543784960s ext4
977104896s 977105026s 131s Free Space
376679176 ÷ 4096 = 91962.689453125
4096 × 91963 = 376680448
512KB NAND Erase block = 512 x 1024 = 524288 bytes
376680448 ÷ 524288 = 718.x
719 × 524288 = 376963072
The partition has to start on sector 376963072
719×524288
376963072
Now, I want a 16GB partition, so>
16GB×1024×1024×1024 = 17179869184 bytes
17179869184÷512bytes/sector = 33554432 sectors
33554432 sectors + 376963072 sectors = 410517504 sectors
410517504 is also completely aligned
410517504÷524288 = 783
785×524288 = 411566080
411566080 is where the next partition should begin
411566079 is the last sector of the current partition.
411566079 sectors - 33554432 sectors = 378011647 sectors
445949952−411566079 = 34383873 sectors
17179869184 ÷ 33554431 = 512.000015259
850×524288 = 445644800
445644800−411566080 = 34078720 sectors
445644799 end partition
FINAL LINUX PARTITIONING SCHEMA
root@ubuntu:# parted /dev/sda unit s p free
Model: ATA APPLE SSD SD512E (scsi)
Disk /dev/sda: 977105060s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
34s 39s 6s Free Space
1 40s 409639s 409600s fat32 EFI system partition boot
2 409640s 375409639s 375000000s hfs+ Customer
3 375409640s 376679175s 1269536s hfs+ Recovery HD
376679176s 376963071s 283896s Free Space
4 376963072s 411566079s 34603008s ext4
5 411566080s 445644799s 34078720s linux-swap(v1)
6 445644800s 976748543s 531103744s ext4
7 976748544s 977102847s 354304s
977102848s 977105026s 2179s Free Space