Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where is the default tmpfs size setting?

945 views
Skip to first unread message

Bit Twister

unread,
Oct 3, 2012, 9:02:58 AM10/3/12
to
Anyone know where the default tmpfs size setting configuration file is?

As you can see on my 8G box, I have
$ df -kh | grep tmpfs
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 5.7M 3.8G 1% /dev/shm
tmpfs 3.8G 3.1M 3.8G 1% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup

3.8G has been assigned.

Yet on my VirtualBox 1G ram guest, I have
$ df -kh | grep tmpfs
Filesystem Size Used Avail Use% Mounted on
devtmpfs 495M 0 495M 0% /dev
tmpfs 500M 1.1M 499M 1% /dev/shm
tmpfs 500M 1.7M 498M 1% /run
tmpfs 500M 0 500M 0% /sys/fs/cgroup
tmpfs 500M 4.0K 500M 1% /tmp

its using 500M.

Adam

unread,
Oct 3, 2012, 9:26:01 AM10/3/12
to
Bit Twister wrote:
> Anyone know where the default tmpfs size setting configuration file is?
>
> As you can see on my 8G box, I have
> tmpfs 3.8G 5.7M 3.8G 1% /dev/shm
>
> Yet on my VirtualBox 1G ram guest, I have
> tmpfs 500M 1.1M 499M 1% /dev/shm

I have no idea (yet) where the default setting is, but I believe the
default is half of usable RAM. That's the maximum size; AFAIK tmpfs
only uses as much RAM as needed for whatever's stored on it at that
moment. In the first example above, that filesystem was taking up less
than 6M of RAM at that moment. HTH

Adam
--
Registered Linux User #536473

Bit Twister

unread,
Oct 3, 2012, 10:13:29 AM10/3/12
to
On Wed, 03 Oct 2012 09:26:01 -0400, Adam wrote:

> I have no idea (yet) where the default setting is, but I believe the
> default is half of usable RAM.

On my Cauldron 3 alpha1 install, its about 1 third of ram allocation.

> That's the maximum size; AFAIK tmpfs

Which I believe is what has been allocated for use. :(

> only uses as much RAM as needed for whatever's stored on it at that
> moment. In the first example above, that filesystem was taking up less
> than 6M of RAM at that moment. HTH

I won't argue there. But as far as I am concerned tmpfs is just a file
system on a very fast disk drive and its initial allocation is too
large. I have seen about 10M of swap being used in my 4G setup after
sereral days of use.

Since I planned to have a few VirtualBox guests running at once, I
went and spent $33 for another 4G. A few days later I see I have used
10M of swap again. :-(

My system usage pattern has not changed.

Aragorn

unread,
Oct 3, 2012, 10:49:03 AM10/3/12
to
On Wednesday 03 October 2012 15:02, Bit Twister conveyed the following
to alt.os.linux.mageia...
tmpfs does by default reserve half of your RAM - although it will
actually only use as much as is required - unless you specify otherwise
in the mount options.

There is no default configuration file for it, except maybe /etc/fstab,
if the tmpfs is mounted via that. Many of the things like /dev/shm or
/run /may/ however already be mounted by the init scripts - or
configuration files, in the event of systemd - before /etc/fstab is
parsed. This is distribution-specific.

Also note that tmpfs is not ramfs. It's a virtual memory filesystem, so
its contents can be paged out to the swap partition when needed.

--
= Aragorn =
(registered GNU/Linux user #223157)

Benny Nielsen

unread,
Oct 3, 2012, 11:35:21 AM10/3/12
to
Bit Twister wrote:

> Anyone know where the default tmpfs size setting configuration file is?

find the tmpfs line in /etc/fstab and change defaults to defaults,size=2g or
whatever you desire.
If it is possible to change the default I dont know.

bn

Bit Twister

unread,
Oct 3, 2012, 1:17:51 PM10/3/12
to
On Wed, 3 Oct 2012 13:02:58 +0000 (UTC), Bit Twister wrote:
> Anyone know where the default tmpfs size setting configuration file is?

looking at /lib/systemd/fedora-readonly I can not see where the size
value is set for tmpfs. :(

Aragorn

unread,
Oct 3, 2012, 7:09:36 PM10/3/12
to
On Wednesday 03 October 2012 19:17, Bit Twister conveyed the following
to alt.os.linux.mageia...
You'll just have to go over each human-readable file in the init
sequence, I'm afraid. In SysV init systems, this is normally handled by
/etc/rc.sysinit, but - again - this is distribution-specific.

Gentoo for instance moved the mounting of /proc, /sys and /dev out of
/etc/fstab a long time ago, but many Gentoo users still have them
mounted via /etc/fstab.

Note: Watch out for line wraps in the terminal snippet below.

[00:57:42][localhost:/home/aragorn]
[0][aragorn][$] > grep "tmpfs" /etc/* | grep mount
grep: /etc/at.deny: Permission denied
grep: /etc/gshadow: Permission denied
grep: /etc/gshadow-: Permission denied
grep: /etc/libaudit.conf: Permission denied
grep: /etc/login.defs: Permission denied
grep: /etc/mcc.conf: Permission denied
grep: /etc/mtab.fuselock: Permission denied
grep: /etc/shadow: Permission denied
grep: /etc/shadow-: Permission denied
grep: /etc/sudoers: Permission denied
grep: /etc/sudoers.d: Permission denied
/etc/rc.sysinit:# (bluca) handle udev /dev tmpfs here since kernel will
happily umount /dev after initrd end
/etc/rc.sysinit:mount -n -t tmpfs none /dev/shm >/dev/null 2>&1
/etc/rc.sysinit: mount -n -t tmpfs $RW_OPTIONS
$mountopts none "$RW_MOUNT"

Note: I do not know where $RW_OPTIONS is defined. It is either way not
in any file under /etc because I checked with a "sudo grep" - and yes, I
did omit the "$" from the search and used single quotes around the
search string.

And my distribution is...

[01:04:11][localhost:/home/aragorn]
[0][aragorn][$] > cat /etc/release
Mageia release 1 (Official) for x86_64

Adam

unread,
Oct 3, 2012, 11:25:15 PM10/3/12
to
Bit Twister wrote:
> Since I planned to have a few VirtualBox guests running at once, I
> went and spent $33 for another 4G. A few days later I see I have used
> 10M of swap again.

Is there some reason you can't just disable swap completely? Or add the
"size" parameter to the swap entry in /etc/fstab? If not, then I don't
quite understand what you want to do.

You also might want to see the article at
http://rudd-o.com/linux-and-free-software/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that
.

Bit Twister

unread,
Oct 3, 2012, 11:50:47 PM10/3/12
to
On Wed, 03 Oct 2012 23:25:15 -0400, Adam wrote:
>
> Is there some reason you can't just disable swap completely?

If I disable swap that could really slow down the system. :(

> Or add the
> "size" parameter to the swap entry in /etc/fstab?

There is no reason for me to adjust swap settings.
swap is on the disk, not memory resident. See
$ grep swap /etc/fstab
LABEL=swap swap swap defaults 0 0

$ blkid | grep swap
/dev/sdb1: LABEL="swap" UUID="f4d61d52-4313-4b1-597fb37ece22" TYPE="swap"

$ swapon -s
Filename Type Size Used Priority
/dev/sdb1 partition 3903756 120 0

By the way that ~3.9G is because I made the swap partition about the
size of ram at the time. I'll probably just make that a gig when I
reformat the drive.


> If not, then I don't
> quite understand what you want to do.

I just can not see wasting memory seen here
$ df -kh | grep tmpfs
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 1.2M 3.8G 1% /dev/shm
tmpfs 3.8G 4.1M 3.8G 1% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup

I would like to see something like
devtmpfs 495M 0 495M 0% /dev
tmpfs 500M 1.1M 499M 1% /dev/shm
tmpfs 500M 1.7M 498M 1% /run
tmpfs 500M 0 500M 0% /sys/fs/cgroup
tmpfs 500M 4.0K 500M 1% /tmp

>
It is not a matter of kde/terminal performance at the moment.

David W. Hodgins

unread,
Oct 4, 2012, 12:07:01 PM10/4/12
to
On Wed, 03 Oct 2012 23:50:47 -0400, Bit Twister <BitTw...@mouse-potato.com> wrote:

> On Wed, 03 Oct 2012 23:25:15 -0400, Adam wrote:
> I just can not see wasting memory seen here
> $ df -kh | grep tmpfs
> devtmpfs 3.8G 0 3.8G 0% /dev
> tmpfs 3.8G 1.2M 3.8G 1% /dev/shm
> tmpfs 3.8G 4.1M 3.8G 1% /run
> tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup

The tmpfs systems are using 5.3M of ram, not 3.8G. The 3.8G is
the limit, not the currently used.

>> You also might want to see the article at
>> http://rudd-o.com/linux-and-free-software/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that
>> .

> It is not a matter of kde/terminal performance at the moment.

Take another look. From my /etc/sysctl.conf ...

# Stop applications from being swapped to disk when swapping not needed
vm.swappiness=1
# Don't shrink the inode cache
vm.vfs_cache_pressure=50
# Don't allow more memory to be allocated, then is available
vm.overcommit_memory=2

With 5 VirtualBox sessions running, each of which allows it's guest
to use up to 2GB of ram $ free -m
total used free shared buffers cached
Mem: 15999 11447 4551 0 71 4695
-/+ buffers/cache: 6680 9318
Swap: 32767 0 32767

Regards, Dave Hodgins

--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)

David W. Hodgins

unread,
Oct 4, 2012, 12:19:22 PM10/4/12
to
On Wed, 03 Oct 2012 09:02:58 -0400, Bit Twister <BitTw...@mouse-potato.com> wrote:

> Anyone know where the default tmpfs size setting configuration file is?

See "man mount", "grep tmpfs /etc/rc.d/*", "grep tmpfs /usr/lib/dracut/*".
http://www.ibm.com/developerworks/library/l-fs3/index.html

If you really do want to resize it, see
http://www.howtoforge.com/storing-files-directories-in-memory-with-tmpfs

Adam

unread,
Oct 4, 2012, 4:13:25 PM10/4/12
to
Bit Twister wrote:
> $ swapon -s
> Filename Type Size Used Priority
> /dev/sdb1 partition 3903756 120 0
>
> By the way that ~3.9G is because I made the swap partition about the
> size of ram at the time. I'll probably just make that a gig when I
> reformat the drive.

I take it you don't use "suspend", "hibernate", or similar. As I
understand it, those store the contents of RAM in the swap partition or
file. I have a desktop system but still use hibernate on rare occasions.

Bit Twister

unread,
Oct 4, 2012, 5:13:02 PM10/4/12
to
Since default is half of ram size, actual solution will be to mount
with desired values.

Where, will be distribution and start up scripts dependent.
You may want to get current vaules using findmnt.

Example: findmnt --target /dev

On Thu, 04 Oct 2012 12:07:01 -0400, David W. Hodgins wrote:
> On Wed, 03 Oct 2012 23:50:47 -0400, Bit Twister <BitTw...@mouse-potato.com> wrote:
>
>> On Wed, 03 Oct 2012 23:25:15 -0400, Adam wrote:
>> I just can not see wasting memory seen here
>> $ df -kh | grep tmpfs
>> devtmpfs 3.8G 0 3.8G 0% /dev
>> tmpfs 3.8G 1.2M 3.8G 1% /dev/shm
>> tmpfs 3.8G 4.1M 3.8G 1% /run
>> tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
>
> The tmpfs systems are using 5.3M of ram, not 3.8G.

Yep, figured that.

> The 3.8G is the limit, not the currently used.

And that is where I made the bad assumption. When df shows Size of a
drive partition, that means that space is not usable by other partitions.

With tmpfs, that is the available ram space on the mount point that
still can be used/allocated by other memory processes.

>
> See "man mount", "grep tmpfs /etc/rc.d/*", "grep tmpfs /usr/lib/dracut/*".

grep -r tmpfs /usr/lib/dracut/*

Was more informative. :)
David, Thank You for your time.

Bit Twister

unread,
Oct 4, 2012, 5:24:36 PM10/4/12
to
On Thu, 04 Oct 2012 16:13:25 -0400, Adam wrote:
>
> I take it you don't use "suspend", "hibernate", or similar. As I
> understand it, those store the contents of RAM in the swap partition or
> file. I have a desktop system but still use hibernate on rare occasions.

Yes you are correct. I never suspend/hibernate. As I mis-understand it,
if you think/plan to use suspend/hibernate, swap should be size
of ram plus 512M plus however much swap might be in use at the time.
Worse case on a 2G system would be 4G+512M.
0 new messages