Recently I found out that it's possible to use overlayroot with tmpfs to create stateless readonly root. However I couldn't find any info about limiting the size of tmpfs. Is it possible?


Yes, you can specify the size of a tmpfs using the size mount option, or the nr_blocks option. With size, you can specify the size in bytes (or kibibytes, or mebibytes, or gibybytes), or as a percentage of installed memory.

The size of a tmpfs can be changed on remount, after the initial setup, so with overlayroot you could reduce the size of the file system by remounting /media/root-rw.

| improve this answer | |
  • Will I have to do it on every boot or can it be done once? – Amomum Apr 19 '17 at 13:44
  • You’d have to do it at every boot. It might work if you add an entry to /etc/fstab with the relevant option (and specify noauto so that overlayroot’s mount works); alternatively, you could add the remount in a startup script. – Stephen Kitt Apr 19 '17 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.