Backup problem - cifs mount error every 6 or 7 days

Could you reboot only your qnap? Does it fix the I/O error? You may also find a “better” error in /var/log/messages.
The mount command above may also report a useful error.

Thx for reply.
Two of the five times that i’ve encountered this problem i’ve rebooted the qnap but didn’t fixed the problem.
Last time the proplem was solved by trying manually the mount:
From every other windows pc the shared folder was successful mounted (tried on 3 pc)

Server First try:

# mount --verbose -t cifs -o username=“user”,password=pass //192.168.1.179/Backup /mnt/test

Give me the usual error.

Second attempt:

# mount --verbose -t cifs -o username=“user”,password=pass //192.168.1.179/Backup /mnt/test -sec=ntlm --o sec=ntlm, vers=1.0

Successful mount.

Third attempt:

# mount --verbose -t cifs -o username=“user”,password=pass //192.168.1.179/Backup /mnt/test

Successful mount.

After every mount i’ve unmount the shared folder.

1 Like

I want try to modify the script that backup script use to mount cifs shared folder.

# /etc/e-smith/events/actions/mount-cifs

I want that try the mount 3 times. Manually the cifs mount at the second attempt always work.

The original piece of script:

# mounting backup directory if not already mounted
if (!$b->is_mounted("\/$smbhost(.*)\/$smbshare") && !$b->is_mounted($mntdir)) {

    # mount the backup dir
    $err = qx(/bin/mount -t cifs "//$smbhost/$smbshare" $mntdir -o credentials=$tmp,nounix 2>&1);
    if ($err) {
        $err =~s/\n/ /g;
        ldie("Error while mounting $smbhost:$smbshare : " . $err);
    }
}

The modified:

my $cifsTry = 0; # Counter of mount attempt

# mounting backup directory if not already mounted
if (!$b->is_mounted("\/$smbhost(.*)\/$smbshare") && !$b->is_mounted($mntdir)) {

    # mount the backup dir
    $err = qx(/bin/mount -t cifs "//$smbhost/$smbshare" $mntdir -o credentials=$tmp,nounix 2>&1);
	# Re try if mount falied
	while ($err != "" && $cifsTry <= 3){
		# Pause 20 second
		sleep 20;
		# mount the backup dir
		$err = qx(/bin/mount -t cifs "//$smbhost/$smbshare" $mntdir -o credentials=$tmp,nounix 2>&1);
		# Increase Counter
		$cifsTry++;
	}
	
    if ($err) {
        $err =~s/\n/ /g;
        ldie("Error while mounting $smbhost:$smbshare : " . $err);
    }
		
}

I’m not very able in Perl programming… Can it work ?
The condition while ($err != “” && $cifsTry <= 3) is correct to check that no error occur ?