0

I executed this command to create a RAM-Disk:

mount -t tmpfs -o size=60G tmpfs /tmp/ramdisk

After that I copied several files into this virtual filesystem as follows:

cp /mnt/user/hugefile.bin /tmp/ramdisk/hugefile.bin
cp /mnt/user/hugefile2.bin /tmp/ramdisk/hugefile2.bin
cp /mnt/user/hugefile3.bin /tmp/ramdisk/hugefile3.bin

Then, the last of the cp commands freezed and the CPU load hit the maximum. I think because the size of the RAM-Disk was larger than the free memory. I interrupted it by CTRL+C.

After a while I deleted the mounted RAM-Disk as follows:

umount /tmp/ramdisk

But and thats now my problem, it did not freed the shared memory:

free -g
              total        used        free      shared  buff/cache   available
Mem:             62           0           0          53          61           7
Swap:             0           0           0

As you can see there is no high usage on virtual memory:

df -BG | grep tmpfs
tmpfs                 1G     1G        1G   1% /run
devtmpfs             32G     0G       32G   0% /dev
tmpfs                32G     0G       32G   0% /dev/shm
tmpfs                 1G     1G        1G   1% /var/log
tmpfs                 4G     0G        4G   0% /tmp/plextranscode

I found this hint to use ipcs to analyze the usage, but the result is empty:

ipcs

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages    

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      

------ Semaphore Arrays --------
key        semid      owner      perms      nsems

I found this solution as well, but I'm afraid of killing data of other processes. Isn't there a more selective solution?

1 Answer 1

2

I found this solution as well, but I'm afraid of killing data of other processes. Isn't there a more selective solution?

echo 3 > /proc/sys/vm/drop_caches does not and cannot kill any processes or cause any harm to your system - it just evicts everything from your caches, not shared memory. ipcs has no relationship to your issue either.

tmpfs indeed occupies shared memory but unmounting a tmpfs mount point must automatically free your shared memory. Why hasn't it happened for you, I've no idea.

I believe your /tmp/ramdisk is still mounted but for some reasons df doesn't show it.

reboot will fix your issue.

1
  • Sad, but if this is the only solution I'll reboot
    – mgutt
    Commented Sep 29, 2020 at 16:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .