Once you downloaded a Raspberry PI *.img file you may have a reason to look inside the image. Here is a shot config on how you do it:

First get your image file:

# ls -lh
total 1.9G
-rw-r--r-- 1 root root 1.9G Apr 24 14:35 2013-02-09-wheezy-raspbian.img

Next, check the filesystem table with fdisk:

# fdisk -l 2013-02-09-wheezy-raspbian.img 

Disk 2013-02-09-wheezy-raspbian.img: 1939 MB, 1939865600 bytes
255 heads, 63 sectors/track, 235 cylinders, total 3788800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00014d34

                         Device Boot      Start         End      Blocks   Id  System
2013-02-09-wheezy-raspbian.img1            8192      122879       57344    c  W95 FAT32 (LBA)
2013-02-09-wheezy-raspbian.img2          122880     3788799     1832960   83  Linux

Subscribe to our NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.

The important note to take from the above output is:

  • Sector size: 512
  • start block: img1: 8192 and img2: 122880

Now create a directory mount point for both images:

# mkdir img1 img2

When your mount point directories are ready, mount both images with the sector size and start block information you have gathered in previous step:

# mount 2013-02-09-wheezy-raspbian.img -o loop,offset=$(( 512 * 8192)) img1/
# mount 2013-02-09-wheezy-raspbian.img -o loop,offset=$(( 512 * 122880)) img2/

Confirm that both images are mounted:

# ls img1/
bootcode.bin  config.txt    fixup.dat    issue.txt             kernel.img    start.elf
cmdline.txt   fixup_cd.dat  fixup_x.dat  kernel_emergency.img  start_cd.elf  start_x.elf
# ls img2/
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  selinux  srv  sys  tmp  usr  var
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT.
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
Get extra help by visiting our LINUX FORUM or simply use comments below.

Comments and Discussions
Linux Forum