How do I clear space on my main system drive on a Linux CentOS system?
This works great. Can take a few minutes on bigger drives ( over a few hundred GB ):
find /directory/to/scan/ -type f -exec du -a {} + | sort -n -r | less
The output will be the biggest files first. You can page through the results with normal "less" commands ... space bar ( next page ) and b ( previous page ).
How to free up space on centos server
After a bit of search here I found an answer from How do I clear space on my main system drive on a Linux CentOS system? that worked for me:
If you just want to look for big files and delete those then you could also use find
find / -type f -size +100M
would search for files only (-type f) with a size > 100MB (-size +100M)
subsequently you could use the same command to delete them.
find / -type f -size +100M -exec rm \{\} \;
-exec executes a program which gets passed the file or folder it has found ( {} ), needs to be terminated with \;
don't forget you could add -i to rm to approve or disapprove a deletion.
centos free space on disk not updating
In most unix filesystems, if a file is open, the OS will delete the file right way, but will not release space until the file is closed. Why? Because the file is still visible for the user that opened it.
On the other side, Windows used to complain that it can't delete a file because it is in use, seems that in later incarnations explorer will pretend to delete the file.
Some applications are famous for bad behavior related to this fact. For example, I have to deal with some versions of MySQL that will not properly close some files, over the time I can find several GB of space wasted in /tmp.
You can use the lsof command to list open files (man lsof). If the problem is related to open files, and you can afford a reboot, most likely it is the easiest way to fix the problem.
No space left on device
Such difference between the output of du -sh
and df -h
may happen if some large file has been deleted, but is still opened by some process. Check with the command lsof | grep deleted
to see which processes have opened descriptors to deleted files. You can restart the process and the space will be freed.
CentOS no disk space left while copying a file to /home/ansible-user/ however admin-vol1 is of 100gb
Use (on your remote Linux server, perhaps thru ssh
) both df
and df -i
to check the available space (both for data and for inodes). You might have no more inodes available, even if a lot of data space remains free. See df(1). And there could be disk quotas. See quota(1) and ask your sysadmin.
error that no space left
That could be either data space, or inode space (or some disk quota exceeded). You should use both df
and df -i
to find out.
How can I increase the space allocated to the home/ansible folder?
That is a question for the sysadmin of your Linux server (who probably is also in charge of installing software). BTW, Linux has directories, not folders (folders are visible in some GUI, and might not be shown).
The amount of space dedicated for inodes and for data is fixed when creating the file system with mkfs(8) (actually with mke2fs(8) for ext4 file systems); usually that is happening when installing your Linux distribution. You could consider resizing it, but be sure to backup all the data (on some external storage) before attempting (on some unmounted partition) any resize2fs(8) (it is a risky operation, and you might lose all your disk partition if something goes wrong...)
At last, I recommend copying the *tar.gz
archive to your remote Linux server, and use on that server some tar xvf
command to extract it. Try tar tvf
before. See tar(1).
Related Topics
Overwriting Yocto Classes Through Meta-Layer
What Do Getresuid() and Setresuid() Do
Using Dma Memory Transfer in User-Space
How to Create a Virtual Device in Linux
How to Read/Write From/To a Linux /Proc File from Kernel Space
Does Each Unix File Description Have Its Own Read/Write Buffers
Docker with '-User' Can Not Write to Volume with Different Ownership
How to Suspend Another Thread (Not The Current One)
Is Overwriting a Small File Atomic on Ext4
How to Manipulate Array in Shell Script
Linux Umask for Sudo and Apache
Golang Os/Exec, Realtime Memory Usage
Simplest Way to Build Dotnet Sdk Project Requiring Net461 on Macos
How to Send a Mail with a Message in Unix Script
How to Change Default Number of Max Process Per User in Linux