October 23, 2005 Archives

23 October 2005

Just for fun

Well for various reasons, penrah has had a 3Gb /var which was followed (on disc) by an empty 10Gb partition that used to be /home (home got moved some time ago to a 30Gb partition that used to be that other operating system)

As /var would occasionally fill up (especially during large apt-get dist-upgrades) it seemed logical to extend /var to cover all that free space. However, I didn't want to disrupt my 202 day uptime record in the process did I?

Also just to add a bit of spice to it, I decide to perform this "slight tweak" from home over ssh (and a wireless link for that matter -- what was I thinking!!)

Amazingly it turned out to be surprisingly easy:

  1. Close down programs using /var: This was virtually every service on the box, samba, cron, inetd, apache, ntp, and so on. Did require a bit of lsof | grep /var combined with some head scratching.
  2. umount /var and /usr/local (which was the only partition after /var and the defunct /home and would get a new number once the change was complete) and /usr/local/share/music (for obvious reasons)
  3. Use parted to resize the partition. Unfortunately parted thinks my /var partition has an unusual layout and refused to resize it. I therefore took careful note of the start and end sectors and deleted it and the old /home and created a new partition that started at the same place. The kernel even reread the partition table (bear in mind /, /usr and /home are all earlier on the same disk)
  4. edited /etc/fstab to reflect the new partition numbers. I suspect disk labels or such like would make this easier, but this box was installed four years ago now, and I don't think that was how things worked in those days.
  5. used ext2resize to grow /var to fill the new partition.
  6. fsck /var just to be sure. Actually the most time consuming part of the process.
  7. remount and restart everything I'd stopped. (except for all those things I didn't really need)
In total syslogd was down for 30 minutes, and it probably took longer to write this blog entry than do the resize. I now have (reordered for clarity):
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdb5             958M  364M  546M  40% /
/dev/hdb7             7.6G  5.7G  1.6G  79% /usr
/dev/hdb1              28G   13G   14G  48% /home
/dev/hdb9              13G  2.4G  9.2G  21% /var
/dev/hdb8              63G   57G  2.8G  96% /usr/local
/dev/hda5              29G   26G  1.2G  96% /usr/local/share/music
/dev/hda1             9.8G  6.5G  3.4G  67% /mnt/windows
tmpfs                 633M  4.0K  633M   1% /dev/shm
none                   10M  2.6M  7.5M  26% /dev
//wenacl1/enxrah       95G   93G  1.8G  99% /mnt/wenacl1
//wenacl2/enxrah       95G   90G  4.6G  96% /mnt/wenacl2
Most of /usr/local is symlinked into /home/enxrah so I guess the situation still isn't perfect, but it'll do.

Posted by Robert Hart | Permanent Link | Categories: Computers