Converting 2 separate existing Oses into a multi-boot with PINN

Converting 2 separate existing Oses into a multi-boot with PINN

Have you bought an HDD for your Raspberry Pi recently and want to transfer all your separate OSes to the HDD? With this tutorial, you will be able to transfer almost any OS into a multi-boot. Furthermore, you can also boot your Raspberry Pi from a Micro SD card, but the filesystem is on the HDD. Basically what this means is that the boot partitions will be stored on a Micro SD card and that the root partitions will be stored on the HDD. In this tutorial, we will be converting 1 Raspbian and 1 RetroPie Micro SD card into a multi-boot. If you want to do more OSes you can but keep in mind that you will need a large USB drive (64 GB). You will be able to install other OSes as long as you choose to add project spaces which you can later replace with compatible OSes.

Things needed:

  • A large USB drive or HDD or Micro SD card
  • Another USB drive for storing your OSes
  • SD cards containing existing OSes
  • Raspberry Pi
  • USB Micro SD card reader
  • A computer running Linux (It is possible to do this on a Raspberry Pi)

Backing up existing OSes:

Raspbian:

  1. Open Terminal
  2. Create a folder name /os/Raspbian using this command
    mkdir -p ~/os/Raspbian
  3. Insert your Micro SD Card that has your customized Raspbian OS into the USB reader. Plug the USB Reader into your computer.
  4. You need to know where your Micro SD card is located. It should be something like /dev/sda1 or /dev/sdb. You can find the mount point by using
    df -h
  5. In this tutorial, we will be using /dev/sda1 and /dev/sda2 as our mount points. Make sure to change everything with /dev/sda1 or /dev/sda2 to whatever you mounted drive is. We have two mount points as the Micro SD Card will have two partitions on it. (Boot and root partitions)
  6. sudo mkdir /media/<username>/boot
  7. sudo mkdir /media/<username>/root
  8. sudo mount /dev/sdb1 /media/<username>/boot
  9. sudo mount /dev/sdb2 /media/<username>/root
  10. We will now take a copy of our SD card.
  11. cd /media/<username>/boot
  12. sudo apt-get install bsdtar -y
  13. sudo bsdtar --numeric-owner --format gnutar -cpvf ~/os/Raspbian/boot.tar . 
  14. Make sure to copy the last . after boot.tar!
  15. cd /media/<username>/root
  16. sudo bsdtar --numeric-owner --format gnutar --one-file-system -cpf ~/os/Raspbian/root.tar . 
  17. Make sure to copy the last . after root.tar!
  18. xz -9 -e boot.tar For this following command, please do not use -9 if you are using a Raspberry Pi or low powered system. Use: xz -e boot.tar
  19. xz -9 -e root.tar For this following command, please do not use -9 if you are using a Raspberry Pi or low powered system. Use: xz -e root.tar
  20. You should now have 2 files in /os/Raspbian called boot.tar.xz and root.tar
  21. The next commands are needed to work out how much space is taken up.
  22. sudo du -BK -s /media/<username>/boot | cut -d"K" -f1 >boot.size
  23. sudo du -BK -s /media/<username>/root | cut -d"K" -f1 >root.size
  24. Unmount the card: umount /media/<username>boot
  25. umount /media/<username>root

RetroPie:

  1. Open Terminal:
    mkdir -p ~/os/Retropie2
  2. Insert your Micro SD Card that has your customized Raspbian OS into the USB reader. Plug the USB Reader into your computer.
  3. You need to know where your Micro SD card is located. It should be something like /dev/sda1 or /dev/sdb. You can find the mount point by using
    df -h
  4. In this tutorial, we will be using /dev/sda1 and /dev/sda2 as our mount points. Make sure to change everything with /dev/sda1 or /dev/sda2 to whatever you mounted drive is. We have two mount points as the Micro SD Card will have two partitions on it. (Boot and root partitions)
  5. cd /media/<username>/boot
  6. sudo apt-get install bsdtar -y
  7. sudo bsdtar --numeric-owner --format gnutar -cpvf ~/os/Retropie2/boot.tar . 
  8. cd /media/<username>/root
  9. sudo bsdtar --numeric-owner --format gnutar --one-file-system -cpf ~/os/Retropie2/root.tar .
    
  10. xz -9 -e boot.tar For this following command, please do not use -9 if you are using a Raspberry Pi or low powered system. Use: xz -e boot.tar
  11. xz -9 -e root.tar For this following command, please do not use -9 if you are using a Raspberry Pi or low powered system. Use: xz -e root.tar
  12. You should now have 2 files in /os/Retropie2 called boot.tar.xz and root.tar
  13. sudo du -BK -s /media/<username>/boot | cut -d"K" -f1 >boot.size
  14. sudo du -BK -s /media/<username>/root | cut -d"K" -f1 >root.size
  15. umount /media/<username>/boot
  16. umount /media<username>/root

Adding Metadata:

Raspbian:

  1. cd ~/os/Raspbian
  2. wget -N "http://downloads.raspberrypi.org/raspbian/os.json"
  3. wget -N "http://downloads.raspberrypi.org/raspbian/Raspbian.png"
  4. wget -N "http://downloads.raspberrypi.org/raspbian/partitions.json"
  5. wget -N "http://downloads.raspberrypi.org/raspbian/marketing.tar"
  6. wget -N "http://downloads.raspberrypi.org/raspbian/partition_setup.sh"
  7. We now need to edit values for “partition_size_nominal” and “uncompressed_tarball_size” in the boot and root partitions. Therefore we need to edit 4 values in total.
  8. expr `cat boot.size` / 1024 + 1 whatever the value is from this is, replaceuncompressed_tarball_size” in the boot partition.
  9. expr `cat boot.size` / 1024 + 1 whatever this value is, add 100 to it and replace “partition_size_nominal” in the boot partition.
  10. expr `cat root.size` / 1024 + 1 whatever the value is from this is, replaceuncompressed_tarball_size” in the root partition.
  11. expr `cat root.size` / 1024 + 1 whatever this value is, add 100 to it and replace “partition_size_nominal” in the root partition.
  12. Note the punctuation in the code is there on purpose.

RetroPie:

  1. cd ~/os/Retropie2
  2. wget -N "http://downloads.sourceforge.net/project/pinn/os/Retropie2/os.json"
  3. wget -N "http://downloads.sourceforge.net/project/pinn/os/Retropie2/partitions.json"
  4. wget -N "http://downloads.sourceforge.net/project/pinn/os/Retropie2/Retropie2.png"
  5. wget -N "http://downloads.sourceforge.net/project/pinn/os/Retropie2/marketing.tar"
  6. wget -N "http://downloads.sourceforge.net/project/pinn/os/Retropie2/partition_setup.sh"
  7. We now need to edit values for “partition_size_nominal” and “uncompressed_tarball_size” in the boot and root partitions. Therefore we need to edit 4 values in total.
  8. expr `cat boot.size` / 1024 + 1 whatever the value is from this is, replaceuncompressed_tarball_size” in the boot partition.
  9. expr `cat boot.size` / 1024 + 1 whatever this value is, add 100 to it and replace “partition_size_nominal” in the boot partition.
  10. expr `cat root.size` / 1024 + 1 whatever the value is from this is, replaceuncompressed_tarball_size” in the root partition.
  11. expr `cat root.size` / 1024 + 1 whatever this value is, add 100 to it and replace “partition_size_nominal” in the root partition.
  12. Note the punctuation in the code is there on purpose.

Copying Custom OSes:

  1. Plug your USB stick into your computer
  2. Copy the os folder to the USB drive. (Note: if any of the files are greater than 4GB, the USB drive needs to be formatted as EXT4 otherwise left as FAT32)

Installing PINN on your Multi-Boot Micro SD Card/HDD:

The tutorial can be found here:

Installation of custom backups to a Multi-boot with PINN:

  1. Plug the Micro SD card/HDD containing PINN into your Raspberry Pi.
  2. Turn on your Raspberry Pi.
  3. Since you are installing your custom OSes, there is no need to connect to the internet.
  4. Plug your USB drive containing the OS backups into your raspberry pi.
  5. Select the OSes and install them.
  6. After they have finished installing, click done, then boot into whatever OS you want.

This process should work with almost all available Raspberry Pi OSes. Keep in mind that the OS needs to have two partitions only. Some OSes such as Emteria.OS has 3 partitions which will not work with this process.  If you have any questions, comment down below. Enjoy!

Find the PINN wiki here

Leave a Reply

Your e-mail address will not be published. Required fields are marked *