By Jennifer Kim
I was trying to renew my SSL certificate on my droplet by following this guide: https://certbot.eff.org/lets-encrypt/ubuntubionic-nginx
But for some reason I kept getting 28: No space left on device
when I run apt-get update
. I tried to solve this by trying apt-get clean
, which seemed to work for a little bit but then still had the same issue.
I tried to remove files under /tmp/ and /var/log/ and started getting this error: Couldn't create temporary file /tmp/apt.conf.vDUIgg for passing config to apt-key
when I run apt-get update
. When I tried to follow this (https://sillycodes.com/quick-tip-couldnt-create-temporary-file/) but keep getting the same error. I’m running out of ideas on how to troubleshoot this, please help :'(
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hello,
I would recommend starting with the following:
df -h
The output would look something like this:
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 395M 1.8M 393M 1% /run
/dev/vda1 25G 20G 4.4G 82% /
In my case I am using 20G out of 25GB available for my root partition. Basically the df
command reports the file system disk space usage.
df -i
sudo find / -type f -size +500M -exec ls -lh {} \;
The output should look something like:
-rw-r--r-- 1 root root 1.8G May 13 15:43 /home/user1/large-file.txt
-rw-r--r-- 1 root root 1.8G May 13 15:42 /home/bobby/large-file.txt
-rw-r--r-- 1 root root 1.8G May 13 15:43 /home/bobby/public_html/wp-content/core.dump
-rw-r--r-- 1 root root 1.8G May 13 15:42 /home/bobby/public_html/error_log
Depending on the size of your disk, the command might take a while to complete. You can then go ahead and delete any of the large files that you do not need.
du
command which estimates the file space usage:du -h --max-depth=1 /
For example:
root@bobby:~$ cd /home/
root@bobby:/home$ du -h --max-depth=1
16K ./testuser
28K ./user
16K ./root
1.8G ./user2
5.0G ./bobby
7.1G .
Then we can cd
into the largest folder and run the command again:
root@bobby:/home$ cd bobby/
root@bobby:/home/bobby$ du -h --max-depth=1
76K ./.npm
4.0K ./script
5.0G ./public_html
12K ./.ssh
5.0G .
We would need to do that a few more times until we get to the folder that is using those 5GB:
root@bobby:/home/bobby$ cd public_html/
root@bobby:/home/bobby/public_html$ du -h --max-depth=1
8.0K ./test
4.9G ./wp-content
4.0K ./wpcli.bobbyiliev.com
14M ./wp-includes
7.4M ./wp-admin
16K ./node
5.0G .
Then one more time:
root@bobby:/home/bobby/public_html$ cd wp-content/
root@bobby:/home/bobby/public_html/wp-content$ du -h --max-depth=1
3.6M ./themes
252K ./plugins
4.0K ./upgrade
4.9G ./large-folder
4.9G .
And again:
root@bobby:/home/bobby/public_html/wp-content/large-folder$ du -h --max-depth=1
4.9G .
We’ve found the folder! We can see how many files are in the folder by running this command:
root@bobby:/home/bobby/public_html/wp-content/large-folder$ ls -lah | wc -l
4794
Note: if you have a database service like MySQL, make sure Not to delete any files manually from the MySQL folder. This would cause issues with your database.
If you are unable to clear any disk space I would recommend upgrading your Droplet.
Let me know if you have any questions!
Regards, Bobby Source
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.