5

When I first installed Ubuntu (actually ElementaryOS) I didn't think that it would take up that much space, so I made the OS partition 15GB and /home 100GB. sda5 and sda6 are my Linux partitions.

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1b518505

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      823295      410624    7  HPFS/NTFS/exFAT
/dev/sda2          823296   410943487   205060096    7  HPFS/NTFS/exFAT
/dev/sda3       410943488   738621439   163838976    7  HPFS/NTFS/exFAT
/dev/sda4       738623486   976771071   119073793    5  Extended
/dev/sda5       738623488   767918079    14647296   83  Linux
/dev/sda6       767920128   976771071   104425472   83  Linux

enter image description here

The thing is, I don't actually have anything new installed on the OS now compared to when it was fresh. Just a browser and sublime text. Over time, installing system updates, the size just keeps on going up and up.

enter image description here

/usr/src has 2.2 GB of folders named linux-headers-X.XX.X-XX

/lib/modules has 3.9 GB of X.XX.X-XX-generic folders

Advice on what to do would be appreciated.

  • If I choose to increase the size of the 15GB partition, how do I do it?
  • What are /usr/src and /lib/modules and how do I delete them safely?

1 Answers1

3

It seems like there is a connection between the various aspects to your question.

  • /usr/src is a location for source code for installed packages.
  • /lib/modules is a location for kernel modules.
  • linux-headers-X.XX.X-XX are the header files for your installed kernel(s). Header files are used when you wish to compile a kernel module for your specific kernel. Many common pieces of software compile kernel modules, like Virtualbox, lm-sensors, etc. see here for some more detailed discussion of exactly how they manifest. I always install the kernel headers and the build-essential package when setting up a new desktop, as I usually end up needing it at some point (I don't for servers though, compilers can be a security risk).

So, this all leads me to believe that you have more than one kernel installed, which is a pretty common problem. Its not a bad idea to keep one version back, especially right after an upgrade, but they are large, and can pile up.

Even if you have only one Kernel, You do not need the headers except when installing something that requires compilation against the kernel, so you can always uninstall the packages from Synaptic or software center.

if you have multiple old kernels still installed, you can usually remove them with sudo apt-get autoremove or review the options here for your system. In addition to clearing the kernels, and the header source files, this will also remove the old kernel's modules, stored in /lib/modules

15GB is usually more than sufficient for a root partition, and resizing partitions is a tricky proposition, but it is definitely possible. I strongly recommend you consult this documentation to review your situation, and plan the operation. it will involve shrinking /home, moving it to the right, and finally extending the /.

Frank Thomas
  • 37,476