Thursday, December 26, 2013

Rasberry Pi Backup Server, Part III: First boot with Rasbian

In Part II, we discovered how to install the operating system on an SD card, which would eventually be placed into the SD card slot on the Rasberry Pi. At this point, we prepare for the first boot. First, we will review the physical setup, then we will review the steps to complete the initial software setup. The goal is to have a nice, headless (monitor-less), easy to use file server for backup.

On first, boot, you will need access to a monitor so that you can review the progress of the boot process when you power it on for the first time. Other connections include power for the Pi, a network connection and a keyboard. The guidance in this article assumes you have all the parts listed in Part I of this series. Now its time to assemble the parts.

if you have not done so already, snap the cover into place around the Pi. The cover will help to keep dust off of the Pi and, I must say, it looks pretty cool with the cover on, especially if the cover is transparent.

As with all electronics, I like to connect the power last. There are several good reasons for doing this. First, once you connect the power to the Pi, it will boot and you'll miss that if the monitor is not connected. Second, you want to make sure that all the peripherals are connected prior to boot so that they are properly recognized.

Start with the SD card and slide it into the slot that is to the left and adjacent to the power supply, the power supply connects to the micro-A USB port on the same side. The SD card slot is pretty hard to miss, too. Note that the notch in the card requires you to insert the card with the metal contacts facing up - "up" is the side of the card with all the ports mounted on it. once the card is inserted, connect a keyboard, network and HDMI cable to the Pi in the appropriate places. Note that at this time, we will not be connecting external storage to the Pi. That will come much later in this series.

One you have all the peripherals connected and the monitor is powered on, then connect the power to the Pi and let it boot. You will see a Rasberry icon in the upper left corner of the screen as the Pi boots. Below that, text will scroll as the devices are discovered and the operating system completes the first boot process. When the operating system is ready, instead of booting to a login prompt, as we might expect, it boots into a setup menu.

There are two options we're going to work with on first boot. First, we will change the user password. Use the arrow keys to navigate to option 2, then press enter. You will be prompted to enter a new password for Pi, twice. We will do this first, because the second task requires a reboot and we want to have the password set before the reboot.

You want to change the password for the default user (in this case, Pi) and you want to do this on first boot. You could do it later, but trust me, this gets complicated if you don't change it at this point. The tool in the screenshot below makes it easy to do for newbies and techies alike. it is also worth noting that even though the documentation says that the default password for the Pi user is "rasberry", I've never seen that password work on any distribution I've ever installed on the Pi. I honestly have no idea why this is, and have had to resort to various hacks to set the password as desired. See the screenshot below for reference:


The next task, selected below is to expand the file system. When the Rasbian image is copied to the SD card, it creates one 2GB partition. If you have a card larger than that, you will want to expand the file system at this point so that you have plenty of room for adding other software should you choose to do so, later.

Select option 1 and follow the prompts, using the default options. It will do the rest for you and will complete the file system expansion on reboot:


After you run through the prompts for option 2, you will see the last prompt to reboot now. Reboot.

When the Pi comes up, login with the new password. If you don't see the phrase, "Access denied.", and you see the bash prompt, you have successfully changed the password. Once you see a bash prompt, check the file system size as follows:

pi@raspberrypi ~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          7.2G  1.8G  5.1G  26% /
/dev/root       7.2G  1.8G  5.1G  26% /
devtmpfs        211M     0  211M   0% /dev
tmpfs            44M  224K   44M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            88M     0   88M   0% /run/shm
/dev/mmcblk0p1   56M   19M   38M  34% /boot

If you have an 8GB SD card, and you see something like the above, then again, you have succeeded in completing the initial setup of the card.

In the next installment, we will create a user who will receive backups to this device and set them up so that we can login to that account automatically, over ssh.

No comments: