Migrating Raspberry Pi Version 2 SD card to Raspberry Pi 3 Hardware Platform

My development RPI has been an RPI version 2 since version 2 was first released. Further, everything except the boot files have been moved to a USB-based hard drive to increase performance (using a procedure much like this: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=44177)

I needed a new RPI for a project and found version 2s are more expensive than version 3s so I purchased a 3 to be my new dev machine and I’ll use the old hardware for the new project.

The problem with upgrading my dev hardware is the last thing I want to do is screw with the software on it. It has taken a lot of time to get it where I want it.  So it is important that I can just transfer the SD card and USB drive to the new hardware.

Here is the procedure I followed which worked just fine. I won’t waste time describing each step blow-by-blow. If you need to know the details, you can google them as I did.

Backup The System

If something goes wrong, you will want a backup. Expect to spend a few hours backing everything up (at least if you have a very big USB drive).

  • Poweroff the old RPI2 system.
  • Backup the SD card using Win32DiskImager
  • Mount the USB drive to a PC based linux system.
  • Zero free space on the USB drive:
sudo cp /dev/zero /mnt/usb/bigfile.zer
sudo rm /mnt/usb/bigfile.zer
  • Unmount the USB drive
  • Use fdisk -l to determine the device of the USB drive
  • Use dd to backup the entire drive to a location of your choosing:
dd if=/dev/sdb conv=sync,noerror | pv | gzip --fast > sdb-dd-yymmdd.gzip

In above example, I determined my USB drive was /dev/sdb so that is my source. I like to name the output file the drive name + backup type (dd or ntfsclone usually) +  date.

  • At this point, I put the SD card and USB drive back on the old version 2 RPI and restarted it.
  • I then did a DUMP of all files to a remote location so I can recover individual files if necessary.
  • Finally, I created a list of all installed packages using:
dpkg --get-selections | grep -v deinstall > //mnt/netdrive/tmp/installed-packages.lst

Upgrade the Operating System

My RPI Version 2 was running Raspian version Wheezy. You MUST be running Jessie (or later) OR do the following dist-upgrade.

As I understand it, dist-upgrade doesn’t upgrade you to Jessie, but makes sure you get ALL available packages (apt-get upgrade may hold back packages). My RPI 2 is using Wheezy, I followed this update and it worked fine for me.

  • Update the list of packages:
sudo apt-get update
  • Do the dist-update:
sudo apt-get dist-upgrade
  • Reboot to load the changes:
sudo reboot
  • Make sure things are working, then power off your RPI 2:
sudo poweroff

Upgrade The Hardware

At this time, pull the old RPI2 out. Transfer it’s SD card and connections to the RPI3. Power the RPI3 up.

Mine came up flawlessly following the procedure.

Good luck!


This entry was posted in c-rpi and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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