Book Image

Building Networks and Servers Using BeagleBone

By : Glenn V Veer, William Pretty, Glenn Vander Veer
Book Image

Building Networks and Servers Using BeagleBone

By: Glenn V Veer, William Pretty, Glenn Vander Veer

Overview of this book

Table of Contents (13 chapters)

Setting up to install Debian

At this point, you should install Win32 DiskImager and the archival program. This will be used to write the Debian image on the SD card. The archive for the disk image is located at and

In order to start the installation, perform the following steps:

  1. Extract the files from this archive and run Win32 Disk Imager. If you are using Windows 7 or higher, you will have to run the program as an administrator in order to write the Debian image to the SD card.

  2. Select the extracted image file using the blue-colored folder icon, and make sure that the device selected to be written to (F:\ in the following picture) is your SD card.

  3. Click on write and the image will be written to the SD card, as shown in the following screenshot:

  4. Once the image is written to the SD card, remove the card from the PC and insert it into the SD card slot on the BeagleBone.

The following image shows the BeagleBone board with HDMI, Ethernet, and USB installed and an SD card inserted:

At this point, the board is ready to be powered up and to run Debian. The USB cable may not have enough capacity to power the BeagleBone board, so it is strongly suggested that the board be powered by a 5-volt DC power cube with a current output of 2 amps. This will provide sufficient power to the board. Turn on the power to the board. If the board does not power up, press S3 to enable the power. S3 is located directly above the Ethernet connection. After about a minute, your screen should display a login prompt. If this does not happen, power off the board and hold down the boot button (located near the top-right corner of the board, close to the SD card); then apply power to the board and don't release the boot button until the user LEDs begin to flicker.

The following screenshot shows the display that you will get after you log in for the first time:

In order to login, the username is debian and the password is temppwd. The next thing that needs to be done is to get all the updates that are available, and then the image should be resized in order to use the entire 8 GB of the SD card. In order to update, the following commands should be run:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

All of these three commands can be run at the same time by inserting && between each command. After the update is completed, reboot the board (sudo reboot) and relogin. At this point, the image will be resized to use the entire size of the SD card.

Before the resizing operation, run the following command to show how much of the SD is being used:

df –h

The following screenshot shows the output of the df –h command:

Using the SD card before the resizing operation

First, list the volumes that are available on the SD card by running the following command:

ls –l /dev/mmcblk*

The output will show all the volumes, as shown in the following screenshot. The volume that will be modified is the first volume in the list, /dev/mmcblk0. This is because mmcblk0 refers to the SD card.

A list of all the available volumes is shown in this screenshot.

At this point, the superuser should be logged in to complete the disk resizing, by executing the following command:

sudo su

Again, the password is temppwd. Once the superuser is active, run fdisk on the first volume with the following command (also shown in the preceding screenshot):

fdisk /dev/mmcblk0

Once fdisk is running, enter p as the first command. This will display the partition information of the SD. The resizing operation will delete the empty partitions and expand the primary partition to use the entire SD.

First, press d for delete and then press 2 for partition 2. Next, press n for new, p for primary, and 2 for partition 2. Specify the start and end sectors for the new partition—just select the default values by pressing Enter. In fact, outside the first n, they are all default choices and pressing Enter alone to confirm the choice is all that is needed. Select w to commit the changes to the SD card. Notice that the partition table in this example was "busy," so a reboot is needed for the changes to be reflected. Reboot by entering sudo reboot from the terminal command line, and re-login to update the changes for the next step of resizing the filesystem.

As we can see in the following image, the resized partition is ready to have the file system resized onto it.

Now the file system is ready to be resized. This will take only one command, as follows:

resize2fs /dev/mmcblk0p2

After this command, the SD card will have all its space available to the OS. Running another df –h command will confirm that the new disk size is now much more than 2 GB.

The following screenshot shows the new file system on the SD card, which resulted from running the resize2fs command: