Ubuntu: Allowing an OS to use unclaimed free disk space on other partitions for temporary purposes?



Question:

Let's say you have something like the following situation: three partitions, one small with OS, and several bigger ones, let's assume all are ext4:

/            - 10 GB size, 9 GB used, 1 GB free  /media/disk1 - 100 GB size, 40 GB used, 60 GB free  /media/disk2 - 100 GB size, 60 GB used, 40 GB free  

So, while the root partition struggles a bit for space, there is generally plenty of free space in the system as such.

So, let's assume you want to perform an operation (like doing an apt-get upgrade), which needs a lot of scratch space to create and delete large files. If this process needs say 2GB of disk space, running it and relying only on the 1GB free on the root partition would make the process fail.

So is there some sort of a command that I can use, which would basically say to the OS: "in case of an emergency, you're allowed to use up to 50% on unused free space on any partition on the system" (clearly, under the assumption that once the calling process causing the emergency has exited, the scratch files on the other partitions are deleted, so the original state is restored) - which would make a process like above succeed, even if the space on the root partition is tight. I guess, this mostly means that the /tmp folder would not extend just on its own partition, but onto others as well.

Is there anything like this in Ubuntu - or is it even possible under GNU/Linux systems?


Solution:1

Ok, here's something - one can reserve hard disk space for use by root user:

https://unix.stackexchange.com/questions/7950/reserved-space-for-root-on-a-filesystem-why

Saving space for important root processes (and possible rescue actions) is one reason.

http://www.tldp.org/HOWTO/html_single/Partition/

The -m option is probably the one of most use to non-experts. If the file system becomes filled and there is no more space to write, it is basically unusable because the operating system is constantly writing to disk. By default, five percent of the partition is reserved for use by the root user. This allows root to conduct administrative activities on the partition and perhaps move some data off. However, this is most critical when the partition contains / or home directories. For pure data partitions, this is just lost space.

It would be nice to know where does this space end up in the filesystem tree...

Unfortunately, this seems to be a partition-time decision, so apparently there are no commands to modify this from the shell at runtime ?!


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »