Upgrade MacBook (13-inch, Mid 2010) Hard Disk

If you have a MacBook and you want a dual boot system, perhaps you will soon fill at least one of your partition., because unluckily HFS+ is writable only with journaling disabled from Linux (yes, this time the kernel without GNU!), and the same is for ext4 from OsX.

But this is not a problem! Storage is cheep!

The steps for a successful upgrade are:

  1. Buy a external HD (I found a Trans 500GB StoreJet2.5in, well done, easy to open, but you will have to «remove the ‘do not remove’ stickers»)
  2. Burn the latest Clonezilla live CD
  3. Follow the device-device mode and clone you disk (I had a 2GB/min average speed)
  4. Follow the official MacBook User Guide to remove the old hard-disk from the MacBook.
    1. pinzeThe guide is ok, but if you don’t have the right tool to open the 4 mounting Torx screws placed on the disk itself, you can carefully use some pliers (as I did).
  5. Swap the drives and reboot.

In my experience everything was ok, and I got a working copy of the disk with 250GB of unpartitioned space.

Now launch gdisk (GPT enabled fdisk), backup the GPT table and add the new partitions you want. I forgot to backup the GPT (you can’t backup it on the drive you are working on…), but luckily I took a picture of the partitions listing with my phone. That saved me from a complete failure :)
Now it’s the turn of LVM2 and btrfs!

Modificare il titolo del teminale da Python

Una delle particolarità di gentoo è l’attenzione ai particolari, ed una delle caratteristiche che rimpiango in altri gestori di pacchetti è l’uso intelligente della barra del titolo della finestra del terminale per comunicare lo stato di avanzamento di una lunga installazione.

Andando a scavare nei sorgenti di portage ho trovato una comoda funzione, xtermTitle(message) (nel file output.py), che modifica il titolo di xTerm (o similari) con il messaggio inviato.

Qua ho adattato (minimamente) la funzione ai miei usi:

def xtermTitle(message):
    if os.environ.has_key("TERM") and sys.stderr.isatty():
        this_term = os.environ["TERM"]
        legal_terms = ["xterm", "Eterm", "aterm", "rxvt",
                       "screen", "kterm", "gnome"]
        for term in legal_terms:
            if this_term.startswith(term):
                sys.stderr.write("\x1b]2;" + str(message) + "\x07")
                sys.stderr.flush()
                break

Funziona egregiamente, e fa rimpiangere un po’ meno l’assenza di Growl quando parto con Ubuntu.