If you mount a tmpfs
instance with a percentage it will take the percent size of the systems physical ram. For instance, if you have 2gb of physical ram and you mount a tmpfs
with 50%, your tmpfs
will have a size of 1gb. In your scenario, you add physical ram to your system, let's say another 2gb, that your system has 4gb of physical ram. When mounting the tmpfs it will have a size of 2gb now.
When mounting multiple instances of tmpfs
each with 50% set, it will work. If both tmpfs
instances were filled completely, the system will swap out the lesser used pages. If swap space is full too, you will have No space left on device
errors.
Edit:
tmpfs
only uses the amount of memory that is taken, not the full 50%. So, if only 10mb of those 1gb are taken, your tmpfs
instance only occupies those 10mb. It's not not reserved, it's dynmically. With multiple instances of 50%, the first one that need memory gets memory. The system swapps the lesser used pages, if 50% is occupied or not. The tmpfs
instance is not aware of the fact whether it uses physical ram or swap space. You can mount a tmpfs
of 100gb if you want and it will work.
I assume that you shut the system down before adding ram. So the tmpfs
is remounted at startup anyway. If you add ram while the system runs, you will fry the ram, the motherboard and most likely your hand. I can't really recommand that :-)
Sources: