Resizing BootCamp Partition

One of the biggest problems with Bootcamp comes the day you need a bigger mac partition.

The Disk Utility on MacOs X can’t resize partitions if using Bootcamp, and resizing Mac GPT partition from linux can be risky. So, you can buy a pro partition utility… or you can resize from shell without rebooting and without burning a boot CD.

First is making some room for the new partition. Resize and move your Bootcamp partitions to leave some free space at the begining, between the mac partition and the first bootcap one. Ok, here you may need to burn a Live CD and boot from it.

If you want to boot again on linux, you should sync gpt table. Use «gptsync» from refit. Then reinstall grub by doing:

# grub
grub> root (hd0,2) # hd0,2 is my / partition on linux.
grub> setup (hd0)

Now you’re ready to reboot on mac (Can check before that linux is still booting).

On mac, from terminal, use «diskutil resizeVolume» to resize Mac Partition. In my mac it was:

$ diskutil list # list your partitions
$ diskutil resizeVolume disk0s2 limits # disk0s2 is my mac partition
For device disk0s2 Macluzo HD:
	Current size:	55700357120 bytes
	Minimum size:	37094010880 bytes
	Maximum size:	56509181952 bytes
$ diskutil resizeVolume /dev/disk0s2 56509181952B # I used the Maximun size
Verifying
Resizing Volume
Adjusting Partitions
[ + 0%..10%..20%..30%..40%..50%..60%..70%..80%..90%..100% ] 
Finished resizing on disk disk0s2 Macluzo HD

And that’s all Folks 🙂

Destapando las Vergüenzas

Uno de los mayores mitos mientras aprendes a programar es que los elementos privados son inaccesibles, y por ello seguros. Esto es aplicable sólo a lenguajes orientados a objetos con elementos privados, como java.

Así ves a una cantidad enorme de aspirantes a programador que gastan la mitad del tiempo pensando cómo hacer un código blindado frente ataques. Aunque ninguno sabe de qué ataques se defiende, o qué implicaciones tiene privatizar o publicar algo.

Sin embargo, no es más que una sensación de falsa seguridad. Tenemos herramientas en el lenguaje para acceder a estos campos. En Java, por ejemplo, tenemos la siguiente clase:


public class Secreto {
	private int miSecreto = 5;
}

Podemos acceder a ese valor así:


import java.lang.reflect.Field;

public class Ganzua {
	public static void main(String[] args) throws Exception {
		Secreto secreto = new Secreto();
		Field campo = Secreto.class.getDeclaredField("miSecreto");
		campo.setAccessible(true);
		System.out.println(campo.getName() + " = " + campo.get(secreto));
	}
}

Hoy lo he hablado Pablo, mi compañero de habitación en warp. En Python no hay nada privado, siguen el «somos todos adultos», permitiendo al programador usar algo delicado.

Tampoco creo que eso sea lo mejor. Tiene que haber cosas privadas para marcar lo que no tiene importancia en el exterior. Si no tiene importancia no es mostrado ni en la documentación, ni en los autocompletados. De esta manera agilizas la programación.