Categories
SysOps

How to resize live tmpfs filesystem

Resize live tmpfs filesystem.

Ensure that enough RAM is available.

$ free -h
               total        used        free      shared  buff/cache   available
Mem:            251G         15G        233G         96M        2.7G       235G
Swap:             0B          0B          0B

Inspect current tmpfs size.

$ df -h /tmp/
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           128M     0  128M   0% /tmp

Perform live tmpfs resize.

$ sudo mount -oremount,size=512M /tmp

Inspect tmpfs size after the operation.

$ df -h /tmp/
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           512M     0  512M   0% /tmp

Do not worry about stored data.

$ ls /tmp/
systemd-private-dcf130b50001479785d1e67b5fb3c7a7-chrony.service-foCbei
systemd-private-dcf130b50001479785d1e67b5fb3c7a7-systemd-logind.service-S6KPIg

Data will be preserved during this operation.