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 Answers
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.
-
So you end up in partitions having the same size like the partitions on old one? – user236012 Dec 02 '15 at 16:57
-
You can modify/shrink the SD card image (there are LOADs of stuff on this site about this http://meta.raspberrypi.stackexchange.com/q/605/10590), I didn't include this as the OP specified they were copying to a larger card. Also I have had no problem with images of cards that are the same size as the one I am copying too (I do usually shrink and compress the img files though to save space). – Wilf Dec 02 '15 at 18:12
-
1At least you should mention that you have to manually resize the partition holding the operating system. Just
dd
ing will result in the same size of the partitions with unused space at the end of teh SD card. ;) – user236012 Dec 02 '15 at 20:00 -
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
.

- 670
- 5
- 10
-
Yes, sorry guys.
I actually managed to work it out in the end. I used the Win32diskImager tool to "read" the files on the SD card into a system image file. I then used the "write" option to write the files in the Image file on to the new SD card.
– Kyran Richards Dec 04 '15 at 08:18
dd
orwin32imager
, it is less likely to work upon simple copy pasting. – dhruvvyas90 Dec 02 '15 at 08:29