[vox-tech] I'm out of space on /

Rick Moen rick at linuxmafia.com
Mon Jun 27 06:07:30 PDT 2005


Quoting Jay Strauss (me at heyjay.com):

> I'm out of space on /.  and the install is trying to write to /lib

[...]
> Will moving the contents of lib somewhere else, like /usr/mylib and soft 
> linking /lib->/usr/mylib work as a workaround?  Will my machine be able 
> to boot correctly?

I see no reason why not -- but personally I'd find some other
(long-term) solution.

Certain trees are part of the root filesystem for a very good reason,
and /lib is one of them.  The contents are libraries too critical to
system booting, maintenance, and recovery to be included in /usr/lib:
They're the ones you need available even if /usr cannot be mounted at
all.

Things that might more reasonably be moved off the root filesystem
include /boot, /home, /opt, /usr, and /var.

In your shoes I might move /lib off the root filesystem _briefly_ --
just long enough to give me enough free space on the root filesystem to
craft a better long-term solution.  (By preference, I would do that from
a bootable maintenance disk such as an LNX-BBC, Tom's Root-Boot, or
Knoppix disk.)  

You may also find the following Perl script ("largest20") useful, in
getting you some breathing room:  It finds and lists the biggest 20
files in the current directory or any subdirectory -- and can be
re-found as http://linuxmafia.com/pub/linux/utilities-general/largest20:


#!/usr/bin/perl -w
# You can alternatively just do:  
# find . -xdev -type f -print0 | xargs -r0 ls -l | sort -rn +4 | head -20
use File::Find;
@ARGV = $ENV{ PWD } unless @ARGV;
find ( sub { $size{ $File::Find::name } = -s if -f; }, @ARGV );
@sorted = sort { $size{ $b } <=> $size{ $a } } keys %size;
splice @sorted, 20 if @sorted > 20;
printf "%10d %s\n", $size{$_}, $_ for @sorted


If you can't find a way to reduce the contents of / down to comfortable
levels, I would strongly urge repartitioning your system -- since
running out of space on / is a serious problem.  Use one of the
aforementioned maintenance boot disks, then use one of the methods
detailed in "Copying Directory Trees" on http://linuxmafia.com/kb/Admin
to copy the contents of each filesystem to be re-created over to a
second system on your LAN.  Then, umount, use fdisk/cfdisk, mkfs.*, and
copy the contents back.



More information about the vox-tech mailing list