Wednesday, April 24, 2019

Linux: Why Deleting Files Does Not Free Up Memory

This is a very old blog post from a place I contributed to:

You are in the middle of compiling your code and you see errors:
/disk/user1/platform_dev/driver/openwrt/staging_dir_arm_platform/bin/arm-unknown-linux-uclibcgnueabi-objcopy:/disk/user1/platform_dev/driver/base/build_platform/kmod/linuxmodule/stI4AuYi: No space left on device
make[5]: *** Waiting for unfinished jobs....

So this is just like old times. You run df -h and check if you are running at disk capacity.
I find that I am at 70% disk usage but still the make process is complaining.

I decide to be conservative and free up more space on the system.
Then I see something interesting. Despite doing the rm -Rf on a couple of big chunks of data,
I do not see the free space on my system going up. 

That gets me thinking why this might be happening. The reason is that the deletes I did were through screen. And, Linux will not free up any descriptors (Inodes) as long as they are being referred through some process.