DISK SPACE ACCIDENTALY CONSUMED? dev\vda1 100% used

March 14, 2019 1.2k views
System Tools Ubuntu 16.04

Hi!

My site is back, but i can't make any editions. As soon as I try to save anything, i get a 502 Bad Gateway. Looking here and there i am finding out that i am running out of disk space.
How to clean it and how to avoid it being full again... something is wrong...
Someone gives a hand?

sudo df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            487M     0  487M   0% /dev
tmpfs           100M   11M   89M  11% /run
/dev/vda1        30G   30G     0 100% /
tmpfs           497M     0  497M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           497M     0  497M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/1000

1 Answer

You could use a command like this to help figure out where the disk usage is coming from:

du -a / | sort -nr | head -n 10

It lists the size of all files in the / directory, sorts them by size descending, and then prints only the ten largest files (useful if a directory has a lot of files).

Based on the output, you'll need to revise the du -a / part to check different directories - it can depend on what applications you're using but web server, database, or log file directories are probably good places to check.

Also, if you free up enough space (or you already have it installed), ncdu is also really helpful for viewing disk usage. With a command like ncdu -x /, you can use arrow keys to move around the filesystem and view disk usage.

  • @ncole, thaaaanks

    My eye lieds are just saying goodbye, but i found this command here:

    sudo find / -type f -printf '%12s %p\n' 2>/dev/null|awk '{if($1>999999999)print $0;}'
    

    Which gave me following responses:

    140737477881856 /proc/kcore
     19824881664 /var/log/fail2ban.log
      5358611237 /var/log/fail2ban.log.4.gz
      2554499640 /var/log/fail2ban.log.12.gz
    

    However, with filezilla i am deleting the files... After i'm done with this deleting, which is taking a long time, i shall uninstall the fail2ban, right? What do you think?

    Note: One should be aware that the kcore file is just a virtual file, not to be deleted, as explained here.

  • @ncole
    Fresh day.

    Thanks a lot once more for caring. Yesterday by deleting those 3 files my site came back and i could edit what i wanted. However, today again i checked and my disk space is 100% consumed. So, i came back here to see your orientation. By giving

    du -a / | sort -nr | head -n 10
    
    

    , i get a large list of the same:

    du: cannot read directory '/proc/31583/map_files': Permission denied
    du: cannot read directory '/proc/31583/fdinfo': Permission denied
    du: cannot read directory '/proc/31583/ns': Permission denied
    sort: write failed: /tmp/sortJtUn9L: No space left on device
    
    

    I gave a

    sudo chmod -R 777 /proc
    
    

    but i got a

    operation not permited
    
    

    I also tried

    sudo du -a / | sort -nr | head -n 10
    
    

    And i get

    du: cannot access '/proc/312/task/312/fd/4': No such file or directory
    du: cannot access '/proc/312/task/312/fdinfo/4': No such file or directory
    du: cannot access '/proc/312/fd/3': No such file or directory
    du: cannot access '/proc/312/fdinfo/3': No such file or directory
    sort: write failed: /tmp/sortrmAhch: No space left on device
    

    I also tried to instal ncdu

    sudo apt-get install ncdu
    
    

    I've got

    E: You don't have enough free space in /var/cache/apt/archives/
    
    

    Trying to find a solution. Thanks for caring. :)

  • @ncole SOLVED

    A reboot solved all.
    Commanded

    sudo shutdown -h now
    
    

    And then i powered off and on in the droplet panel by DO.

    I went back to Putty and gave

    sudo df -h
    
    

    Resulting

    Filesystem      Size  Used Avail Use% Mounted on
    udev            487M     0  487M   0% /dev
    tmpfs           100M  3.1M   97M   4% /run
    /dev/vda1        30G  3.2G   26G  11% /
    tmpfs           497M     0  497M   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs           497M     0  497M   0% /sys/fs/cgroup
    tmpfs           100M     0  100M   0% /run/user/1000
    
    

    Thanks so much for you attention!

Have another answer? Share your knowledge.