Building a Pi which boots from hard disk

From Bradnor
Jump to navigation Jump to search

⇐ Notes

Download SD card image
Download Raspbian Buster image from raspberry.org
Burn to SD card using Etcher
Create a file on the /boot partition called ssh
$ echo "" > ssh
Boot Pi from SD card with hard drive attached
Login with ssh (NB : need to identify IP address)
Create a new user and change password of root account
$ sudo /usr/sbin/useradd --groups sudo,ssh --shell /bin/bash -m ch
$ sudo passwd ch
$ sudo passed root
Login with new account
If successful set pi account password
$ sudo passwd pi
enable vnc
$ sudo raspi-config
Option 3: Boot options
B1: Desktop/Cli
B3: Desktop (no auto login)
Option 5: Interfacing options
P3: VNC
Option 7: Advanced
A5: Resolution
select a resolution - I selected highest
Reboot
ssh to Pi and update and install emacs to have an editor I can remember the command of
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install emacs
Login with VNC (or connect keyboard and monitor)
Burn image to harddrive
From the menu select
Raspberry menu --> Accessories --> SD Card Copier
Select source and target
ensure 'New Partition UUIDs' is checked
Note new partition ID for sda2
$ sudo blkid
Edit files
$ sudo cp /boot/cmdline.txt /boot/cmdline_SDcard.txt
$ sudo cp /boot/cmdline.txt /boot/cmdline_harddisk.txt
$ sudo emacs /boot/cmdline_harddisk.txt
and change the entry 'root=PARTUUID=xxxxxxxx-02' to have the new partition ID, e.g. 'root=PARTUUID=405052aa-02'
$ sudo cp /boot/cmdline_harddisk.txt /boot/cmdline.txt
Reboot
Hopefully Pi has booted from hard drive
Check by running
$ df
which should show / mounted on dev/root with the size of the disk
Note that /boot seems to be the boot partition on hard drive and not that on SD card which is the cmdline.txt was read from
Finish configuring
$ sudo raspi-config
Networking
set host name
set wifi config
Localisation options
Change locale and add the en_GB_ and en_US_ options
Change timezone
Change wifi country