SAMBA dbf corruption

868 views
Skip to first unread message

Anthony Smith

unread,
Jun 10, 2013, 4:40:51 AM6/10/13
to harbou...@googlegroups.com
Server is Ubuntu 12.04 64bit

I'm running a SAMBA server and have linux 32bit clients posting to the server. DBDFCDX
I cant get the users to log in individually so they all log in as guest (samba).

When user 1 posts to the server all is fine.
As soon as another user posts to the server, it blanks out 1 or 2 of the last records of user 1 and happily posts its record.

Any ideas on how I can solve this?

Tony Quick

unread,
Jun 11, 2013, 6:30:00 PM6/11/13
to harbou...@googlegroups.com
I don't know much about Samba, but since nobody else has answered...

You didn't state whether you had disabled oplocks.  Either in the share definition or in the global section of /etc/samba/smb.conf, do you have:
        oplocks = no


Regards,
tq

Anthony Smith

unread,
Jun 12, 2013, 3:36:02 AM6/12/13
to harbou...@googlegroups.com
Yes,
I noticed im also having it on a Linux server, it just "blanks" records in the .DBF
Much to my disappointment, im going to be forced to go back to windows :(

Teo Fonrouge

unread,
Jun 12, 2013, 9:52:58 AM6/12/13
to harbou...@googlegroups.com
Hi Anthony,

You need to give more information in order to people here gets a more precise idea
on what can be the source of failure here. Otherwise one just can guess.

Is your network serving just to Linux clients ?, or you have windows machines too.
Are other apps accessing/altering your dbf´s ? Maybe a remote access is doing it (with Linux) ?

For sure, you are granted to corrupt dbf/indexes if you have a mix of concurrent access, i.e.
Linux clients and windows clients (via samba).

If you have only Linux clients accessing your dbf´s then you can drop Samba network and allow
ssh/telnet access to your server from the Linux clients.

If you have a mix of windows/linux concurrent access, then you can use harbor's 'hbnetio' to do the job.

HTH,


best regards,

Teo



--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
 
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Anthony Smith

unread,
Jun 12, 2013, 10:36:18 AM6/12/13
to harbou...@googlegroups.com
Hi Teo,

I'm using Linux and Windows, but can easily use only Linux or only Windows (preferably Linux)
I tried NFS, but could not get record locking, reading, adding files and deleting them was fine, but it hung when adding / updating a record.
I think I have to look at NLM, perhaps that will solve my problem.

hbnetio seems interesting, do you have any experience with it, perhaps a sample piece of code?

regards
Anthony

Gmail

unread,
Jun 12, 2013, 11:15:53 AM6/12/13
to harbou...@googlegroups.com
Hello,
 
    I do not use Linux but I heard from other programmers that use Linux that it works perfectly... so I came to the conclusion that:
 
        1) Your code could be some logical problem / missing locks / etc...
        2) Your Linux / Windows network configuration may be wrong
 
    I just hope it will help you.
    Regards,
 
Qatan

Teo Fonrouge

unread,
Jun 12, 2013, 11:20:13 AM6/12/13
to harbou...@googlegroups.com

Hi Anthony,

On Jun 12, 2013 9:36 AM, "Anthony Smith" <ant...@gmail.com> wrote:
>
> Hi Teo,
>
> I'm using Linux and Windows, but can easily use only Linux or only Windows (preferably Linux)
> I tried NFS, but could not get record locking, reading, adding files and deleting them was fine, but it hung when adding / updating a record.
> I think I have to look at NLM, perhaps that will solve my problem.
>

So if you can chooose, then I strongly recommend you to use Linux for simplicity and efficiency.

No need of Samba/NFS/NLM.

You only need to configure your clients to access the Linux server via ssh or telnet.

> hbnetio seems interesting, do you have any experience with it, perhaps a sample piece of code?
>

I have hbnetio running on some networks were clients can be any of Linux, Windows and MacOS. And hbnetio works very efficient and without any trouble.
You'll find a comprehensive sample of hbnetio somewhere in the harbour tree.

Best regards,

Teo

Ash

unread,
Jun 12, 2013, 12:05:37 PM6/12/13
to harbou...@googlegroups.com
Anthony,
 
Try this.
 
Regards.
Ash
 
Data area created using the following commands:
 
mkdir -p /data
chmod 755 /data
mkdir -p /data/documents
chown -R nobody.nogroup  /data
chmod -R ug+rwxs,o-w,o+rx /data
 

 

# Samba Config

# Global Settings

[global]
   workgroup = WORKGROUP

   netbios name = MYSERVER

   server string = Samba Server %v

   security = user

   dns proxy = no

 

# No password required

   map to guest = bad password

# Share Definitions
[documents]
   comment = Letters and family history
   path = /data/documents
   browsable =yes
   writable = yes
   guest ok = yes
   read only = no
 
 
 
 
 
On Monday, June 10, 2013 4:40:51 AM UTC-4, Anthony Smith wrote:

Anthony Smith

unread,
Jun 13, 2013, 1:58:28 AM6/13/13
to harbou...@googlegroups.com
Thx, ill look at this as soon as I get time

Agustianes US

unread,
Jun 16, 2013, 11:59:28 AM6/16/13
to harbou...@googlegroups.com

Hi Anthony,

I've run into similar problem before. Try to look into samba configuration documentation about file locking. You should disable samba file locking. And in your code you should lock the file or record before making any modification to dbf file.

Regards,

Anes

Francesco Perillo

unread,
Jun 16, 2013, 2:49:17 PM6/16/13
to harbou...@googlegroups.com

you got various suggestions but some are really unrelated and propose different scenarios and use cases!

Anyway, i've been using linux+samba with windows clients for over 10 years and experienced problems only twice....

elch

unread,
Jun 17, 2013, 7:30:32 AM6/17/13
to harbou...@googlegroups.com

Hi,


caching at server side is good (when it run reliable).

Read- or write- Caching at client (user) side is B_A_D in case of a SHARED DATABASE application

- typical results are missing data, destroyed index etc.


Mounting a Samba share in Linux client you can 'turn off' the cache with mount option:

cache=none

i.e.:

mount -t cifs -o cache=none,username=YourSambaUser //server/share /mnt/point


The default status of this cache behaviour seem different at different Linux distros,

newer distro seem enable cache. Fully DISabling it explicitely you are on the safe side.

There exist also the setting: cache=strict or strictcache, which plays with

"oplocks=" and "level2 oplocks=" Samba settings

- maybe an improvement option for later, but i'm unsure

-- see for doc mount.cifs and try on own risk.



---

It is often recommended to turn off opportunistic locking, which should in turn turn off

caching for Windows clients.

You can try this with already mentioned setting: oplocks = no

in your Samba (smb.conf) configuration and hope that Windows reacts correctly.


I astonished found a Harbour function: Win_OSNetRegOK( lSetIt, lAstaLaVista ;)

in the hbwin contrib, which sets some registry keys for you.


And on this site ( thanks! Klas ) you find registry files - see the good comments therein.

http://www.witzendcs.co.uk/nt_networking.html


Regards

Rolf

Anthony Smith

unread,
Jun 18, 2013, 12:43:16 AM6/18/13
to harbou...@googlegroups.com
Thx so much!

I think this will really help
And thx you other guys for the input, I think with all your help ill sort this out.

regards
Anthony

Bruno Luciani

unread,
Jun 19, 2013, 12:31:41 PM6/19/13
to harbour-users
Anthony , I use from about 15 years ago Linux Server in our Enterprise , and always works better than windows

I use Windows Clients , and linux clients using WINE as windows emulator  to run my windows app

My next step is to go to an only linux Enviroment , you could try SSH and Xforwarding to run APP locally in server
and forward Screen to linux or windows client , this is one of the propper way's to run Server/client app

The best is to use an SQL database instead a dbf ( Postgresql for example ) an a native compilation client

In your case check samba config and verify optimistic lock config

Bruno


2013/6/12 Anthony Smith <ant...@gmail.com>
Reply all
Reply to author
Forward
0 new messages