Time to Repartition the Hard Drive? (Maybe not…)

DrakX Partitioning

Figure 1: Attribution: Mageia 5 Installer Documentation – Partitioning with DrakX (http://doc.mageia.org/installer/5/en/content/doPartitionDisks.html)

It’s been a hairy few weeks. Looking at my WordPress folder on my laptop I see my last post was back in the middle of March! I could enumerate a nice long list for you of why I’ve been away but I’m sure you don’t care. Suffice it to say, I’ve busy at work and sick. However, I’m glad I’m back to documenting my geeky adventures. 🙂

Sometimes you choose to take on a project in Linux. Sometimes a project is thrust upon you. This happened to me recently and led me down a winding garden path into the very innards of my Linux installation.

The Problem Appears

I was busy researching topics to blog about (really!) when my Mageia 5 system asked me to install some updates. The majority of these are security patches and the like so I don’t usually think much about doing the updates and just set them up to run in the background. This time, however, I ran into an error!

Transaction Check Error:
  installing package XXXX needs 15MB on the / filesystem
Error Summary
Disk Requirements:
  At least 15MB more space needed on the / filesystem.

This was perplexing and I had never run into something like this before. I decided to see how much space I had in the ‘/’ (root) partition, since that is where my applications reside. I brought up the command line and this was the result:

[bradfonseca@localhost ~]$ df -H /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       13G   12G  0.13G 99% /

Make More Space

How could my root partition be so full? I hunted around on the Internet and found an article recommending clearing out old kernel RPMs which helped a little and got my root partition down to 90% which allowed my updates to proceed without error. I was now wondering why I allowed my root partition to be so small when I have 1 TB hard drive on this machine. A bit more searching uncovered that “Mageia 4 and earlier used to assign up to 12 GB to the root partition, which could be confusing for some end users (as 12 GB can be quickly filled after you’ve installed some games or several desktop environments).” I originally installed Mageia 4 on this laptop and then upgraded to Mageia 5 when it became available. Thus, I was saddled with the size I have allocated for my root partition by the automatic behaviour of Mageia 4.

The Mageia Community Weighs In

At this point, I started researching repartitioning my hard drive to give my root partition more space. This is when I felt it might be time to consult with the broader Mageia community and find out what would make the most sense. I made a post on the “Basic Support” section of the Mageia forum. The Mageia Linux community, like the Open source software community in general, are a helpful lot and are always willing to answer questions. I got a lot of helpful advice out of that one post. First, one of the users (doktor5000) asked me to run a series of commands and post the output:

[root@localhost bradfonseca]# du -mx / | sort -rn | head -25
10116   /
7894    /usr
3941    /usr/share
2501    /usr/lib64
1748    /var
1488    /usr/share/texmf-dist
1200    /usr/share/texmf-dist/fonts
880     /usr/lib
809     /var/log
801     /var/log/journal/61016a35edb84a18a686214f2132bb59
801     /var/log/journal
503     /var/cache
472     /var/cache/urpmi
472     /usr/bin
433     /var/cache/urpmi/rpms
409     /usr/lib64/libreoffice
403     /usr/share/texmf-dist/fonts/type1
374     /usr/share/doc
359     /opt
316     /usr/share/texmf-dist/fonts/type1/public
264     /usr/share/games
239     /var/lib
228     /usr/share/texmf-dist/fonts/vf
220     /usr/lib64/libreoffice/program
218     /usr/share/texmf-dist/tex
[root@localhost bradfonseca]#

Consulting the man pages I was able to glean that the series of piped commands suggested by the poster did the following:

  • check my disk usage associated with my Mageia 5 filesystem and display the file sizes in MB blocks. (du -mx)
  • Take this output and sort it so the largest files show up first. (sort -rn)
  • Then display the first 25 lines of this output. (head -25)

Okay, I’ve learned something already!

A second poster (jiml8) reassured me that I had plenty of space in my root partition but that I had a number of folders that were far too big:

Just FWIW, I run a very large Linux workstation, and I have 28G devoted to /, and it is 66% full at the present time.

From the output you provided, your journal is out of control. It is occupying way too much space. Take a look in /var/log/journal and follow into the subdirectory(s) you find there looking for .journal files. You will probably find many old and large files that do you no good. Delete them.

You might want to go into /etc/systemd and edit journald.conf to limit the amount of space the journal is allowed to use on your system. On mine, SystemMaxUse is uncommented and set to 100M, while SystemMaxFileSize=10M and MaxFileSec=1month.

To uncomment them, remove the # symbol that is in front of the line.

He also noticed other problem areas:

OP {Original Poster} also has a huge /var/cache/ It needs to be cleaned out. Looks like an update started, then failed, with lots of RPMs cached and not installed. OP might just want to go ahead and manually install those using urpmi.


It then became a simple exercise of following the directions given to me and clearing out the various problem folders. The results were quite satisfying:

[root@localhost ~]# df -H 
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.2G     0  4.2G   0% /dev
tmpfs           4.2G   56M  4.1G   2% /dev/shm
tmpfs           4.2G  869k  4.2G   1% /run
/dev/sda1        13G  9.4G  2.6G  79% /
tmpfs           4.2G     0  4.2G   0% /sys/fs/cgroup
tmpfs           4.2G  107k  4.2G   1% /tmp
/dev/sda6       968G  107G  862G  11% /home
tmpfs           828M   13k  828M   1% /run/user/500

and the list of my largest folders in my root partition looked a lot better:

[root@localhost ~]# du -mx / | sort -rn | head -25
8847    /
7894    /usr
3941    /usr/share
2501    /usr/lib64
1488    /usr/share/texmf-dist
1200    /usr/share/texmf-dist/fonts
880     /usr/lib
479     /var
472     /usr/bin
409     /usr/lib64/libreoffice
403     /usr/share/texmf-dist/fonts/type1
374     /usr/share/doc
359     /opt
316     /usr/share/texmf-dist/fonts/type1/public
264     /usr/share/games
239     /var/lib
228     /usr/share/texmf-dist/fonts/vf
220     /usr/lib64/libreoffice/program
218     /usr/share/texmf-dist/tex
212     /usr/share/atom
209     /usr/share/foomatic/db/source
209     /usr/share/foomatic/db
209     /usr/share/foomatic
191     /usr/share/apps
190     /var/tmp

I’ve got my root partition down to 79% capacity which I hope will be good enough until I decide to do a complete re-install in the future. I’ve set some key values in /etc/systemd to limit the size my journal folder can be and how big each journal files is allowed to grow to. This should prevent the problem from occurring again.

The Extra Benefit

This little learning experience came out of needing to solve a problem as opposed to wanting to solve a problem. I was running out disk space and couldn’t update my system. In spite of the necessity, this was still an enjoyable experience. Excellent online resources for Linux and for specific Linux distributions make it much easier to find potential solutions to any problem you might run into. I learned a lot in the past couple weeks and I look forward to my next learning opportunity.

Useful Links

  • Download Mageia 5 (Link)
  • About Mageia 5 (Link)
  • Mageia 5 Software Packages Update (Link)
  • An article describing how to help clear space in the root partition: (“Linux /boot: Out of Disk Space While Installing Package kernel-2.6.32-131.2.1.el6.x86_64” – Link)
  • Mageia 5 Release Notes – Automatic Partitioning (Link)
  • Creating a new Mageia 5 install USB (Link)
  • The Mageia Forums (Link)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: