How can I free up disk space in my Ubuntu Hardy Heron install?

3

I'd like to make some room on /dev/sda1 without necessarily having to remove a whole bunch of applications (I've already gone through and deleted all frivolous apps).

This is the state of /dev/sda1 currently:

Dir: /
Type: ext3
Total: 9.4GiB
Free: 488.6MiB
Available: 0bytes
Used: 8.9GiB

EDIT added du output from comments below:

769068 /var/lib/mysql
351208 /usr/lib
297060 /usr/local/bin/eclipse/plugins
184124 /usr/bin
175924 /usr/lib/openoffice/program
143940 /usr/local/bin/eclipsePHP/plugins
 92520 /boot
 81200 /opt/android-sdk-linux/add-ons/google_apis-6_r01/images
 79964 /opt

That's funny, because the tables in /var/lib/mysql are the reason that I ran out in the first place. But I need them, and room for many more possibly large db's.

rvs

Posted 2010-05-18T16:15:54.267

Reputation: 33

Answers

2

How about log files? You could delete and/or compress them. While you're at it, make sure you have logrotate set up - that will take care of automatically compressing, rotating, and deleting your logs on a regular basis.

EEAA

Posted 2010-05-18T16:15:54.267

Reputation: 1 864

I do have logrotate set up and compression is enabled. I didn't make any custom configurations, though. On top of that, I followed this walkthrough:

http://www.ubuntugeek.com/cleaning-up-all-unnecessary-junk-files-in-ubuntu.html

Even after all of that, /dev/sda1 only has 240MB free. I'd like more! Any suggestions?

– None – 2010-05-18T18:08:13.897

Well, if you've deleted everything you can, then really the only recourse you're left with is adding another hard drive. – EEAA – 2010-05-18T18:39:15.670

I'm swapping it out for a 250GB drive. Yay! Thanks, all. – rvs – 2010-05-20T02:05:22.407

4

First, find out what's using your space...

# du -k -x -S / | sort -r -n
  • -k - output in kB instead of blocks
  • -x - don't check other filesystems mounted in the tree
  • -S - don't include subdir values

EDIT From the disk space report you added it seems you have two disk hogs:

  1. MySQL - move the data to a different partition, and either reconfigure MysQL (via /etc/my.cnf) or put in a symlink from the old location to the new one

  2. Development tools - that's a lot of Eclipse plugins, and an Android SDK too...

Alnitak

Posted 2010-05-18T16:15:54.267

Reputation: 656

xdiskusage is the visualization tool for this. – MikeyB – 2010-05-18T16:33:09.690

3sure, if you want to go all GUI on me... ;-) – Alnitak – 2010-05-18T16:34:14.633

Some may prefer the visualization of kdirstat or gtkfree. However xdiskusage (and it's grandpa xdu) allow you to visualize a file containing the output of du. So then you can do things like ssh server2 "du -k /usr"|xdiskusage – Bribles – 2010-05-18T16:57:41.860

Here are the first several lines of the output from Alnitak's command:


769068 /var/lib/mysql 351208 /usr/lib 297060 /usr/local/bin/eclipse/plugins 184124 /usr/bin 175924 /usr/lib/openoffice/program 143940 /usr/local/bin/eclipsePHP/plugins 92520 /boot 81200 /opt/android-sdk-linux/add-ons/google_apis-6_r01/images 79964 /opt

That's funny, because the tables in /var/lib/mysql are the reason that I ran out in the first place. But I need them, and room for many more possibly large db's. – None – 2010-05-18T18:29:19.720

1

Sometimes there's packages that you don't really need taking up a lot of space. Ie open-office. The debian-goodies package contains a script called dpigs that will list the top ten disk space offenders. Example:

~$ dpigs
264088 ubuntu-docs
119940 openoffice.org-core
94652 linux-image-2.6.32-22-generic
93752 linux-image-2.6.28-16-generic
92204 linux-image-2.6.27-11-generic
88180 linux-image-2.6.31-21-generic
86024 inkscape
79672 wine1.2
75348 openjdk-6-jre-headless
74320 linux-headers-2.6.32-22

If that's not enough you have to consider the point of running mySQL on a drive of a measly ten gigs. If this is for development testing, consider pruning the data. If it's production, consider moving it to it's own server or at least it's own disk. I can buy a terrabyte disk for under a hundred dollars now -- the time spent pruning an install and prioritizing useful software seems like a waste in comparison. Just format it, take mysql offline move everything over from /var/lib/mysql and remount the drive to that location.

jldugger

Posted 2010-05-18T16:15:54.267

Reputation: 264

0

You can reduce the percentage of usage reserved for privileged processes see: man tune2fs. Default is 5% of your disk space. Maybe an option is to reduce it to 2% ?

# tune2fs -m2 /dev/sda1

Casual Coder

Posted 2010-05-18T16:15:54.267

Reputation: 3 614

That one seems a bit too risky -- I don't want to hose my system because the OS didn't have room (and I'm not Unix-smart enough to deal with that). – None – 2010-05-18T18:23:30.667

Your call. I'm always reducing it on larger drives. – Casual Coder – 2010-05-18T18:33:49.553

What would you consider a 'larger drive'? Mine? – None – 2010-05-18T18:59:59.973

Try reducing to 3%. Check how much space you gain. You can always switch back to 5%. This is space reserved for privileged processes when there is no space left on device system has to have disk space for sockets, named pipes, temp files, etc. to operate. – Casual Coder – 2010-05-18T19:12:10.130

Also check that /var/lib/mysql maybe you have large binary log files ? sudo du -h /var/lib/mysql/* – Casual Coder – 2010-05-18T19:19:54.370

0

If the problem are binary logs check that how-to-free-up-var-lib-mysql-virtualbox-vm

Casual Coder

Posted 2010-05-18T16:15:54.267

Reputation: 3 614