I am trying to understand the stuff. I have a machine with 80G storage. It looks like that:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 7.1G 43G 15% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 1.4M 3.9G 1% /dev/shm
tmpfs 3.9G 409M 3.5G 11% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda1 494M 125M 370M 26% /boot
/dev/mapper/centos-home 26G 23G 3.5G 87% /home
tmpfs 782M 0 782M 0% /run/user/0
Now, from what I read the tmpfs doesn't take physical storage, but uses the virtual memory of the machine. Is it correct? Does it affect the physical storage in any way?
Is there a reality where the tmpfs will be written to the physical storage? Next, do all the mounted (/dev/sda1, /dev/sda1, etc...) dirs share the tmpfs? Or each of them gets a different one?
Also, I tried to resize the tmpfs. I did :
mount -o remount,size=1G /dev/shm
On restart it went back to original size. I changed /etc/fstab like this:
tmpfs /dev/shm tmpfs defaults,size=1G
And then:
mount -o remount /dev/shm
it did the trick, but on restart it again went to it's original size. I think I am missing something.
/etc/fstab
is copied into the "init ramdisk". That would explain why changes to/etc/fstab
did not take effect on the next reboot. On Ubuntu, you rebuild the init ramdisk with the commandupdate-initramfs -c -k all
. I don't know the command on Centos. – mpb Oct 01 '20 at 04:41