How do I change tmpfs default size?

Derek Broughton news at
Tue May 29 12:51:51 UTC 2007

Anders Häggström wrote:

> 2007/5/28, Derek Broughton <derek at>:
>> On 5/27/07, Anders Häggström <hagge.ubuntu at> wrote:
>> >
>> > The default size of every tmpfs-mountpoint is 50% of availible
>> > ram+swap, as far as I understand. I want to change that default
>> > setting but don't know how.
>> Add the following to /etc/fstab:
>> temp                    /tmp    tmpfs   defaults,size=32m 0      2
>> "size" can be in g (gigabytes) or m(megabytes)
> Thanks for the answer, but that is more or less just the same as to
> add -osize=32M to each and every mountpoint. I'm searching for a
> variable to change the defaultvalue. And if that does not exist I
> would suggest it should be added as TMPFS_SIZE=50% to
> /etc/default/tmpfs
>> >
>> > The only way I can figure it out as a workaround is to use -osize=32M
>> > on every mount if I don't want to rebuild my kernel (and I don't).
>> Yes, and why not?
> I want to be able to easily upgrade the kernel when a new one is
> distributed thru (main). If I build my own there will be a lot of
> trouble, or at least a lot of extra work, when I want to upgrade.
> But as the server-kernel is compiled I don't think I have much of a
> choise. There is ALOT of desktop-stuff in the server-kernel, like
> laptop specific things and such. But that is off-topic in this thread.

Oh, sorry, I didn't mean why not rebuild (I've given that up as a waste of
time, myself), but "why not use -osize?".  I agree that it's the same thing
as putting it in fstab, I just don't see the problem.  How often do you
want to mount a _new_ tmpfs?

btw, ime the default size is _not_ 50% of swap: that's why my fstab has
a "size" parameter.  My swap is 2G and my /tmp was 250MB (the same size
as /var/run and /var/lock) until I added a size=1g option.

More information about the ubuntu-users mailing list