Operation Manual

Moving to a Bigger SD Card
If youve been using the Pi for a while, you may find that the 4 GB SD card you thought would be large enough for your needs
has become full. Buying a new SD card with 8 GB, 16 GB or even more storage is cheap enough, but you dont want to lose
your files.
Thankfully, its pretty straightforward to move the contents of your existing SD card across to a bigger card. The latter half of the
process is no different to how you flashed the SD card back in Chapter 1, Meet the Raspberry Pi. Where it differs, however,
is that you will be using the existing SD card as the source rather than a downloaded image file.
The process of cloning an SD card is nondestructive, and will result in both cards having the same data on them. If you have personal files on the old
SD card, make sure to wipe it clean before passing it on to a third party.vIn addition to your original SD card and the newer, larger card, youll need
access to a PC or Mac, an SD card reader andif you’re a Windows userthe Parted Magic disc used to resize the partitions earlier in this chapter.
The first step to moving to a larger SD card is to create an image of the existing card. If you have access to two SD card
readers, you can skip this step and, in the later instructions, replace the name of the image file with the device address of the SD
card reader with the Pis original card inserted.
Imaging from Linux
Creating an image of the SD card under Linux is no more difficult than flashing the card was in Chapter 1. Before starting, make
sure you have enough disk space on your computer to hold a file the size of the SD card. Then follow these steps:
1. Open a terminal from your distributions applications menu.
2. Plug your Pis smaller SD card into a card reader connected to the PC.
3. Type sudo fdisk -l to see a list of disks. Find the SD card by its size, and note the device address (/dev/sdX, where
X is a letter corresponding to the device. For some computers with in-built SD card readers, this may appear as
/dev/mmcblkX where X is a letter corresponding to the device. If so, use that address in the following instructions.).
4. Type sudo dd of=temporaryimage.img if=/dev/sdX bs=2M to read the contents of the SD card and write it to a file called
temporaryimage.img (see Figure 5-9).
Figure 5-9: Creating an image of an existing SD card using dd