sábado, agosto 09, 2008

Extendiendo la memoria virtual en el Nokia N800

La máxima memoria virtual del N800 es de 128KB, quiero agregar por lo menos 1GB que tomaré de la tarjeta interna.

La SD interna es de 8GB y la tengo ocupada sólo con respaldos de contactos, correos etc.

Entro como root desde mi desktop.
hopper800:~# sfdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 250112 cylinders, 4 heads, 16 sectors/track
Warning: The partition table looks like it was made
for C/H/S=*/103/2 (instead of 250112/4/16).
For this listing I'll assume that geometry.
Units = cylinders of 105472 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/mmcblk0p1 39+ 77704- 77665- 7999488 b W95 FAT32
start: (c,h,s) expected (39,79,1) found (0,130,3)
end: (c,h,s) expected (1023,102,2) found (996,102,2)
/dev/mmcblk0p2 0 - 0 0 0 Empty
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty


El formato original de la tarjeta ocupa los 8GB en una partición FAT32.
hopper800:~# sfdisk /dev/mmcblk0 -uM
Checking that no-one is using this disk right now ...
OK

Disk /dev/mmcblk0: 250112 cylinders, 4 heads, 16 sectors/track
Old situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End MiB #blocks Id System
/dev/mmcblk0p1 0+ 6799 6800- 6963199+ b W95 FAT32
/dev/mmcblk0p2 6800 7815 1016 1040384 82 Linux swap / Solaris
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty
Input in the following format; absent fields get a default value.

Usually you only need to specify and (and perhaps ).

/dev/mmcblk0p1 :0,6800,82
/dev/mmcblk0p1 0+ 6799 6800- 6963199+ 82 Linux swap / Solaris
/dev/mmcblk0p2 :,,83
/dev/mmcblk0p2 6800 7815 1016 1040384 83 Linux
/dev/mmcblk0p3 :
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 :
/dev/mmcblk0p4 0 - 0 0 0 Empty
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End MiB #blocks Id System
/dev/mmcblk0p1 0+ 6799 6800- 6963199+ 82 Linux swap / Solaris
/dev/mmcblk0p2 6800 7815 1016 1040384 83 Linux
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Do you want to write this to disk? [ynq] y
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)


El tamaño de la tarjeta no es exactamente 8GB asi que ajusto el tamaño como sigue:

/dev/mmcblk0p1 :0,6800,82

Partición tipo 82 (linux), el resto lo dejo como swap, tipo 83

/dev/mmcblk0p2 :,,83

Ahora doy formato a la partición swap:

hopper800:~# mkswap /dev/mmcblk0

Checo con free si lo tengo lo hice bien.
hopper800:~# free
total used free shared buffers
Mem: 126796 113880 12916 0 7712
Swap: 1040376 0 1040376
Total: 1167172 113880 1053292

Aparentemete el sistema me reconoce el swap de 1GB. weeeeee! y además es de tipo swap cosa que le ahorrará mucho proceso por no pasar por el sistema de archivos FAT32.

Ahora cada vez que se reinicie el tablet se perderá este swap, lo mejor es configurarlo para que se monte automáticamente.

Lo podemos agregar en /etc/fstab para que lo carge cada vez que se reinicie.

hopper800:~# cat /etc/fstab 
rootfs / rootfs defaults,errors=remount-ro,noatime 0 0
/dev/mmcblk0p1 /media/mmc1 vfat rw,noauto,nodev,noexec,nosuid,utf8,uid=29999 0 0
/dev/mmcblk0p2 none swap sw 0 0


Luego agregar la siguiente línea antes del exit 0 en /etc/init.d/rcS :
swapon -a

OK swap listo, ahora el resto de la tarjeta la formateamos como ext2, más eficiente que FAT32.

Tenemos que instalar las librerías necesarias por que no están incluídas por default en el OS2008.Diablo.

hopper800:~# apt-get install e2fsprogs

Ahora podemos formatear nuestra partición
hopper800:~# mkfs.ext2 /dev/mmcblk0p1 
mke2fs 1.37 (21-Mar-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
870912 inodes, 1740799 blocks
87039 blocks (5.00%) reserved for the super user
First data block=0
54 block groups
32768 blocks per group, 32768 fragments per group
16128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.


Esta partición se monta automáticamente.

Espero que el desempeño de mi tablet mejore con esta configuración.