raaspberry pi default wallpaper

Raspberry Pi 5 – Multiboot on NVMe SSD

From a transmission and whatever server to a libreelec Kodi TV Box to a retro gaming console.

Firstly, let’s take all the 3 image we need and put them on the Raspberry

The 3 partitions

First partition will be for Raspberry Pi OS 64 bit

Second partition for libreelec

Third for Retropi

Raspberry PI OS 64 Bits (Linux – 83)20 Gb/dev/nvme0n1p1
LibreElec (Linux – 83)20 Gb/dev/nvme0n1p2
RetroPi (Linux – 83)20 Gb/dev/nvme0n1p3
Share (extended)872 Gb/dev/nvme0n1p4

Raspberry Pi OS (64-bit)


Download the appropriate version (I took the full)

Mount it to modify and adapt (activate SSH for instance)

Because it’s a multi partition image you will have to find which partition to mount, usually take the biggest

$ file 2024-03-15-raspios-bookworm-arm64-full.img | sed s/\;\ /\\n/g
2024-03-15-raspios-bookworm-arm64-full.img: DOS/MBR boot sector
partition 1 : ID=0xc, start-CHS (0x40,0,1), end-CHS (0x3ff,3,32), startsector 8192, 1048576 sectors
partition 2 : ID=0x83, start-CHS (0x3ff,3,32), end-CHS (0x3ff,3,32), startsector 1056768, 27746304 sectors
x3ff,3,32), startsector 1056768, 27746304 sectors
Code language: Bash (bash)

Compute the partition 2 offset: startsector * 512 (blocks size) in this case it’s 541065216

$ sudo mount -o loop,offset=541065216 2024-03-15-raspios-bookworm-arm64-full.img /mnt/img/Code language: Bash (bash)

To make it “sshable” simply create an SSH file in the /boot/ folder

To add your ssh user, adapt the /home/pi/.ssh/authorized_keys file and put your public key

Then unmount the img and put the image on the disk in the first partition

Create the partition table

Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 2048 1056767 1054720 515M c W95 FAT32 (LBA)
/dev/nvme0n1p2 1056768 42999807 41943040 20G 83 Linux
/dev/nvme0n1p3 42999808 1953525167 1910525360 911G 5 Extended
/dev/nvme0n1p5 43001856 84944895 41943040 20G 83 Linux
/dev/nvme0n1p6 84946944 126889983 41943040 20G 83 Linux
/dev/nvme0n1p7 126892032 1953525167 1826633136 871G 83 Linux

Format all the file systems

sudo mkfs.vfat /dev/nvme0n1p1
sudo mkfs.ext4 /dev/nvme0n1p2
sudo mkfs.ext4 /dev/nvme0n1p5
sudo mkfs.ext4 /dev/nvme0n1p6
sudo mkfs.ext4 /dev/nvme0n1p7

Now we can start copying what’s inside the image.

First the boot part of the image

sudo mkdir /mnt/img-boot/
sudo mkdir /mnt/boot
sudo mount -o loop,offset=4194304 2024-03-15-raspios-bookworm-arm64-full.img /mnt/img-boot/
sudo mount -t vfat /dev/nvme0n1p1 /mnt/boot/
sudo rsync -a -v /mnt/img-boot/ /mnt/boot/Code language: JavaScript (javascript)

Add the SSH access

sudo touch /mnt/boot/SSH

We don’t need the mounted partitions anymore

sudo umount /mnt/boot
sudo umount /mnt/img-boot/

Then the remaining part of the image

sudo mkdir /mnt/img/
sudo mkdir /mnt/ssd-2
sudo mount -o loop,offset=541065216 2024-03-15-raspios-bookworm-arm64-full.img /mnt/img/
sudo mount /dev/nvme0n1p2 /mnt/ssd-2/
sudo rsync -a -q /mnt/img/ /mnt/ssd-2/
sudo umount /mnt/img
sudo umount /mnt/ssd-2Code language: JavaScript (javascript)

Make some room and use the 800 GB as a shared space

root@raspberrypi:/# mount /dev/nvme0n1p7 /mnt/newvar/
root@raspberrypi:/# cp -apx /var/* /mnt/newvar/Code language: JavaScript (javascript)

Install Raspotify client

curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/raspotify.gpg
echo 'deb https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list
sudo apt update
sudo apt install raspotify
Code language: PHP (php)

Set your speaker’s name

in the /etc/raspotify/conf file set the Device name

sudo vim /etc/raspotify/confCode language: Bash (bash)
LIBRESPOT_NAME="YourLocalNetworkVisibleDeviceName"Code language: Bash (bash)

Restart the raspotify service

sudo service raspotify restart


Leave a comment

Your email address will not be published. Required fields are marked *