Best way to get larger /tmp?

I want to have a bigger /tmp. As far as I understand, the default is handled by systemd. Now I could either disable the systemd service and add a line to fstab, or I could change the systemd service.

What is the recommended way of doing this? Are there advantages/drawbacks?

/tmp is a regular folder that is inside your root partition / as long as you did not create an own partition for it. If you created a specific partition for it, you need to resize it. If it is in / it can be as big as your / partition has free space

Do you mean Tmpfs? (Wiki)

By default, a tmpfs partition has its maximum size set to half of the available RAM, however it is possible to overrule this value. To explicitly set a maximum size, in this example to override the default /tmp mount, use the size mount option.

So am I not right that /tmp is in the RAM by default?

The issue I’m facing is, that I want to compile the tkg kernel, and use /tmp as the folder to build in. However, this fails due to insufficient storage size.

How much RAM do you have? TKG says about compiling in tmpfs:

Requires >= 32GB ram when building a full kernel, should work with less ram with modprobed-db

I have 32GB.

By default, /tmp is mounted on a tempfs.

No, it is.

You can change that by removing the line for /tmp in /etc/fstab if you have it and masking tmp.mount.

That will cause /tmp to be using your root partition.

1 Like

I don’t see it in fstab.

If it isn’t in your fstab, it is happening automatically via tmp.mount which is a systemd unit. You can mask it if you want to disable it.

Although, I wouldn’t recommend it unless you have a reason to do so.

Well, that’s my whole question. I assume that I, too, have that tmp.mount via systmd. But:

  • How can I verify that?
  • Is it better to modify that systemd unit, or should I mask it and add a line to fstab?
systemctl status tmp.mount

You shouldn’t modify it, you should just mask it.

You don’t need to add anything to fstab. Just make sure you don’t have an explicit tmpfs mount in fstab and mask the unit.

Oh, I guess I could have guessed that.

But if I mask the unit and don’t have a tmpfs mount in fstab, wouldn’t /tmp then be on my disk?

Isn’t that what you are trying to accomplish?

No, I want a larger ramdisk. (or tmpfs, or whatever it is called)


In that case, leave the systemd unit alone and add a tmpfs mount for /tmp in fstab.

That way you can specify whatever size you want.

1 Like

That means that I should not mask the systemd unit?

Correct, you don’t need to mask it. If you have a mount defined for /tmp in fstab it won’t do anything.

1 Like

This should be the real topic title (and question), while now it seems like an xyproblem.

You can use /var/tmp for larger disk space temp usage, or any other custom folder.
I suppose it must be possible to configure your temp folder path for your compilations…(?)

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.