How to keep control over disk-size
Asked Answered
P

5

9

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.

Professed answered 18/5, 2015 at 14:53 Comment(0)
K
10

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

Klara answered 19/5, 2015 at 12:15 Comment(3)
Cool to see. It confirms that in my case it are particularly gems that take up a lot of space. This includes gems that are no longer in use. Is there a better way to remove gems than to just delete its files one by one?Professed
Development.log and test.log also took over 100MB in my case. So I removed them.Professed
Helpful to reduce disk space are: gem cleanup, rake tmp:clear (clear session, cache, and socket files from tmp/), rake assets:clean (remove old compiled assets), and rake log:clear (truncates all *.log files in log/ to zero bytes).Professed
R
8

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

Regenerator answered 2/10, 2015 at 17:4 Comment(1)
ncdu is excellent and takes very little space itself. Thanks very much!Suwannee
S
2

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 .

Suppletory answered 3/1, 2017 at 18:2 Comment(0)
T
0

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/*

Teetotum answered 22/11, 2018 at 3:51 Comment(0)
A
0

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

Aureliaaurelian answered 22/4, 2022 at 19:3 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.