1

I have a headless raspberry pi running Home Assistant and a bunch of other docker containers. It has been running on a 64GB SD for some time and runs fine, but very occasionally runs out of space due to accumulated downloads or similar.

I bought a new 256 GB EVO card, and am trying to clone the old one to the new.

On a linux laptop with SD reader, I did

sudo dd if=/dev/sda bs=1M of=pi-image.img

then switch the SD card in the reader to the new one and did

sudo dd if=pi-image.img bs=1M of=/dev/sda

When I insert the new card into the pi and power it on, I get a mass of messages, the final one of which is:

not syncing : no working init found. Try passing init option to kernel. see Linux documentation for guidance

I checked the cmdline.txt file, and blkid for the root partition and they matched

I then tried e2fsck on the new SD card, and there was a mass of errors on the rootfs that I tried fixing, but after re-inserting in the pi still the same errors.

I then tried:

  • e2fsck on the original SD, no errors
  • formatted the new SD to a single, full size ext4 partition and ran e2fsck - no errors

So given there are no errors in the first part of the process, how can I clone the original 64GB SD to the new 256GB SD without resulting in errors?

3

1 Answer 1

2

If you're using dd to write SD cards, you're wasting time, and using the wrong tool for the job. But please don't take my word for it - check other opinions, or do your own research.

I would suggest you approach this as follows:

  1. make an image-backup of your current SD card using image-backup. @user68186 has referenced a link that will walk you through the details.

    At the end of this process (which isn't long), you will have an .img file that contains an exact replica of every file and smidgen of data on your SD card.

  2. With that .img file, get a tool like Etcher to write your .img to your new SD card. Really - these tools make it very easy.

2
  • 1
    For the second step, RPi Imager should also work. The other thing to note is when you boot from the new 256 GB SD card for the first time, the OS will automagically expand the system partition / to use all the empty space.
    – user68186
    Jun 6, 2022 at 0:50
  • Thanks for this - I tried using balena etcher, and the first time it wrote and validated, it said it had failed. So I ran it again and it was successful... so fingers crossed!
    – hitch
    Jun 7, 2022 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.