[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Running debian-edu-fsautoresize automatically on hosts selected using LDAP?

The program debian-edu-fsautoresize was written to be able to run from
cron, to automatically extend full file systems and thus leave the
sysadmins to focus on other issues.  I believe it should be easier to
do this in a Skolelinux network, and thus propose to create a new
netgroup to enable this to be controlled using LDAP.

The idea is that one should add the hostname of the host in question
(FQDN) in the fsautoresize-hosts netgroup, and this should be enough
to activate the cron job on that host.  Is this a good way to do it?

The script will syslog every time it (try to) extend a file system, so
the changes will not happen in complete silence, but we should
probably try to get a nagios warning sent as well to allow the events
to be reported to those that want to know about them.  I suspect it
will also trigger an email from cron when it happen, but want to quite
down the script to make sure that do not happen unless some unexpected
error happen.

I'm not sure how often the resizing should be done, but propose once
per hour to have reasonable response time when a disk is filling up.

The debian-edu-fsautoresize script uses the rules in
debian-edu-fsautoresizetab when deciding how to handle the different
file systems, and the current rules look like this.

  # Example configuration for fsautoresize on Debian Edu.
  # Override these values in /etc/fsautoresizetab
  # regex             minfree  max extendby
  /.*                      10% 20g 10%
  /usr                     10% 10g defaults
  /var                     10% 10g defaults
  /var/spool/squid         10% 40g defaults
  /var/opt/ltsp/swapfiles   5% 30g defaults
  /skole/tjener/home[0-9]+ 10% 30g defaults
  /skole/backup            10% 50g defaults

I am sure we could and should tune these if we enable automatic
resizing by default, but expect we will need more experience before we
know what values make most sense.

Here is a draft patch for debian-edu-config.  

Index: debian/debian-edu-config.cron.hourly
--- debian/debian-edu-config.cron.hourly        (revision 0)
+++ debian/debian-edu-config.cron.hourly        (revision 0)
@@ -0,0 +1,11 @@
+export PATH
+# Automatically extend full LVM volumes if the host is a member of the
+# appropriate netgroup.
+hostname=$(uname -n)
+if innetg -h $hostname fsautoresize-hosts ; then
+    debian-edu-fsautoresize -n
Index: ldap-bootstrap/netgroup.ldif
--- ldap-bootstrap/netgroup.ldif        (revision 42330)
+++ ldap-bootstrap/netgroup.ldif        (working copy)
@@ -28,3 +28,8 @@
 memberNisNetgroup: server-hosts
 memberNisNetgroup: workstation-hosts

+dn: cn=fsautoresize-hosts,ou=Netgroup,dc=skole,dc=skolelinux,dc=no
+objectClass: top
+objectClass: nisNetgroup
+description: Run debian-edu-fsautoresize automatically on these hosts
+cn: fsautoresize-hosts

Happy hacking,
Petter Reinholdtsen

Reply to: