Originally published February 8, 2018 @ 11:03 pm

After downloading a Raspbian image and writing it to an SD card, you get the following error when trying to boot the Pi: “Could not expand filesystem, please try raspi-config or rc_gui. Boot and root partitions are on different devices”.

Some have speculated that Raspbian images released after April 2017 don’t work well with Parted. While this may be true, the most likely cause is that your SD card contains a small “boot” partition left from whatever other project you’ve been working on.

You need to clean the SD card and remove any existing partitions. Here’s how to do this in Windows:

Open cmd.exe as administrator
diskpart
list disk
select disk 1 # Important to select the correct disk!
clean
create partition primary
active
format fs=fat32 quick
exit

su_note]Do not screw up the disk # part or you may destroy your system disk.[/su_note]

If you open the Disk Management utility, your SD card should be entirely “unallocated”:

Now use your Win32DiskImager or Etcher to write the image file to the SD card and there’s a good chance everything will work just fine.