Enlarge the SD card of your Pi Raspberry

Warning : This article has been automatically translated by Google Translate



Voilà, the much dreaded time has arrived :

Raspberry Pi Home Server : copier votre carte SD vers une carte plus grande

The lack of space begins to be felt !

Inevitably with a 2 GB card, We quickly end up being lack of space. And clearly for me, reinstall everything was not possible. I therefore recovered a 16 GB card (Yes this is extreme but it takes what it takes !) so it becomes my new card for my server.

  1. First step : the backup ! For this, It is a choice and I will not be able to describe all. For example, in Mac Os (replace the X's rdiskX the number that goes well, found with the command Mount for example) :
    DD bs = 4 m if = / dev/rdiskX of =<name of your image>
  2. Once your image backup created, Insert your new card and copy the image top. Always on Mac Os :DD bs = 4 m if =<name of your image> of = / dev/rdiskY
  3. Now we have a copy of our 2 GB SD card on our 16 GB card. Put it in the Raspberry Pi and boot
  4. Login to the Raspberry and run the following command
    Fdisk/dev/mmcblk0

    It comes here to edit the partition table to change the size of the primary partition.

  5. Type p to view the information on the SD card

    expand-2

    Here you should remember the starting point of the primary partition that is 194560

  6. Delete the primary partition in combining the following commands
    • d <Enter>
    • 2 <Enter>
  7. Create a new partition primary above the former
    • n <Enter>
    • p <Enter>
    • 2 <Enter>
    • Make sure that the number proposed to start the partition is the same as that of the stage 5 (Home 194560)
    • Then use the suggested value that is the maximum value to occupy the whole of disk space (Home 30220287)
    • w <Enter> (It is to write the changes to the partition table)
  8. Do a reboot. If all goes well (If if it's going to happen), Raspberry Pi will restart without problem. Your partition will be enlarged but you will not always have the maximum possible size

    Raspberry Pi Home Server : copier votre carte SD vers une carte plus grande

    There is almost !

  9. Launch the expansion of the filesystem in him even :
    resize2fs/dev/mmcblk0p2

And here is the result :

expand-4

For me it took a few seconds to move to the maximum size but it will depend on the size of the destination and its quality card.

You can play !

Like this article ? Bear with me on patreon!

You may also like...