[prev in list] [next in list] [prev in thread] [next in thread] 

List:       samba
Subject:    RE: smbmount problems when mounted share goes offline.
From:       "Green, Todd" <tgreen () appgenesys ! com>
Date:       2000-05-31 20:58:50
[Download RAW message or body]

>Date:   Wed, 31 May 2000 11:02:58 -0400
>From:   "Reid Sutherland" <reid@isys.ca>
>To:     <samba@samba.org>
>Subject: smbmount problems when mounted share goes offline.
>Message-ID: <000901bfcb11$4ee0c860$d250dfd8@isys.ca>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="iso-8859-1"
>ontent-Transfer-Encoding: 7bit
>
>using samba-2.0.7 on Debian Linux 2.2.15)
>
>Hi,
>
>  I'm wondering how do I get around the problem when you smbmount a share
on
>a win32 machine and that machine reboots, the mount becomes a blackhole. If
>you attempt an 'ls', 'df' or anything that would access that mount point
the
>program then goes into a state of void and cannot be killed, leaving the
>proc open until reboot (another way?) and the mount "busy".
>
>  Any suggestions on how to unmount the share and remount it (remount
>readonly?)? I'm not much into testing this since it requires me to use a
>production server. Also, I've since made the kernel smbfs a module. Will
>that help? Just rmmod it if it blackholes?
>
>Thanks.
>
>-reid

This is similar to my previous complaint of the NT servers 'timing out' my
smbmount connections and smbmount not auto-reconnecting.

My solution to this problem was to create a script which monitorings the
smbmount'd partitions using df.  If I get an error (I/O or Broken Pipe are
what I've seen) the script will unmount the drive and do a mount -a to
remount it.

Originally I would run this check script once every thirty minutes and I
would get notifications that it was having to remount the drives throughout
the day and night.  I then changed it to check every five minutes to see if
I could get a better idea when it's happening, but the result is a
'heartbeat' to the NT server every five minutes as I do a df on the drive.
Since I switched to 5 minute checks I hardly ever see the mount point down
and have to remount.

Now I realize this isn't exactly what your describing, but the other
advantage to this script is that if for some reason the NT server(s) get
rebooted or otherwise drop their shares my script will automatically remount
the drives for me.

I've attached the perl script and a sample data file.

Note: The script assumes that you have setup the mounts in your /etc/fstab
file so that mount -a would remount them for you.

Let me know if you have any questions.

BTW I think I spoke with you via phone a few months back on a hacker
problem.


["check_nt_mounts.dat" (application/octet-stream)]
["check_nt_mounts.pl" (application/octet-stream)]

#!/usr/bin/perl

use File::Basename;

my $data_ref;

($data_ref->{Program},
 $data_ref->{Path},
 $data_ref->{Ext}) = fileparse($0, '.pl');

$data_ref->{Config_File} = $data_ref->{Path} . '/' . $data_ref->{Program} . '.dat';

$data_ref->{Version} = '1.0.0';

my $mounts_ref = {};
if (open(MOUNTS, $data_ref->{Config_File})) {
  while(<MOUNTS>) {
    chomp;
    $mounts_ref->{$_} = $_;
  }
  
  close(MOUNTS);

  my $remount = 0;
  foreach my $mount_point (sort keys % { $mounts_ref }) {
    my $results = `df -k $mount_point 2>&1`;

    # This tells us that the drive isn't even mounted.
    my $not_mounted = !($results =~ /$mount_point/) ;

    if ($not_mounted) {
      print "'$mount_point' isn't currently mounted.\n";
    }

    # This tells us that the drive is mounted, but there's something wrong with it.
    my $mounted_with_error = ($results =~ /error|Broken pipe/i);

    if ($mounted_with_error) {
      print "There is an error with '$mount_point' it will be unmounted.\n";

      print `umount $mount_point 2>&1`;
    }

    $remount = $remount || $not_mounted || $mounted_with_error;
  }

  if ($remount) {
    print "Remounting all drives!\n";
    `mount -a 2>&1`;
  }
}
else {
  print "Unable to open '$data_ref->{Config_File}'";
}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic