Disable automatic file expansion


Thank you for DietPi, this is exactly what I was been looking for.
However, is there a way to disable the automatic file expansion feature ? I need to define other partitions to fit my project’s needs.
Or is it possible to reduce the expanded partition after DietPi has expanded ?

I’m lost with all the tutos about partitionning on linux… :frowning: and I can’t find a way to achieve it.

Thank you


Hi Madar,

You can resize and modify your partitions after DietPi has been fully installed.
To achieve this, you will need to:

  • Boot a linux system with gparted installed (or Hirens boot cd and select Linux based rescue from the list).
  • Plug in your SD card.
  • Run gparted and resize the 2nd partition of your SD card.
  • You can now create additional partitions on this SD card.

As DietPi runs the partition and filesystem expansion before it updates, to stop this from occurring, you would need to modify the source code after writing the DietPi image.


Thank you ! I’ve modified the Dietpi image to set a size to the expanded partition. It perfectly works.


Edit : Only filesystem was set to the good size. So I finally used the first method : using gparted on an ubuntu machine. Now everything is ok. Thank you !

New question : I now wish to protect my Pi booting on read only filesystem except for the new partition I’ve created that I will use for keeping pesistent data changes. Do you have a good tutorial entry point ? I’ve followed some, but it seems it doesn’t work so well. There were many errors during boot and sometimes whole system is freezing.

Thank you again :slight_smile:

Maybe should I start a new thread for the new question ?

Have you tried mounting the 2nd partition as read only? Simply add the ro value into /etc/fstab:

/dev/mmcblk0p2  / ext4  defaults,ro,errors=remount-ro,noatime  0 1


Yes it works. Thank you. I’ve also added ‘ro’ at the end of the cmdline.txt file.
What does ‘errors=remount-ro’ stands for exactly ? If I’m on a readonly system, it should not have any error at all, isn’t it ?
Do you think it’s mandatory ?

Thank you for your time!

If the partiton has an filesystem error (eg: corrupt data due to power loss), ‘errors=remount-ro’ will mount the partition as read only to prevent further damage.

As your always mounting the drive as read only, you can remove this flag. However, there is also no harm in leaving the flag in there.

Ok, that’s clear :slight_smile: Thank you Fourdee !