What is actually on your Raspberry Pi SD Card?

Have you ever wondered what is actually on your Raspberry Pi SD card? Take a look by opening the command line and running the following:

cd /
ls -la

On the standard Raspbian SD card you will see something like the following:

total 112
drwxr-xr-x  25 root root  4096 Mar 23 17:36 .
drwxr-xr-x  25 root root  4096 Mar 23 17:36 ..
drwxr-xr-x   2 root root  4096 Mar 23 15:33 bin
drwxr-xr-x   4 root root 16384 Jan  1  1970 boot
drwxr-xr-x  13 root root  3440 Jun 15 22:31 dev
drwxr-xr-x 119 root root  4096 May 10 15:48 etc
drwxr-xr-x   3 root root  4096 Dec 21 11:13 home
drwxr-xr-x  14 root root  4096 May 10 15:48 lib
drwx------   2 root root 16384 Dec 21 11:04 lost+found
drwxr-xr-x   2 root root  4096 May 27 21:49 media
drwxr-xr-x   2 root root  4096 Jul 27  2014 mnt
drwxr-xr-x   6 root root  4096 Dec 24 11:28 opt
dr-xr-xr-x 148 root root     0 Jan  1  1970 proc
drwx------   6 root root  4096 Mar 23 17:36 root
drwxr-xr-x  19 root root   840 Jun 16 18:40 run
drwxr-xr-x   2 root root  4096 May 10 15:48 sbin
drwxr-xr-x   2 root root  4096 Dec 21 11:06 srv
dr-xr-xr-x  11 root root     0 Jan  1  1970 sys
drwxrwxrwt   9 root root  4096 Jun 16 18:40 tmp
drwxr-xr-x  10 root root  4096 Dec 21 11:06 usr
drwxr-xr-x  11 root root  4096 Dec 24 12:28 var

Linux usually splits the operating system over a number of different and separate drives, but as Raspbian only uses a single SD card, it's all on that single card.

Lets look at the contents of each folder, and what it is used for:

  • /bin/ - Contains essential command binaries - that is, commands that you can run and that are part of the base Linux operating system, like nanodata, chown and cat. You should not manually edit or change any files in this folder.
  • /boot/ - These are the 'boot loader' files that tell your Raspberry Pi how to boot. If you put your SD card into a PC, these are the only files that you can see, as this folder is in "FAT" format, which PCs can understand. Almost all files in this folder should not be edited, but there is one, config.txt, that you may need to edit to change how your Raspberry Pi boots. For example, screen resolution and memory settings are changed in config.txt.
  • /dev/ - Device 'files'. All devices in Linux are represented by 'files', including disk partitions of any attached hard drives (/dev/hda, /dev/hdb etc), CD ROMs (/dev/cdrom) and memory cards (/dev/sda, /dev/sdb etc).
  • /etc/ - System files that configure how the operating system runs. There are a lot of files under this folder that you are able to edit, but do so with care and only once you understand what it is you are changing. It is quite possible to stop the Raspberry Pi from working correctly if you make a change that the Raspberry Pi cannot understand. Therefore, if you do edit any files, always take a backup first! Examples of files that can be edited are:
    • hostname - The name of your Raspberry Pi.
    • fstab - Mounts file systems when the Raspberry Pi boots.
    • crontab - Cron is a way of running something periodically. the crontab file configures what should be run and when.
  • /home/ - Every user on your Raspberry Pi will have a folder under this one, named with the users' name. This is where each user puts their own files. To move to your own folder use cd ~
  • /lib/ - Essential shared libraries that are used by lots of different applications that run on your Raspberry Pi. You should not edit anything in here.
  • /media/ - Mount points for removable media. When you plug in any USB hard drives or memory cards they will be automatically mounted here so you can access them from your Raspberry Pi.
  • /mnt/ - Mount points for any temporary mounted filesystems - usually empty on the Raspberry Pi.
  • /opt/ - Any applications that you install on your Raspberry Pi will be installed here. For example, Minecraft, Sonic Raspberry Pi etc.
  • /proc/ - A special folder that represents Kernel and process statuses as text files. You can read them, but don't edit any of them.
  • /root/ - This is the home folder for the 'root' user. You don't have access to this one.
  • /run/ - This folder is used by running applications to store data. Don't edit anything in here.
  • /sbin/ - System binaries - which means they are applications that are mostly only runnable by the root user, like fsck (the file system check tool that goes through the SD card and looks for issues), or ifconfig (that lists the network connections that your Raspberry Pi has).
  • /svr/ - Like /proc/ and /run/, this folder contains files used by system services. If there are none running, this folder may be empty.
  • /sys/ - Another system-wide device folder, containing information and statistics about devices on your Raspberry Pi, like sound and the display. Don't edit anything in here.
  • /tmp/ - Temporary files used by the operating system - don't do anything in this folder.
  • /usr/ - Utilities and applications that are available to all users. Take a look in the bin sub-folder to see what you could run.
  • /var/ - Another (!) directory that the operating system writes files to during normal operation.

So, in summary, you can see that there are:

  • A few folders that contain applications and executables that you can run, plus libraries that those executables use.
  • A few folders that contain files that the operating system and applications use to store data when they run.
  • A boot folder containing files and information needed to boot your Raspberry Pi.
  • A configuration folder used by the operating system to set itself up.
  • A folder for your own files.
  • Device and drive folders containing files on external drives and also other devices attached to your Raspberry Pi.

Obviously I have not told you about each and every file and folder - that would take a whole book! But at least you know a little more (I hope!).