Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

During a recent update I received this:

Installing: kernel-default-2.6.37.6-0.11.1 [error]
Installation of kernel-default-2.6.37.6-0.11.1 failed:
(with --nodeps --force) Error: Subprocess failed. Error: RPM failed:    installing package kernel-default-2.6.37.6-0.11.1.x86_64 needs 147MB on the / filesystem


Abort, retry, ignore? [a/r/i] (a): i
Installing: kernel-desktop-2.6.37.6-0.11.1 [error]
Installation of kernel-desktop-2.6.37.6-0.11.1 failed:
(with --nodeps --force) Error: Subprocess failed. Error: RPM failed:    installing package kernel-desktop-2.6.37.6-0.11.1.x86_64 needs 148MB on the / filesystem


Abort, retry, ignore? [a/r/i] (a): i
Installing: kernel-source-2.6.37.6-0.11.1 [error]
Installation of kernel-source-2.6.37.6-0.11.1 failed:
(with --nodeps --force) Error: Subprocess failed. Error: RPM failed:    installing package kernel-source-2.6.37.6-0.11.1.noarch needs 432MB on the / filesystem

Which I am assuming means my / partition needs some room. So I checked the size/space:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              25G   24G  208M 100% /

How did / grow to be so huge!? Is this a common occurrence and is there a quick trick to freeing up some space? I assume that there are things I'm not using in there and I've been able to update kernels easily for the past year -- so something is accumulating.

I'd rather figure out what I free up (are old kernels kept?) instead of re-partitioning my whole drive to grow /.

share|improve this question
1  
I don't know if this will help you, but with du you can find out which directories are largest. You probably want to use --max-depth=N and --human-readable (-h) –  Bernhard Jan 26 '12 at 15:15
    
@Bernhard: I don't know why I didn't think of this earlier... thanks mate. Post this as an answer and I'll accept. –  MaxMackie Jan 26 '12 at 15:18
    
I think you already got a more extensive answer –  Bernhard Jan 26 '12 at 15:40
    
Most distros don't clean up old kernels by default. It's been a while since I used an rpm distro, but I think rpm -qf /lib/modules/* might show you old kernels. –  Paul Tomblin Jan 26 '12 at 18:23
    
The version smells like linux. Here is a related question: askubuntu.com/q/52728/10068 –  user unknown Jan 26 '12 at 19:38
add comment

2 Answers

up vote 2 down vote accepted

Make a backup before making any of the following changes
Do not proceed without either a backup or the willingness to lose all data.

run

du -sh /home

to get the size used by /home directory.
If it's sufficiently large(>=4G), /home is a good candidate to have its own partition.

Boot from either a livecd or SystemRescueCd
Depending on your partition table type (GPT or MBR), use either gdisk, parted, or fdisk.

Create a new partition
Format using your preferred fstype
e.g.

mkfs.ext4 /dev/sda2
mkdir /mnt/os
mkdir /mnt/home
mount /dev/sda1 /mnt/os    # mount your OS, now all on /
mount /dev/sda2 /mnt/home  # mount newly formatted partion
cp -a /mnt/os/home/* /mnt/home/ # copy current /home data to new partition
cd /mnt/os/home                 # remove old home data, leaving mountpoint
rm -rf .

Now you need to cd to /mnt/os/etc and edit fstab and add

/dev/sda2 /home ext4 defaults 0 1

There's more than one way to do this. Depending on your experience and skill you could mount by UUID (preferred, but not necessary).

One could do the same for other filesystems, if you've installed a lot of google tools, or eclipse, they get intalled in /opt and it is also a good candidate to be in its own partition.

If you get to the point where you have many partitions, you'll want to switch to GPT partitioning and/or LVM. If so, re-ask the question

share|improve this answer
    
Thanks for the well written answer. /home is already in its own (200G) partition so that wasn't the issue. You're right though, it turned out that /opt had a fair amount of bulk. I removed some applications and freed around 10G. –  MaxMackie Jan 26 '12 at 15:42
    
you're welcome, I'm glad you solved your problem. my /usr is >6G and Arch complains with /usr on its own fs. This can be a real pain :( –  bdowning Jan 26 '12 at 16:17
add comment

Whether a 25GB system partition is huge or tiny depends on how much software you have installed (is this a single-purpose server or a shared workstation with a lot of domain-specific software?) and on how much data is lurking in /var (do you have 200 users' mail in that partition?).

Good places to look for accumulated cruft include:

  • /tmp: any old, large files in there? You may want to make /tmp a tmpfs filesystem, so that it doesn't consume disk space and starts afresh at every boot.
  • /var/tmp: any huge files in there?
  • /var/log: did a runaway service produce gigabytes of logs?
  • /var/cache: is there a large cache that isn't being purged properly? Especially check where your distribution puts downloaded packages (e.g. /var/cache/apt/archives/ on APT-based distributions).
  • Do you have any unused software installed? That's usually not much, but you may be able to find library versions that aren't used by any executable still on your system. Programs like deborphan (on Debian and derivatives) can help. Check if you're encumbered by old kernels, too.

If you can't find what to delete, you can at least see what's taking up space with du or a graphical alternative such as Baobab (a Gnome utility).

If you have space left elsewhere, you can move some large chunk of /usr or /var (or /opt or /srv if relevant) to a different partition and make a symbolic link.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.