Raspberry PI: Raspbian – Headless Multi Boot From USB Hard Drive

Unfortunately these partitions share a boot directory and a kernel, so updates may break one of the systems. The kernel version will also most likely will have to be the same on both systems. However, since I wanted to keep developing my hardened raspbian and start setting up a server this allows me to do both without contaminating my hardened version of raspbian with server programs. Eventually both will get merged but until I have a complete understanding of hardening this is a good alternative.

sudo fdisk /dev/sda

delete partitions

n
[enter]
[enter]
+4G [enter]
n
[enter]
[enter]
+4G [enter]
n
[enter]
[enter]
+1G [enter]
n
[enter]
[enter]
[enter]
n
[enter]
[enter]
[enter]
t
3
82
w

The third partition as a swap is not needed. however, I may choose to enable it at some point.

copy system to partitions

sudo dd if=/dev/mmcblk0p6 of=/dev/sda1
sudo dd if=/dev/mmcblk0p6 of=/dev/sda2

Resize the partitions

sudo resize2fs /dev/sda1
sudo resize2fs /dev/sda2

Make our different boot options

sudo cp /boot/cmdline.txt /boot/sd.txt
sudo cp /boot/cmdline.txt /boot/security.txt
sudo cp /boot/cmdline.txt /boot/server.txt

Edit the text files we just created to load the partitions we want

sudo nano /boot/security.txt
change /dev/mmcblk0p6 to /dev/sda1

sudo nano /boot/server.txt
change /dev/mmcblk0p6 to /dev/sda2

Then to change boot partitions boot into the linux and just copy one of the text files you created to cmdline.txt then reboot.

sudo cp /boot/security.txt /boot/cmdline.txt
sudo reboot