Page cover image

Set up your Raspberry Pi over the network

Installing over the network onto a new storage device

CANNOT YET DO WITH RASPBERRY PI 5

Insert the microSD card into your Raspberry Pi's card reader.

Open a terminal window on your Raspberry Pi.

Identify the mount point of your microSD card by running the following command:

lsblk -p

This command will list all the block devices connected to your Raspberry Pi, including the microSD card.

NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
/dev/sda       8:0    1  28.9G  0 disk 
├─/dev/sda1    8:1    1   512M  0 part /boot/firmware
└─/dev/sda2    8:2    1  28.4G  0 part /
/dev/mmcblk0 179:0    0 238.8G  0 disk 

Based on the output of the lsblk -p command, your microSD card is identified as /dev/mmcblk0.

However, there are no partitions or mount points listed for the microSD card.

To download the Raspberry Pi OS image directly to the microSD card, you can follow these steps:

Create a directory on the microSD card where you want to store the downloaded image.

Mount the microSD Card

What is mounting?

In the context of operating systems, particularly Linux and Unix-like systems, mounting refers to the process of making a filesystem accessible at a certain point in the directory structure.

When a storage device such as a microSD card, USB drive, hard drive, or any other storage medium is mounted, it is integrated into the filesystem, and you can access its contents through a specific directory, known as a mount point.

Run the following command to create the mount point:

sudo mkdir /mnt/sdcard

This command creates a new directory that will serve as the mount point.

In this case, /mnt/sdcard is the directory where the microSD card's filesystem will be accessible once mounted.

Now mount the device

sudo mount /dev/mmcblk0 /mnt/sdcard

This command mounts the filesystem located on the device (in this case, the microSD card represented by /dev/mmcblk0) to the mount point /mnt/sdcard.

After this command is executed, you can access the files on the microSD card by navigating to /mnt/sdcard.

Reloading fstab Configuration

sudo systemctl daemon-reload

This command is used to reload the system manager configuration, which includes the fstab file among other system configurations.

This is particularly necessary if you have made changes to the fstab file, which stores static information about filesystems, their mount points, and mount options. It ensures the system recognizes any changes to how devices should be automatically mounted at boot.

What is fstab

The fstab (file systems table) is not related to downloading an operating system image directly to a microSD card, but it plays a critical role in how operating systems, including Raspberry Pi OS, manage mounted file systems. Let's clarify what fstab is before discussing how to download and write an OS image to a microSD card.

Understanding fstab

/etc/fstab is a configuration file in Unix and Unix-like operating systems, including Raspberry Pi OS (based on Debian Linux).

It contains information about different disk partitions and storage devices, and how these should be mounted into the filesystem.

It's used by the mount command to read and write data to the correct places on disk without user intervention at boot time. Each line in fstab specifies a particular block device, mount point, filesystem type, and the mount options, along with dump and pass options used for backup and filesystem checks.

Following these instructions will create a directory named /mnt/sdcard and mount the microSD card at that location.

cd /mnt/sdcard

After the microSD card is mounted, you use this command to change your current directory to the mount point, where you can now access the filesystem of the microSD card.

cd /mnt/sdcard

Create a directory for storing the Raspberry Pi OS images

sudo mkdir pi-images

Move to that directory

cd pi-images

Finally, this command changes the current directory to pi-images, where you can start working with or storing your files.

Last updated

Was this helpful?