Some experiences learning Linux server administration
Hosted by FiftyOneFifty (R.I.P.) on 2013-01-22 is flagged as Explicit and is released under a CC-BY-SA license.
Listen in ogg,
mp3 format. | Comments (0)
Synopsis of the Problem
You may have heard me mention that I purchased a used rack server a couple years ago to help teach myself Linux server administration. It's an HP DL-380 G3 with dual single core Zeons and 12Gb of RAM. It came with two 75Gb SCSI drives in RAID1, dedicated to the OS. Since the seller wanted more for additional internal SCSI drives, and those old server drives are limited to 120Gb anyway, I plugged in a PCI-X SATA adapter and connected 750Gb drive externally and mounted it as /home. I moved over the 2Gb USB drive I had on my Chumby (as opposed to transferring the files) and it shows up as /media/usb0. I installed Ubuntu server 10.04 (recently updated to 12.04) because CentOS didn't support the RAID controller out of the box and I had frustrated the lack of support for up to date packages on Debian Lenny on the desktop.
With 75Gb dedicated to the OS and application packages, you can imaging
my surprise when after a update and upgrade, I had a report that my
/boot was full. It was until I look at the output from fdisk that
I remembered the Ubuntu installer created a separate partition for
/boot. At the risk of oversimplifying the purpose of /boot, it is
where your current and past kernel files are stored. Unless the
system removes older kernels (most desktop systems seem to) the storage
required for /boot will increase with every kernel upgrade.
This is the output of df before culling the kernels
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/oriac-root 66860688 6593460 56870828 11% /
udev 6072216 4 6072212 1% /dev
tmpfs 2432376 516 2431860 1% /run
none 5120 0 5120 0% /run/lock
none 6080936 0 6080936 0% /run/shm
cgroup 6080936 0 6080936 0% /sys/fs/cgroup
/dev/cciss/c0d0p1 233191 224953 0 100% /boot
/dev/sda1 721075720 297668900 386778220 44% /home
/dev/sdb1 1921902868 429219096 1395056772 24% /media/usb0
This directory listing shows I had many old kernels in /boot
The Solution I Found
I ran across some articles that
suggested I could use 'uname -r' to identify my current running kernel
(3.2.0-31, the -32 apparently kernel ran out of space before it
completed installing) and just delete the files with other
numbers. That didn't seem prudent, and fortunately I've found
what seems to be a more elegant solution on upubuntu.com .
Verify your current running kernel
Linux will often keep older kernels so that you can boot into and older
version from Grub (at least on a desktop). Fedora has an
environment setting to tell the OS just how many old kernels you want to
maintain [installonly_limit in /etc/yum.conf]. Please leave a
comment if you know of an analog in Debian/Ubuntu.
List the kernels currently installed on you system.
dpkg --list | grep linux-image
Cull all the kernels but the current one
The next line is the key, make sure you copy and paste exactly from the
shownotes. I'm not much good with regular expressions, but I can
see it's trying to match all the packages starting with 'linux-image'
but containing a number string different from the one returned by
'uname -r', and remove those packages. Obviously, this specific
command will only work with Debian/Ubuntu systems, but you should be
able to adapt it to your distro. The '-P' is my contribution, so
you can see what packages you are eliminating before the change becomes
sudo aptitude -P purge ~ilinux-image-\[0-9\]\(\!`uname -r`\)
Make sure Grub reflects your changes
Finally, the author recomends running 'sudo update-grub2' to make
sure Grub reflects your current kernel status (the above command sees
to do this after every operation anyway, but better safe than sorry.
It's worth noting I still don't have my -32 kernel update, so I'll let
you know if the is anything required to get kernel updates get started
My df now shows 14% usage in /boot and a directory listing on /boot only shows the current kernel files.
1K-blocks Used Available Use%
/dev/mapper/oriac-root 66860688 5405996 58058292 9% /
6072204 1% /dev
2431860 1% /run
0 5120 0% /run/lock
0 6080936 0% /run/shm
0 6080936 0% /sys/fs/cgroup
191429 14% /boot
721075720 297668908 386778212 44% /home
1921902868 429219096 1395056772 24% /media/usb0
<< First, < Previous, Next >, Latest >>
Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.
Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).