3

I have run out of space on my raspberry pi and now have a larger SD card for it. I have lots of data on the old card and want to move it over to the larger one, but when I transferred the files, the Pi did not seem to turn on properly, which would make sense, seeing as it probably didnt install the opera

2 Answers2

4

If you backup a img file of your SD card, you can then flash it too the newer one like you would flash a normal Raspbian etc image. This should be a bit quicker than trying to copy all the files.

First you need to backup up the image file - on Linux based systems this can be done with:

dd if=/dev/sdX of=/path/to/image.img bs=4M

Where /dev/sdX is the path to the SD card's device file (you need to unmount it first, to find out which one it is you can examine df -h, dmesg etc to guess which one it is, don't try and copy the system's one(s)).

For other systems see this answer.

Then, once you have a img file, you can flash it to the new card (make sure its bigger than the original)- again on Linux:

dd if=/path/to/image.img of=/dev/sdX bs=4M

Also, here are the RPi Foundation's instructions on flashing SD card images (including on Mac/Windows).

Note that when it has finished copying back to SD card image, this partitions still be the same size, so the extra space on the SD card won't be used. So you need to expand the filesystem, either on a desktop machine by use of a disk manager (e.g. GParted for Linux), or by using the 'Expand Filesystem' function of raspi-config. See also: RPi Resize Flash Partitons.

Wilf
  • 2,533
  • 3
  • 23
  • 39
0

If you create two partitions on the new card (FAT32 and ext4) and copy the contents from the corresponding partitions of the old card to those from the new one, that should work without problems. Make sure you keep the correct permissions (cp -p) and you do not copy the special directories dev, sys, proc, run and srv.

user236012
  • 670
  • 5
  • 10