User Tools

Site Tools


copy_larger_sd_card_to_smaller_sd_card

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
copy_larger_sd_card_to_smaller_sd_card [2017/01/28 21:55] – [Backup the SD Card] walkeradmincopy_larger_sd_card_to_smaller_sd_card [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 4: Line 4:
 \\  \\ 
 {{:16gbsd8gbsd.jpg?500|}} {{:16gbsd8gbsd.jpg?500|}}
 +\\ 
 +\\ 
 +After initially thinking this would be a really simple task, I soon learned that no, it is not. And the worst part of it is, if you have for example a 16GB SD card, that you want to copy to another 1GB SD card, the destination card might be slightly smaller, and it will fail. This is very frustrating. If you are in this position, then read on.
 \\  \\ 
 \\  \\ 
Line 195: Line 198:
 \\  \\ 
 \\  \\ 
 +Open gparted (select the correct storage device remember).
 +\\ 
 +\\ 
 +{{:dd_restore_001.jpg?700|}}
 +\\ 
 +\\ 
 +Right click on all the partitions and remove them (Select Delete).
 +\\ 
 +\\ 
 +{{:dd_restore_002.jpg?700|}}
 +\\ 
 +\\ 
 +Once all of the partitions are removed, we have to click the arrow at the top of the gparted interface to accept the changes (just under the word Help in the above image).
 +\\ 
 +\\ 
 +Accept any warnings and proceed. You now have a blank SD Card.
 +\\ 
 +\\ 
 +To restore your image, use the following from the command line:
 +\\ 
 +<file>
 +sudo dd if=~/rpi_all.img of=/dev/sdb bs=1M
  
 +This gave me the output:
  
 +2200+0 records in
 +2200+0 records out
 +2306867200 bytes (2.3 GB, 2.1 GiB) copied, 460.966 s, 5.0 MB/s
 +</file>
 +\\ 
 +Note the time taken: 2306867200 bytes (2.3 GB, 2.1 GiB) copied, <color red>460.966 s</color>, 5.0 MB/s. This process took nearly 10 minutes, it's very slow so be patient.
 +\\ 
 +\\ 
 +Remove the SD Card from the Linux PC and put it in to the Raspberry Pi.
 +\\ 
 +\\ 
  
 +----
 +==== The Raspberry Pi ====
 +\\ 
 +If all has worked, the Raspberry Pi should now boot up. Once booted and logged in, we can check the partition sizes.
 +\\ 
 +\\ 
 +From the command line, use:
 +\\ 
 +\\ 
 +    df -h
 +\\ 
 +<file>
 +This will show the following:
  
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- df -h 
 Filesystem      Size  Used Avail Use% Mounted on Filesystem      Size  Used Avail Use% Mounted on
 /dev/root       2.0G  1.1G  880M  54% / /dev/root       2.0G  1.1G  880M  54% /
Line 228: Line 257:
 tmpfs           218M      218M   0% /sys/fs/cgroup tmpfs           218M      218M   0% /sys/fs/cgroup
 /dev/mmcblk0p1   63M   21M   43M  34% /boot /dev/mmcblk0p1   63M   21M   43M  34% /boot
- +</file> 
- +\\  
- +We can see from the /dev/root line above that the size is reported as 2.0G and that 880M is available. This is an 8Gb SD Card, and we need to reclaim that extra space. To do this, from the command line enter: 
-df -h+\\  
 +\\  
 +    sudo raspi-config 
 +\\  
 +\\  
 +From the menu, select No1. Expand Filesystem. 
 +\\  
 +\\  
 +{{:raspi-config-001.jpg?700|}} 
 +\\  
 +\\  
 +Once completed (takes just a few seconds) Select Finish and let the Raspberry Pi reboot. 
 +\\  
 +\\  
 +Now log back in and re-run the df -h command. 
 +\\  
 +\\  
 +    df -h 
 +\\  
 +<file>
 Filesystem      Size  Used Avail Use% Mounted on Filesystem      Size  Used Avail Use% Mounted on
 /dev/root       7.2G  1.1G  5.9G  15% / /dev/root       7.2G  1.1G  5.9G  15% /
Line 240: Line 288:
 tmpfs           218M      218M   0% /sys/fs/cgroup tmpfs           218M      218M   0% /sys/fs/cgroup
 /dev/mmcblk0p1   63M   21M   43M  34% /boot /dev/mmcblk0p1   63M   21M   43M  34% /boot
 +</file>
 +\\ 
 +Now it can be see that the partition (/dev/root) is 7.2GB in size, with 5.9Gb free.
 +\\ 
 +\\ 
 +That's it, all done.
 +\\ 
 +\\ 
 +As a footnote, I would copy the rpi_all.img to your PC, and the you can use this to create new SD Cards using Win32 diskimager as it's a lot less hassle. But only do this once you have proved the process works.
 +\\ 
 +\\ 
  
  
  
  
copy_larger_sd_card_to_smaller_sd_card.1485640515.txt.gz · Last modified: 2023/03/09 22:35 (external edit)