Extending a dietPi file system (video #126)

Download image of the SD card

Here, you find the image of an SD card for the Raspberry Pi Zero. It only works for the Pi Zero. If you want to create a MQTT broker for another platform, you have to download the normal OS and then apply Peters script

Simple way

Look at https://learn.adafruit.com/resizing-raspberry-pi-boot-partition/edit-partitions

  1. If you have a other Linux system with a graphical interface, you can install gparted and mount your newly created SD card with the (too small) image into a USB card reader and the card reader into your running Raspberry.
  2. You have to enter your password twice
  3. You start gparted and search for your SD card. Then, with the right mouse, you resize/move your ext4 file system. Enter zero in the field “free space following) and hit “resize/move”
  4. Then, you apply all operations.
  5. Done!

Complex way (all commands in bold)

  1. Mount your newly created SD card with the (too small) image into a USB card reader and the card reader into your running Raspberry.
  2. Sudo fdisk -l shows you the name of this device (usually /dev/sda). It has two partitions, SDA1 and SDA2. And SDA2 is very small
  3. Sudo umount /dev/sda (usually, it is not mounted)
  4. Sudo parted /dev/sda
    unit chs
    print

  5. The numbers in red show the max number of cylinders, heads, and sectors of your SD card (actually, all numbers are too big). The yellow shows the actual beginning of your second partition
  6. Now, we have to remove the boundaries of the second partition: sudo rm 2
  7. And create new boundaries: mkpart primary 8,138,2 1963,254,62. We use the two numbers from before and subtract at least 1 from each (red number). You might get the error message “…is outside of the device /dev/sda”. Then, just experiment till your values are accepted (I found no better way)
  8. Now we quit the utility
  9. Next, we have to clean the newly created partition: sudo e2fsck -f /dev/sda2
  10. And resize the partition: sudo resize2fs /dev/sda2
  11. If we look at our partitions (sudo fdisk -l), we see, that the partition is bigger than before

 

This is the way it worked for me. No guarantee, that it works for you! I am a Linux beginner.

 

Source: http://elinux.org/RPi_Resize_Flash_Partitions