diff --git a/Raspbery-Pi-Setup.md b/Raspbery-Pi-Setup.md index f4a67ef..1c6f192 100644 --- a/Raspbery-Pi-Setup.md +++ b/Raspbery-Pi-Setup.md @@ -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. diff --git a/pictures/rpi-mount1.png b/pictures/rpi-mount1.png new file mode 100644 index 0000000..a1d4de0 Binary files /dev/null and b/pictures/rpi-mount1.png differ diff --git a/pictures/rpi-mount2.png b/pictures/rpi-mount2.png new file mode 100644 index 0000000..e88ff23 Binary files /dev/null and b/pictures/rpi-mount2.png differ diff --git a/pictures/rpi-mount3.png b/pictures/rpi-mount3.png new file mode 100644 index 0000000..4ef83f4 Binary files /dev/null and b/pictures/rpi-mount3.png differ