En este ejemplo trabajamos con la imagen 2013-07-26-wheezy-raspbian.img, de raspbian.
$ /sbin/fdisk -ul 2013-07-26-wheezy-raspbian.img
GNU Fdisk 1.2.4
Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Disk /mnt/backup/RaspberryPi/raspbian_img/2013-07-26-wheezy-raspbian.img: 1 GB, 1932940800 bytes
255 heads, 63 sectors/track, 235 cylinders, total 3775275 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/mnt/backup/RaspberryPi/raspbian_img/2013-07-26-wheezy-raspbian.img1 8192 122879 64228
c FAT32 LBA
Warning: Partition 1 does not end on cylinder boundary.
/mnt/backup/RaspberryPi/raspbian_img/2013-07-26-wheezy-raspbian.img2 122880 3788799 1831410
83 Linux
Warning: Partition 2 does not end on cylinder boundary.
GNU Fdisk 1.2.4
Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Disk /mnt/backup/RaspberryPi/raspbian_img/2013-07-26-wheezy-raspbian.img: 1 GB, 1932940800 bytes
255 heads, 63 sectors/track, 235 cylinders, total 3775275 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/mnt/backup/RaspberryPi/raspbian_img/2013-07-26-wheezy-raspbian.img1 8192 122879 64228
c FAT32 LBA
Warning: Partition 1 does not end on cylinder boundary.
/mnt/backup/RaspberryPi/raspbian_img/2013-07-26-wheezy-raspbian.img2 122880 3788799 1831410
83 Linux
Warning: Partition 2 does not end on cylinder boundary.
Las opciones a fdisk: -u indica que use como unidad bloques y -l lista.
Lo que nos interesa son los sectores de inicio ("Start"), para pasarselos a mount con el parámetro offset. Vemos que el sector de inicio de la particion de boot (FAT32) es 8192. Ese número lo multiplicamos por 512 (el tamaño de cada bloque). Nos da: 4194304.
Entonces, como root montamos la particion:
Creamos los puntos de montaje:
mkdir boot raiz
Y montamos la partición de boot de raspbian, que contiene todo el firmware y la imagen del kernel:
# mount -o ro,loop,offset=4194304 -t auto 2013-07-26-wheezy-raspbian.img boot
# ls boot/
bootcode.bin cmdline.txt config.txt fixup_cd.dat fixup.dat fixup_x.dat issue.txt kernel_emergency.img
kernel.img start_cd.elf start.elf start_x.elf
# ls boot/
bootcode.bin cmdline.txt config.txt fixup_cd.dat fixup.dat fixup_x.dat issue.txt kernel_emergency.img
kernel.img start_cd.elf start.elf start_x.elf
Ahora la raiz de Raspbian:
# mount -o ro,loop,offset=62914560 -t auto 2013-07-26-wheezy-raspbian.img raiz/
Véase que offset=62914560 viene de multiplicar el sector de inicio de la partición 122880 * 512.
# ls raiz/
bin boot dev etc home lib lost+found media mnt opt proc root run sbin selinux srv sys tmp
usr var
bin boot dev etc home lib lost+found media mnt opt proc root run sbin selinux srv sys tmp
usr var
Veamos los tamaños de las particiones:
# df -h boot/
S.ficheros Tamaño Usados Disp Uso% Montado en
/dev/loop0 56M 19M 38M 33% /mnt/backup/RaspberryPi/raspbian_img/bootcode
S.ficheros Tamaño Usados Disp Uso% Montado en
/dev/loop0 56M 19M 38M 33% /mnt/backup/RaspberryPi/raspbian_img/bootcode
La de boot tiene 56M aprox. Y la raiz: 1,8G:
# df -h raiz
S.ficheros Tamaño Usados Disp Uso% Montado en
/dev/loop1 1,8G 1,4G 266M 85% /mnt/backup/RaspberryPi/raspbian_img/raiz
S.ficheros Tamaño Usados Disp Uso% Montado en
/dev/loop1 1,8G 1,4G 266M 85% /mnt/backup/RaspberryPi/raspbian_img/raiz
Continuar »