Jhi*_*bar 3 linux amazon-ec2 amazon-web-services
I recently ran a report on my EC2 server and was told that it ran out of space. I deleted the csv that was partially generated from my report (it was going to be a pretty sizable one) and ran df -h and was surprised to get this output:
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 7.0G 718M 91% /
devtmpfs 15G 100K 15G 1% /dev
tmpfs 15G 0 15G 0% /dev/shm
Run Code Online (Sandbox Code Playgroud)
I surprised not only by how little was available/how much space was used,(I am on the /dev/xvda1 instance) but also surprised to see 2 alternative filesystems.
To investigate what was taking so much space, I ran du -h in ~ and saw the list of all directories on the server. Their reported size in aggregate should not be even close to 7 gb...which is why I ask "what is taking up all that space??"
The biggest directory by far was the ~ directory containing 165MB all other were 30MB and below. My mental math added it up to WAY less than 7gb. (if I understand du -h correctly, all directories within ~ ought to be included within 165MB...so I am very confused how 7 gb could be full)
Anyone know what's going on here, or how I can clean up the space? Also, just out of curiosity, is there a way to utilize the devtmpfs/tmpfs servers from the same box? I am running on AWS Linux, with versions of python and ruby installed
对我来说,最好的选择是删除overlay2docker 文件夹并将 docker 完全刷新到干净的状态。就我而言,它清理了超过 3GB 的空间。
重要提示:它将停止并删除您的实例,因此您需要重建它们。
为此,首先停止 docker 引擎
sudo systemctl stop docker
Run Code Online (Sandbox Code Playgroud)
修剪然后删除整个docker目录(不仅仅是overlay2文件夹):
docker system prune
sudo rm -rf /var/lib/docker
Run Code Online (Sandbox Code Playgroud)
重新启动码头工人:
sudo systemctl start docker
Run Code Online (Sandbox Code Playgroud)
引擎将在没有任何映像、容器、卷、用户创建的网络或集群状态的情况下重新启动。
另外,您可以snap使用以下方法删除:
sudo apt autoremove --purge snapd
Run Code Online (Sandbox Code Playgroud)