'How to keep control over disk-size

I'm using Cloud9 (railstutorial.org) and noticed that the disk space used by my workspace is fastly growing toward the disk quota.

Is there a way to clean up the workspace and thereby reduce the disk space used?

The workspace is currently 817MB (see below using quota -s). I downloaded it to look at the size of the directories, and I don't understand it. The directory containing my project is only 170 MB in size and the .9 folder is only 3 MB. So together that doesn't come near the 817 MB... And the disk space used keeps growing even though I don't I'm making any major changes to the content of my project.

  Size  Used Avail  Use%
  1.1G  817M  222M   79%

Has it perhaps got to do with the .9 folder? For example, I've manually deleted several sub-projects but in the .9 folder these projects still exist, including their files. I also wonder if perhaps different versions of gems remain installed in the .9 folder... so that if you update a gem, it includes both versions of the gem.

I'm not sure how this folder or Cloud9 storage in general works, but my question is how to clean up disk space (without having to remove anything in my project)? Is there perhaps some clean-up function? I could of course create a new workspace and upload my project there, but perhaps there's an alternative while keeping the current workspace.



Solution 1:[1]

The du-c9 command lists all the files contributing to your quota. You can reclaim disk space by deleting files listed by this command.

Solution 2:[2]

For a user-friendly interface, you may want to install ncdu to see the size of all your folders. First, free some space for the install. A common way to do this is by removing your tmp folder:

rm -rf /tmp/*

Then install ncdu:

sudo apt-get install ncdu

Then run ncdu and navigate through your folders to see which ones are using up the most space:

ncdu ~

Reference: https://docs.c9.io/discuss/557ecf787eafa719001d1af8

Solution 3:[3]

For me the answers above unfortunately did not work (the first produced a list incomprehensibly long, so long that I run out of scroll space in the shell and the second one produced a strange list-- see at the end of this answer):

What did was the following:

1) From this support faq article: du -hx / -t 50000000

2) Identify the culprit from the easy to read, easy to understand list: in my case 1.1G /home/ubuntu/.local/share/heroku/tmp

3) From the examples of this article: rm -r /home/ubuntu/.local/share/heroku/tmp

Strange list: 1 ./.bundle 1 ./.git 1 ./README.md 1 ./Project_5 2 ./.c9 2 ./Project_1 3 ./Project_2 17 ./Project_3 28 ./Project_4 50 .

Solution 4:[4]

If you want to dig into more details of which file is affecting your workspace disk try this command: sudo du -h -t 50M / --exclude=/nix --exclude=/mnt --exclude=/proc

This will give you all the files on your Linux server and then you can remove any file by this command: sudo rm -rf /fileThatNeedsToDelete/*

Solution 5:[5]

From AWS in Cloud9 this command df -hT /dev/xvda1 worked for me:

[ec2-user ~]$ df -hT /dev/xvda1
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/xvda1     xfs       8.0G  1.2G  6.9G  15% /

more info here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-describing-volumes.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fabian Jakobs
Solution 2
Solution 3 alexandros84
Solution 4 Hamid Hemani
Solution 5 Anton Fedorenko