Rebuild OS image on NVME drive on Orange Pi 3B

If you have used cloud providers, you may know that they provide an option to rebuild the server OS if you have messed up things or are just testing things. This capability can also be applied to your local setup. In the previous article, I wrote about how to boot from NVME on Orange Pi 3B. Here, I am going to show you how to rebuild the OS image on the NVME drive on your Orange Pi 3B and start fresh.

The process is very simple and straightforward. I assume you have followed the article mentioned above. If you did not, and you have a similar setup, you can still use this method.

1- Boot from SD card

Shutdown the Pi and insert the SD card. Power on the Pi and let it boot from the SD card. The SD card has high priority over other storage when it comes to booting.

At this point, download the image you want to write to the NVME, or you can use one that you have already downloaded.

Alternatively, you can copy the image from your machine to the Pi via terminal using the scp command. The local IP of the Pi is 192.168.10.50 in my case.

scp /home/arif/Orangepi3b_1.0.4_ubuntu_jammy_server_linux5.10.160.img orangepi@192.168.10.50:/home/orangepi

2- Write image to NVME

After obtaining the image, you can quickly check the drives on the Pi with fdisk -l. For me, it is /dev/nvme0n1.

⚠️ Please note that this will delete all data on the NVME drive. Exercise caution and ensure you understand the implications. Make sure to backup your data before proceeding.

Run the following command to write the OS image to the NVME drive:

dd if=/home/orangepi/Orangepi3b_1.0.4_ubuntu_jammy_server_linux5.10.160.img of=/dev/nvme0n1 bs=1MB

Once it is completed, shut down the Pi, power it off. Remove the SD card and power it on. It will now boot from a freshly installed OS from NVME.