fbpx

How To Create a RetroPie USB Boot Drive for Raspberry Pi 3

In this article, you are going to learn how to use an HDD with your Raspberry Pi instead of a SD Card.

If you really enjoy this article, consider checking out my TechWizTime YouTube Channel.

And for an awesome source of Raspberry Pi Accessories, check out my Raspberry Pi Amazon List.

Let’s get started!

What you’ll need

Update your RetroPie

Press “F4” to get into the Command Line.

Type “sudo apt-get update && sudo apt-get install rpi-update” and press “Enter”

Type “sudo BRANCH=next rpi-update” and press “Enter”

Configure the boot config file

Type “echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt” and press “Enter”

Reboot the system by tytping “sudo reboot”

After it reboots properly, press “F4” to return to the Command Line.

Type “echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt” and press “Enter”, if the return is 17:3020000a, you may continue, if not, then your HDD or USB Stick may not be compatible.

Go into the config file by typing “sudo nano /boot/config.txt” and then pressing “Enter”

Scroll to the bottom of the file with your arrow keys.

Delete the line that reads “program_usb_boot_mode=1”

Press “Ctrl” + “X”, then press “Y” and then hit “Enter”, this will save the file and take us back to the Command Line.

Setting up the Hard Drive Partitions

After we’re back to the Command Line, type “sudo parted /dev/sda” and press “Enter”

Type “mktable msdos” and press “Enter”

Say “Yes” to destroying the disk label.

Create the “fat32” partition by typing “mkpart primary fat32 0% 100M”

Create the Linux partition by typing “mkpart primary ext4 100M 100%”

Type “quit” to get out of the partition tool

Type “sudo mkfs.vfat -n BOOT -F 32 /dev/sda1” and press “Enter”

Type “sudo mkfs.ext4 /dev/sda2” and then press “Enter”

Copy all the files from your MicroSD Card to your Hard Drive

Type “sudo mkdir /mnt/target” and press “Enter”

Type “sudo mount /dev/sda2 /mnt/target/” and press “Enter”

Type “sudo mkdir /mnt/target/boot” and press “Enter”

Type “sudo mount /dev/sda1 /mnt/target/boot/” and press “Enter”

Be sure that you have “rsync” installed to it’s latest version by typing “sudo apt-get update && sudo apt-get install rsync”

Type in “sudo rsync -ax –progress / /boot /mnt/target” and press “Enter”. Be ready to have a long wait as it’ll start to copy all the files on your SD Card to your Hard Drive.

Bind the system directories

Type “cd /mnt/target” to access one of the mount directories

Type “sudo mount –bind /dev dev” and press “Enter”

Type “sudo mount –bind /sys sys” and press “Enter”

Type “sudo mount –bind /proc proc” and press “Enter”

To delete your SSH key and make your Drive a bit more secure, type “sudo chroot /mnt/target” and press “Enter” to get root access

Type “rm /etc/ssh/ssh_host*” to delete your SSH key.

Type “dpkg-reconfigure openssh-server” to create a new SSH key.

Type “Exit” once that the new SSH key is generated to get out of root.

Type “sudo umount dev” and press “Enter”

Type “sudo umount sys” and press “Enter”

Type “sudo umount proc” and press “Enter”

Finish adding the needed information to the Command Line of the Boot file by typing “sudo sed -i “s,root=/dev/mmcblk0p2,root=/dev/sda2,” /mnt/target/boot/cmdline.txt” and then press “Enter”

Add “fstab” to the boot file by typing “sudo sed -i “s,/dev/mmcblk0p,/dev/sda,” /mnt/target/etc/fstab” and then pressing “Enter”

Type “cd ~” after entering the last 2 commands and press “Enter”

Log out of the boot partition by typing “sudo umount /mnt/target/boot”

Type “sudo umount /mnt/target” and press “Enter”

Power off your Raspberry Pi by typing “sudo poweroff”, that way you can take out the SD Card.

Creation of an USB Boot for Retropie Finished

Congratulations, you’ve just set up your HDD to work with your Raspberry Pi and boot into RetroPie.

Did you manage to set it up by yourself? Did you have any problems during the setup? Have any suggestions? Then leave a comment below.

 

 

 

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.