Raspberry Pi OS Notes

Updated October 19, 2020

Introduction

This is a list of quick reference tips to help make things run a little smoother.

Tips

Updating

You should update frequently. Use the following commands.

sudo apt update

sudo apt upgrade

Using full-upgrade is better because it also downloads dependencies.

Install Useful Packages

  • Git hub.  This will allow you to download and clone Git hub repositories.

sudo apt install -y git curl

Format a Large USB Hard Drive

I have a 5 tb WD Black Game Drive that I use for my NAS. This is how I formatted it:

  • Plug in the drive to the lower USB 3 port.
  • Find the drive connection.  in my case, it was connected as /dev/sdb.  Run: sudo lsblk
  • Run Parted, using the location of your drive if different from /dev/sdb:  sudo parted /dev/sdb 
  • Remove partition: rm
  • Add a GPT label, which will allow the drive to be formatted beyond 2tb:  mklabel
  • Choose a “gpt” as the label type.
  • Confirm that you want to destroy the data on the disk.
  • Make a partition:  mkpart
  • Enter a partition name.
  • Choose “ext4” as the file system type
  • Indicate the start of the partition.  If you don’t know what to select, you can chose 0 (zero), however this will likely result in an improperly aligned partition.  There is probably a better way to find out the optimal value, but I found it by running the partitioning steps twice.  So use 0 for the first pass, and then come back and run it again with the correct number for the start postition in bytes.
  • End of the partition.  Use “100%” to make a single partition for the entire drive.
  • And then quit
  • Now start the formatting process.  Remember if the location of your drive is /dev/sda, you’ll want to indicate the location as /dev/sda1 to refer to the first the partition: sudo mkfs.ext /dev/sdb1
  • If you started the partition at 0, then you will get an error stating “/dev/sdb1 alignment is offset by xxxx bytes. This may rsult in very poor partioning”.  In my case, it was 3072 bytes.  So use the number 3072, and repeat the partitioning steps above, but this time use the offset number instead of 0.
  • The second time you go through, you will have a properly formatted large usb 3 harddrive.