Mount partitions

Niellune
2025-11-29 11:33:44 +02:00
parent 6fb343385f
commit 29d4f918e0
4 changed files with 45 additions and 0 deletions
+45
@@ -110,7 +110,52 @@ Review the changes and apply them
Insert the SD card into the Raspberry Pi, connect the HDMI cable and keyboard, then apply power. If everything is correct, the rainbow screen will appear and the Pi will begin booting, followed by the setup process. Choose the keyboard layout and create a username and password. After a short time, a login prompt will appear. Enter the username and password you created to access the terminal.
## Mount partitions
Next, we need to configure the system to mount our new partitions as **home** and **swap**. First identify the partitions:
``` shell
blkid
```
![Lsblk output](pictures/rpi-mount1.png)
In the output, locate the partitions with labels `LABEL="swap"` and `LABEL="home"`. Note their **PARTUUID** and **/dev/device**.
We need to copy existing **home** directory to a new partition. Mount the **home** partition using */dev/device* name:
``` shell
sudo mkdir /mnt/home
sudo mount /dev/mmcblk0p3 /mnt/home
```
Copy the contents of `/home` to the new partition:
``` shell
sudo rsync -aX /home/ /mnt/home/
```
- **-a** - archive mode, preserves symbolic links, permissions, timestamps, ownership, and devices.
- **-X** - preserves extended attributes such as ACLs and SELinux context.
Edit the fstab file to configure automatic mounting of the new partitions:
``` shell
sudo nano /etc/fstab
```
At the end of the file, add an entry for the swap partition and home partition using its **PARTUUID**
``` shell
PARTUUID=your-home-partuuid /home ext4 defaults,noatime 0 2
PARTUUID=your-swap-partuuid none swap sw 0 0
```
![Lsblk output](pictures/rpi-mount2.png)
Rename the current */home* and create a mount point than reboot:
``` shell
sudo rm -r /home
sudo mkdir /home
sudo reboot
```
Check that partitions are mounted correctly with lsblk:
``` shell
lsblk
```
![Lsblk output](pictures/rpi-mount3.png)
# 3 WPA-Supplicant
To connect to the internet, we will use **wpa-supplicant**. It is lighter than NetworkManager and will also be used later for scripting.
BIN
Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

BIN
Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

BIN
Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB