LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 01-09-2013, 07:06 AM   #1
SuSE_Lamer
Member
 
Registered: Nov 2004
Location: Hamburg/Germany
Distribution: Debian 10
Posts: 169

Rep: Reputation: 16
Clean disk space in Ubuntu 12.04


Hello @all,

since last week I receive automatical warnings, that I have only 350-400 MB free on my file system (/root is 8 GB large). How can I clean some space? To be honest, I didn't expect that - more or less - standard installation of Ubuntu will consume all 8 GB of the space. I have nothing special installed...

Thanks in advance,
Andrey
 
Old 01-09-2013, 11:13 AM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
I have run a few distro's from an 8G usb flash drive. I'd say that 8G is the minimum for a bloated (if you prefer feature rich) distro such as Ubuntu.
If you didn't watch the install process you could get some loss you didn't expect. Maybe you made several partitions that are eating up space. Maybe you have many apps installed by default that you can remove.

I tend to use a single partition for small installs and the systems I use them on don't require swap so I don't even create one. Tools like disk partition viewing may help as well as the package management to see what is installed.
 
Old 01-09-2013, 11:21 AM   #3
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
8gb is TINY, I would seriously consider resizing the partition. (I personally use 20gb for my Debian / partition).

That being said, there are ways to free up a bit of space. For example you can clear apt's "cache" of downloaded packages with:

Code:
sudo apt-get clean
Also check /var/log for bloated log files you don't need, remove old kernel updates, etc. Ubuntu includes (or used to include, anyway--if it doesn't anymore, you can install it with Software Center) a disk usage analyzer called baobab that may be helpful to you.

Really though, storage is incredibly cheap in 2013 (1TB drives for $79) so just make it bigger and then you don't have to worry about a few mb here and there.
 
Old 01-09-2013, 04:51 PM   #4
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Århus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 619

Rep: Reputation: 45
If you have run a few updates, you may have several sets of kernels (old kernels will not be deleted when you install a new one). Take a look with the command:

dpkg -l linux-image*

and

dpkg -l linux-headers*

remove the older versions. A kernel version, together with headers, takes about 220M space.

Note: in order to delete headers, you first have to delete the corresponding *xx-generic, and afterwards the headers itself (ideas how to do it better welcome).

Edit: My ubuntu 11.10 has 6.2G used on /

Last edited by otoomet; 01-09-2013 at 04:52 PM.
 
Old 01-09-2013, 06:23 PM   #5
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
^--- good advice about removing old kernels, BUT in my opinion you should keep at least 1 spare kernel in addition to your current one, so that you have a fallback in case you need to troubleshoot.
 
Old 01-10-2013, 08:36 AM   #6
SuSE_Lamer
Member
 
Registered: Nov 2004
Location: Hamburg/Germany
Distribution: Debian 10
Posts: 169

Original Poster
Rep: Reputation: 16
Hello @all,

thanks for all hints. I have indeed several kernels, which I installed over standard update process.

Genral question of partition size: my hard drive is 80 GB, so I tried to partition it more or less fair, so that I could run both OSs (+ some shared drive) without any issues. And the value of 8 GB is based on my previous experience with Debian (which I had before). I never had less than 3 GB free space on Debian. So I thought that 8 GB would be an appropriate size.

I will apply all your hints and check, how much space I rescue.

Greetings from Hamburg,
Andrey.
Quote:
Originally Posted by SuSE_Lamer View Post
Hello @all,

since last week I receive automatical warnings, that I have only 350-400 MB free on my file system (/root is 8 GB large). How can I clean some space? To be honest, I didn't expect that - more or less - standard installation of Ubuntu will consume all 8 GB of the space. I have nothing special installed...

Thanks in advance,
Andrey
 
Old 01-10-2013, 08:55 AM   #7
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Århus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 619

Rep: Reputation: 45
Ubuntu 12.04 (my work server) has 6.2G on / as well (the same as 11.10 on laptop). Standard DE + latex + R + various this kind of stuff.

My bet is that 10G is sufficient, unless you like to install some sort of enormous software. What are your "both OS-s"? Ubuntu + XP? I cannot comment on XP. Say, you leave 40G for Ubuntu. I would partition it like that:
* 10G /
* 4G swap (2x the size of RAM)
(* eventually another 10G for another / you can use when upgrading)
* rest for /home

If you have two / partitions (obviously, only one of them mounted at time), you can easily install two distros, use them both while sharing $HOME, and at a later point of time decide which one to keep. (Sharing $HOME may create issues though). If you feel reasonably certain not to need space for this kind of experiments, just do one / partition. You can do a lot of testing in virtual machine anyway, or you take some risk and just install the new version. If you want to learn, quite another level of solution is LVM.
 
Old 01-11-2013, 11:58 PM   #8
Novatian
Senior Member
 
Registered: Feb 2008
Location: Australia
Distribution: Mint 20.3 MATE, Android, Windows 10, MX Linux and Mint 21.1 MATE
Posts: 1,052

Rep: Reputation: 38
Try bleachbit?
 
Old 01-12-2013, 03:27 AM   #9
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
Quote:
Originally Posted by SuSE_Lamer View Post
Genral question of partition size: my hard drive is 80 GB, so I tried to partition it more or less fair, so that I could run both OSs (+ some shared drive) without any issues. And the value of 8 GB is based on my previous experience with Debian (which I had before).
What other OS are you running along with Ubuntu?
Do you have a lot of games installed? Many games can be quite large these days?
Do you have more than one desktop environment installed? For example, do you have both Unity and KDE? Adding the Kubuntu Desktop to Unity on Ubuntu would add a lot of bloat.

As snowpine mentioned, be sure to check how much space the log files in /var/log/ are taking up. For some reason Ubuntu seems to accumulate log files much faster than Slackware in my experience. It is safe to remove all the log files from /var/log; but leave the directories in /var/log alone because you need them.

With an 80GB hard drive, I would go with 10GB for the root partition. My Lubuntu 12.10 root partition is 20GB in size and it only has about 4GB full. I don't have a whole lot of extra software beyond what is standard on Lubuntu though.

Last edited by tommcd; 01-12-2013 at 03:28 AM.
 
Old 01-14-2013, 03:12 PM   #10
SuSE_Lamer
Member
 
Registered: Nov 2004
Location: Hamburg/Germany
Distribution: Debian 10
Posts: 169

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by tommcd View Post
What other OS are you running along with Ubuntu?
Do you have a lot of games installed? Many games can be quite large these days?
Do you have more than one desktop environment installed? For example, do you have both Unity and KDE? Adding the Kubuntu Desktop to Unity on Ubuntu would add a lot of bloat.

As snowpine mentioned, be sure to check how much space the log files in /var/log/ are taking up. For some reason Ubuntu seems to accumulate log files much faster than Slackware in my experience. It is safe to remove all the log files from /var/log; but leave the directories in /var/log alone because you need them.

With an 80GB hard drive, I would go with 10GB for the root partition. My Lubuntu 12.10 root partition is 20GB in size and it only has about 4GB full. I don't have a whole lot of extra software beyond what is standard on Lubuntu though.
Hello @all,,
I have also WinXP Pro installed. Why?

No games.

Under Linux I have Unity and GNOME as desktop environments. As fasr as I understand, I cannot remove Unity in Ubuntu.

Actually, I could rescue some MBs by deleting apt cache. I also noticed, that I have several kernels installed. Here I have a question: how should I remove kernels properly? What is a right sequence? Is it possible to delete them using "Ubuntu Software Center"?

Regards,
Andrey
 
Old 01-14-2013, 11:09 PM   #11
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
Quote:
Originally Posted by SuSE_Lamer View Post
I have also WinXP Pro installed. Why?
I was wondering if you had any other Linux distros installed that were sharing space (such as a common home directory) with Ubuntu.
Quote:
Originally Posted by SuSE_Lamer View Post
Actually, I could rescue some MBs by deleting apt cache. I also noticed, that I have several kernels installed. Here I have a question: how should I remove kernels properly? What is a right sequence? Is it possible to delete them using "Ubuntu Software Center"?
Run the dpkg commands that otoomet discussed in post #4 in this thread. The you can remove them either from Synaptic Package Manager, or the Software Center if you prefer that, or from the terminal using apt-get like this:
Code:
sudo apt-get remove linux-image-XXX linux-headers-XXX
where XXX is the name of the kernel and headers packages. Obviously, the newest kernel needs to be left in place. It would also be a good idea to leave the most recent kernel prior to the current one installed as a back up in case you could not boot the current kernel for some reason.
 
Old 01-15-2013, 12:30 AM   #12
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Århus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 619

Rep: Reputation: 45
... I would use "purge" instead of "remove". This also removes the configuration files (you do not need to keep the configuration information of deleted kernels anyway...).

I have never succeeded in removing just linux-headers-XXX. I always have to remove separately linux-headers-XXX-generic and thereafter linux-headers-XXX. You can probably put them on the same command line, something like

Code:
sudo aptitude purge linux-image-XXX linux-headers-XXX-generic linux-headers-XXX
(you may replace aptitude with apt-get if you prefer). I also find it easier to delete the packages one-by-one, pressing arrow-up on keyboard and changing the command just little bit when doing that.

I will try to use sofware center next time, so I can tell you how to do that as well ;-)

I think this is something we should make automatic. Something like a button "clean old kernels" in software center, or like that.
 
Old 01-21-2013, 02:20 PM   #13
SuSE_Lamer
Member
 
Registered: Nov 2004
Location: Hamburg/Germany
Distribution: Debian 10
Posts: 169

Original Poster
Rep: Reputation: 16
Hello @all,

thanks for all hints. I purged old kernels, cleaned APT cache. Now I can work further...

Short question about "bleachbit". I started it, but I was a bit scared by the amount of options... Should I be carefull there?

Greetings,
Andrey
 
Old 01-21-2013, 10:40 PM   #14
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
Quote:
Originally Posted by SuSE_Lamer View Post
Hello @all,

thanks for all hints. I purged old kernels, cleaned APT cache. Now I can work further...

Short question about "bleachbit". I started it, but I was a bit scared by the amount of options... Should I be carefull there?

Greetings,
Andrey
Yes you should.

Third party apps to do a job you could do is a habit encouraged by MS usage. There are many tools for individual jobs available in Linux.

Having a automated program make choices as to what you need on your install and don't need is simply lazy foolishness.

If you are using a stable version aptitude, apt-get and synaptic will all let you know if there are some packages that are no longer needed when you do most operations in them.

Ubuntu also puts all of your backgrounds in /usr/share/backgrounds. If you have trashed any of them or anything else in the system files this is still in there in /root/.local/trash or perhaps just /root/.trash. If so you may want to empty that, it is not part of the trash you use in user land.
 
Old 01-22-2013, 02:20 AM   #15
Novatian
Senior Member
 
Registered: Feb 2008
Location: Australia
Distribution: Mint 20.3 MATE, Android, Windows 10, MX Linux and Mint 21.1 MATE
Posts: 1,052

Rep: Reputation: 38
Crossing over from windows and eraser, I would say you need make back up just in case you need reconfigure. I found eraser would overwrite old internet history with zeros and clear space for re-use, only once in Vista, things were slightly damaged.

I would overwrite all free, deleted space on drive c with zeros, and it would get rid of spyware and viruses and cookies.

Last edited by Novatian; 01-22-2013 at 03:26 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
clean up free some disk space fachhoch@gmail.com Linux - Newbie 5 02-13-2012 08:09 PM
[SOLVED] How to clean up disk space on /var partition RedHat5 LRL8793rh5 Linux - Newbie 4 05-13-2011 02:07 PM
How to clean up disk space on /var partition RED HAT jmmo1981 Red Hat 11 02-24-2009 09:38 AM
clean up disk space in SuSE linux nanda22 Linux - Newbie 5 08-01-2008 05:37 AM
Running out of disk space... clean up possible? donv2 Linux - Newbie 3 04-19-2005 02:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration