Comparing file sizes between Linux, Windows, and Samba
On Centos 6, I used Samba to map /var/www over to Windows.
Code:
[root@devserver www]# testparm /etc/samba/smb.conf Code:
[root@devserver www]# du -sh /var/www Code:
[Michael@devserver www]$ du -sh ./test Code:
[Michael@devserver www]$ df -T ./test |
Actually, Windows is using CIFS to access the file, not NTFS.
I would guess that there is some units conversion that doesn't match. It is possible Windows is computing sizes based on what it has/would use for metadata blocks... but that requires Windows to assume the server is using NTFS (only sorta reasonable). Exporting /var/www to windows is not a good idea. You can introduce security issues (everything in Windows is executable), as well as pass invalid data (both ways) due to file formats being different. An HTML file on Linux uses line terminators of just a newline, and the file terminates after the number of used bytes. Windows uses CRLF line terminators, and a control-Z file terminator. Other things can also happen (invalid characters) since Windows doesn't really use UTF-8... I've had apostrophes get some really oddball character values which can make some things invalid, and there are other characters that are different too. What is usually done is to export a middle area. Then files from that middle area are converted to Linux form and then stored in the web directories with the correct access/owner/security label (depending on what your distribution is). This also protects Windows from data going the other way and causing problems for it (such as a hack to the web server permitting a virus or other malware being installed and accessed from Windows). Oh, and the middle area only includes files from /var/www/html, not anything else. CGI programs from Windows will not work on Linux (though some perl/python could), it is not recommended to make such assumptions. |
Thanks jpollard,
I don't know whether it is CIFS or NTFS, but left/right/bla clicking it said NTFS. Good point about the security issues. Most (and hopefully all) are not public facing, and the only reason I implemented is to allow a windows IDE to inspect the code. |
Quote:
A minor point but cifs is a networking protocol so in reality linux is accessing the filesystem not windows. |
The question started by saying it was using Samba... and that mandates that the protocol used be CIFS, but to meet the protocol requirements, I think Samba has to report it as being NTFS, even though the underlying filesystem may be EXTx, XFS, Btrfs,...
|
Thank you jpollard and michaelk,
Is the behavior I am witnessing to be expected? |
As far as I know yes.
|
All times are GMT -5. The time now is 01:09 PM. |