I’ve been running my Raspberry Pi on a really old 2GB SanDisk Ultra SD card. It worked fine, but it wasn’t fast, and there certainly wasn’t that much free space to do anything on. After installing a bunch of packages, compiling Node.js, and cloning a couple of Git repositories, I ran out of space.
I had a Transcend 4GB SD card lying around, and wanted to transfer the entire contents of the older SD card to the larger one.
Cloning the Old Card
I used the same tool that I originally used to write the Debian image to the SD card: Win32DiskImager.
For whatever reason, after inserting the old 2GB card into my computer, typing in a file name for the image, and hitting “read,” I got an error that said that the image didn’t exist. Well, duh. I was trying to create a new image.
Copying and pasting the Debian
.img and selecting it seemed to work. It just got overwritten, as expected.
I popped out the old card, inserted the new 4GB SD, and wrote the image to the card. It worked without any issues.
After plugging the new 4GB SD into the Raspberry and turning it on, I waited for it to boot and tried to SSH and VNC into it– both actively refused connection. Weird.
Thinking something went wrong during the write, I plugged the Raspberry into the TV again to see if it was outputting errors. Nothing.
After plugging the Raspberry back into the Ethernet and power in my room (it’s headless, so no monitor), I could SSH and VNC into it with no problem. Whatever the issue was seemed to solve itself…
Repartitioning the Card
Obviously, because the new 4GB card was an exact clone of the old one, the partitions were still sized for the 2GB card. This meant I gained no free space.
After going to this page and following the directions, I managed to resize the partitions to the full 4GB card– I now have a little over 2GB of free space, which is expected, since Debian Squeeze uses a little under 2GB.