seven1m.sdf.org

Upgrade (Swap) Your Raspberry Pi 3 to a Raspberry Pi 4 Using the Same SD Card

written October 2019, updated October 2020

I recently upgraded my home Raspberry Pi server hardware from the Raspberry Pi model 3 to model 4. I was not interested in reinstalling Raspbian and all my home server software, so I went searching for a way to swap the SD card over to the new hardware.

Raspberry Pi 4, for a reason I'm not familiar with, requires a larger boot partition. You cannot just insert your existing SD card into the new Raspberry Pi 4, because the code necessary to boot it won't be there.

In short, the fix for this is:

  1. Upgrade Raspbian
  2. Enlarge the boot partition
  3. Update the bootloader
  4. Swap the card

Read on for the specifics...

  1. Make a backup! Pop the card in your laptop or desktop computer and image the SD card to a file. Here is a guide for that.
  2. While your SD card is still in your old Raspberry Pi, upgrade your version of Raspbian to Raspbian Buster. Basically, do this:
    1. sudo apt update && sudo apt dist-upgrade
    2. reboot
    3. edit the file /etc/apt/sources.list.d/raspi.list and change the word "stretch" to "buster". Save the file.
    4. sudo apt update && sudo apt dist-upgrade
    5. reboot
  3. If that went well, then you need to shut down your Pi and take out the SD card. Pop it in your laptop or desktop with a special program running: GParted. If your computer isn't running Linux, you can download a Live CD version of GParted and boot from a CD or USB. There are guides for helping you with that.
  4. Point GParted at your SD card and do these two things, then apply changes:
    1. Move the second partition to the right by about 200MB.
    2. Enlarge the first partition to fill the available space. Be sure not to change the start position of the first partition, or your Pi won't boot. Also make sure your first partition is at least 250 MB.
    Once the changes are applied, unmount the SD card and put it back in your Raspberry Pi 3.
    If that doesn't work: a kind reader noted that this did not work for them due to a bug in GParted/libparted, but they were able to delete and recreate the partition (with a larger size) by following these instructions. Once the partition was recreated, they were able to copy over the original boot partition files and it worked. (Thanks Sachin for this tip!)
  5. Run the following command: sudo apt install --reinstall raspberrypi-bootloader raspberrypi-kernel
  6. Swap the SD card over to the new Raspberry Pi and boot it up!

Hosting for this site is provided by

The SDF Public Access UNIX System