Tech Tips with Gnull and Voyd
I knowed somebody was gonna get to this problem sooner or later. You get too many inodes on your system, and you're asking for another heap of trouble. This tells you how to find out and fix it. —Chester
One of the most common tasks of a system administrator is storage management. When you're faced with a full or almost full filesystem, it's good to have a few tools at your disposal to help figure out “where” the hog is.
Searching for space hogs is very easy. With one simple command you can total up the contents of every directory in a tree (/usr in this case) and see which are the largest:
du -k /usr/ |sort -n |tail -30 167156 /usr/include 168960 /usr/share/icons 173972 /usr/share/texmf 244332 /usr/bin 263144 /usr/lib/openoffice.org2.0 265492 /usr/share/doc 344536 /usr/share/locale 1223992 /usr/lib 1959412 /usr/share 4159996 /usr/
As you can see, /usr/share/ and /usr/lib/ are pretty big, and you can drill down further by going up the list.
A somewhat rarer situation is running out of inodes in a filesystem. In this case, you will see available space, but the system will be unable to write new files because it has run out of inodes. To find inode hogs, use this quick Perl script named inodu:
#!/usr/bin/perl -w
my $start=$ARGV[0];
foreach $object (`find '$start'`){
my @parts=split(/\//,$object);
while(pop(@parts) ){
my $object = join('/',@parts);
$object =~ s/\/+/\//g;
$object2qty{$object}++;
}
}
foreach $object (sort { $object2qty{$a} <=> $object2qty{$b} }
keys %object2qty){
print $object2qty{$object} . "\t${object}\n";
}This will total up the number of filesystem objects in each directory and supply an output much like the previous example. Use it like this:
cd /usr ./inodu . 10420 ./include 10973 ./share/texmf 12012 ./share/man 13207 ./share/doc 14953 ./share/icons 16481 ./src/kernels 17201 ./src 22982 ./lib 105527 ./share 174270 . 174271
As you can see, again share and lib are the inode hogs using more than 100,000 inodes!
If you find yourself in any of these situations, there are a number of ways to create more free space or inodes. First, look for log files that can be purged, moved or compressed. Ask users to clean up their home directories. Remove any unnecessary software. If you are using Linux LVM and ext3fs, you can expand the filesystem using lvresize and resize2fs to grow a filesystem. This creates more free space and inodes, but only if you have free space in your volume group. If you have free disk space, you can create a new partition (for, say, your /var tree), move the files to that partition and mount it as /var. As a last resort, you can move files and directories and use symlinks so the old path still works. I say “last resort” because this method can get out of hand very quickly and can make things very confusing.
Nicholas Petreley is Editor in Chief of Linux Journal.
Brad Hall lives in Jacksonville, Florida, with his pet chickens and life-size cardboard cutout of Star Trek: DS9's Dr. Bashir.
Matthew Hoskins is Senior Information Systems Analyst at the New Jersey Institute of Technology.
Linux Journal pays $100 US for any tech tips we publish. Send your tips with your contact information to techtips@linuxjournal.com.
- « first
- ‹ previous
- 1
- 2
- 3
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Linux Systems Administrator
- New Products
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Have you tried Boxen? It's a
30 min 14 sec ago - seo services in india
5 hours 1 min ago - For KDE install kio-mtp
5 hours 2 min ago - Evernote is much more...
7 hours 2 min ago - Reply to comment | Linux Journal
15 hours 48 min ago - Dynamic DNS
16 hours 22 min ago - Reply to comment | Linux Journal
17 hours 20 min ago - Reply to comment | Linux Journal
18 hours 10 min ago - Not free anymore
22 hours 12 min ago - Great
1 day 1 hour ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
I find the attempt at humor offensive
I will publish my opinion that this is not where I would choose to get information on anything. My first and last trip here unless I hear about some big changes.
Excuse me?
".. I don't know nothing about Linux. Chester, he's the smart one, .. "
What planet do you live on? I've been on linux for 10 years now. Not once have I had a boyfriend that could fix his own computer without coming to me.
I concur, this is a magazine I wont be buying again.
Wow
I sure wish I wasn't a girl confused by all this Linus stuff. Gosh. Computers sure are hard.
Oh, no, wait, that's right. My husband comes to me when he needs help with Linux or any open source technology.
I first saw this article in
I first saw this article in the printed version of the magazine. It directly contributed to my not renewing my subscription. LJ: stop dumbing everything down. Surely not all your readers are teenage misogynists.
Ugh. I guess you've decided
Ugh. I guess you've decided that you can do without female subscribers, eh? I know I'm not going to be renewing.