30

Hi All I have a issue where my system wouldn't login or startup properly. I checked the hard drive space to find the below.

matthew@Kronos:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/Kronos--vg-root  214G  203G     0 100% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
udev                         7.8G  4.0K  7.8G   1% /dev
tmpfs                        1.6G  928K  1.6G   1% /run
none                         5.0M     0  5.0M   0% /run/lock
none                         7.8G  4.0K  7.8G   1% /run/shm
none                         100M  8.0K  100M   1% /run/user
overflow                     1.0M   36K  988K   4% /tmp
/dev/sda1                    228M   55M  161M  26% /boot
zeus                         1.8T  1.3T  540G  71% /zeus

How do I fix this 100% full, I do not have a bigger hard drive to give it, am I stuck with having to buy a bigger drive for it? I'm fairly new to ubuntu and linux so please provide full command line commands I need to use.

Thanks in advance.

4 Answers 4

30

I have found the issue! Drilling down into the files using:

sudo du -a /home | sort -n -r | head -n 10

Shows the top 10 files taking up the most space, two of the biggest was .xsession-errors and my downloads folder. After going to the directory and using rm -f on the folders my /home is now only 6.1G!

Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/Kronos--vg-root  214G  6.1G  208G   3% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
udev                         7.8G  4.0K  7.8G   1% /dev
tmpfs                        1.6G  912K  1.6G   1% /run
none                         5.0M     0  5.0M   0% /run/lock
none                         7.8G  148K  7.8G   1% /run/shm
none                         100M   20K  100M   1% /run/user
/dev/sda1                    228M   64M  152M  30% /boot
zeus                         1.8T  1.3T  538G  71% /zeus

Thanks to all that helped me to narrow down the issue and resolve it.

6
  • 4
    thanks for this command sudo du -a /home | sort -n -r | head -n 10, Jun 30, 2013 at 23:22
  • Well, I am lost here. I left a freshly installed SLES machine for some days and now /dev/mapper/system-root is full. I am not sure how to proceed.
    – Shailen
    Feb 26, 2018 at 13:27
  • 3
    My drive is so full that it won't even run du: du -a / | sort -n -r | head -n 10 sort: write failed: /tmp/sortxghtli: No space left on device df worked though.
    – Shailen
    Feb 26, 2018 at 13:31
  • After you have some space to install it I recommend using ncdu Jun 18, 2020 at 17:18
  • Thank you very much! In my case the problem was a log file 30gb! o.O
    – StPaulis
    Jul 15, 2020 at 8:57
5

So you've got a full harddisk and no extra space to put any of the stuff?

Delete some stuff?

Can you not clean things up a bit? A fresh Ubuntu install is only a few gigs so you've got a lot of something taking up that space. You're storing more than you can afford to store. Economics dictates that you need to ship some off elsewhere or just delete it.

  • Uninstall unused applications
  • Uninstall games you're not playing (aka only install the ones you're playing)
  • Keep your music in an online music-holding-solution.
  • Store your photos in something similar. Or Flickr, etc.
  • Archive stuff to CD/DVD/Bluray.

Buy more space.

If you just need to keep everything and won't delete any of it, you need more space. The only way you're going to resolve this in the long term is to buy more storage. Consider second hand if you can't afford new. The very biggest (currently 4TB) often isn't cheapest.

Reclaim "reserved" space

Ubuntu reserves around 5% to allow you to still use the computer if it's completely full. This is for root and root alone. If you're really stuck, you can reclaim this space:

sudo tune2fs -m 0 /dev/mapper/Kronos--vg-root

If you fill up this space, you are stuffed. You probably won't even be able to boot so only use this as a last resort!

3
  • Thanks for the comment, the drive full is a OS drive only and doesn't have any games, or hardly anything on it. I am running a server with a few apps about 5 in total are on all the time. All of my film and tv shows, websites etc are stored on my Zeus zfs drives of which I have plenty of space. I will try the reclaim space and see what happens.
    – Magnum26
    May 17, 2013 at 12:08
  • After running the tune command dev/mapper now shows as 95%. I thought Ubuntu was supposed to be small and assumed 250GB would be enough for 5 apps and the OS...
    – Magnum26
    May 17, 2013 at 12:12
  • 3
    250GB is about 240GB more than you need. Something is filling up that space. I suggest you spend some time with the disk usage tool to work out where it's going before that remaining 5% is gone too. Tools like sudo du -sh /* might also help (change the path as you find out where most of the space is used)
    – Oli
    May 17, 2013 at 12:59
3

This is what helped me after deleting stuff without success:

lsof | grep delete

This shows the pid of the processes which still have a handle on deleted files. Stop/kill the process to release the disk space.

It so happens that the deleted file might still be handled by a process and therefore still occupies disk space.

1
  • upon restarting, my freespace was restored. looked like some processes did have handles on files, which are not shown in du -h
    – Lydon Ch
    Mar 29, 2023 at 1:41
2

In my case, downloaded files were temporarily stored. Try removing stuff from /tmp.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .