LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-01-2020, 12:28 AM   #1
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Rep: Reputation: Disabled
Problems with cifs mounted partition


I have a dns323 NAS. It has 2 partitions mounted as Volume_1 and Volume_3. They are formatted as ext2, They are also mounted on a window 10 Pro system. I decided that I wanted to create a backup of the partitions. So I mounted the two partitions cifs on my Debian Linux system.

after mounting them I created a Volume_1 and Volume_2 on my raid disk. I then did a cp -r of all of the files. I tan into some problems. Not all files seemed to copy. I also realized that I should have used cp -rp. I then created a few shell scripts to verify that the directories has the same number of files contained the same size using df -hd 1
Some directories seemed to be fine. But some other directories had problems with file names.
I used "$1" fir get around the spaces in the file names. But ran into problems with - in the file name. :: in the file name. I had a file the it lists as a directory but it is only a file. For some reason ls -R gets an error saying not a directory. When I look at the files with the :: in the name no matter how I try it will not ls -l "filename" But if I cd to the directory and ls -l it lists the files. I also noticed that if I look at the directory using windows explorer the files with the :: don't show up. But I see files with what appears to be the first letter followed by a number then some random letters. I thin this because windows does not under stand the filename.
AT first I kept thinking that the file system was NTFS because I usually access it thru windows. But finally remembered that it is a ext2 partition mounted as cifs. Now I think that the problem has to do with samba. The DNS323 has an old version of samba.
I guess my question is should I mount this partition using another method? I think DNS323 might have NFS capability. Or is there a better way to copy files from the DNS323 to the raid partition?
Thanks for any help.
 
Old 11-01-2020, 01:37 AM   #2
lvm_
Member
 
Registered: Jul 2020
Posts: 929

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Frankly speaking, not the clearest description of the problem I ever seen, but there is a known issue centred around the fact that linux and windows have different concepts of what constitutes a valid file name e.g. colon (:) is acceptable in linux but not in windows, consequently you will run into difficulties trying to access files with names containing colons via samba, samba however includes vfs_catia VFS module which can be used to substitute illegal from windows POV characters in file names. See https://www.samba.org/samba/docs/cur...s_catia.8.html
 
Old 11-01-2020, 09:30 AM   #3
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
Problems with cifs mounted partition.

I tried to mention the different problems that I had with copying files from the NAS to my Linux box. Forget windows the two filesystems are ext2 and ext4. Why is it that when I cp -rp a folder from the NAS to the Linux box running Debian Linux I have problems with with file names, both partitions are Linux partitions. What does samba do to file names when copying from one Linux system to another Linux system?
if I type on the NAS ls -l /Source/DNS323/ffp-old/share/man/man3/Pod::Simple::TextContent.3
I get a correct response. If I run the same command from the Linux PC on the mounted NAS partition I get no such file or directory. But if I cd into /Source/DNS323/ffp-old/share/man/man3 on the NAS and do a ls it lists the files. Is there a problem with samba handling the name from the PC to the NAS?
All I wanted to do was backup the files to the Linux PC. But when I try to run a script to check that the files were copied correctly. The script gets multiple errors. The errors seem to only occur with files that have special characters.
 
Old 11-01-2020, 10:00 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
Samba is basically a windows networking protocol and the filesystem on the server really has no bearing. As posted there are characters not allowed in windows filenames and samba will mangle filenames that contain illegal characters.

You can try adding the directive in the smb.conf global section assuming you can edit anything on the nas.
mangle names = no

Otherwise, using nfs would not use mangling but has its own configuration setup.

Last edited by michaelk; 11-01-2020 at 10:09 AM.
 
Old 11-01-2020, 10:13 AM   #5
lvm_
Member
 
Registered: Jul 2020
Posts: 929

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Samba won't let you forget windows, it implements SMB protocol which comes from DOS/windows world and mangles names which are not acceptable there.
 
Old 11-01-2020, 11:02 AM   #6
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
Problems with cifs mounted partitions

In other words if I had a Linux PC and a NAS and no windows systems. I'm still bound by windows naming conventions.
If I understand this correctly. I can't do a stat of a file on the NAS from the Linux PC if the filename has a : in the name?
Since the files get copied from the NAS to the Linux PC. How does one programmatically verify that all of the files copied
correctly? Since I can't get information about each file.
 
Old 11-01-2020, 11:13 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
I am curious as to how the file was copied to the server if all you are using is cifs/samba.

How many files have bad names?
 
Old 11-01-2020, 03:30 PM   #8
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
Problems with cifs mounted partitions

I did a cp -rp /Volume_1/Source /raid1/Volume_1 This copied most of the files. There are several hundred files with :: in the name. There has to be a way to do the copy. I tried to run FreeFileSync on /Volume_1/Source/DNS323/ffp-old/share/man/man3 and /raid2/Volume_1/Source/DNS323/ffp-old/share/man/man3 It displayed all of the correct filenames. It indicated that the dates were different. But it showed 0 for the files sizes of all files on the Linux PC.
In other words if I had a Linux PC and a NAS and no windows systems. I'm still bound by windows naming conventions.
If I understand this correctly. I can't do a stat of a file on the NAS from the Linux PC if the filename has a : in the name?
Since the files get copied from the NAS to the Linux PC. How does one programmatically verify that all of the files copied
correctly? Since I can't get information about each file.
 
Old 11-01-2020, 07:46 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
My question as worded might be confusing. The actual question was how did the files/filename with a : get copied to the NAS originally not how are you trying to copy from the NAS.

Using nfs would prevent name mangling or even ftp. while I don't suggest using ftp normally due to security reasons, on your local private LAN for this purpose I think it is acceptable.

If the NAS has a sftp client you could copy the files from the NAS to debian system.
 
Old 11-01-2020, 11:19 PM   #10
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
prolem with cifs mounted partition.

The files are part of the source code for the DNS323 NAS. It has been years since I installed the files. But I think it was thru a .gz or tar file. The DNS323 is a busybox system not a full Linux. So it does not have a full set of programs. I don't think there is a problem getting the files copied over to the Linux PC. Because as best as I can tell all of the special files copied. The problem is that I can't seem to run a script to verify that they did copy. cp -rp copies the file over. But you can't do a stat of the files on the NAS. You can't run any program passing a single filename with :: in the name. I you do an ls * it will return all of the files with the :: in the name. You just can't do an ls "POD::test.3" it returns no such file.
 
Old 11-02-2020, 02:52 AM   #11
lvm_
Member
 
Registered: Jul 2020
Posts: 929

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Quote:
Originally Posted by rac8006 View Post
I can't do a stat of a file on the NAS from the Linux PC if the filename has a : in the name?
Not quite, by default samba generates DOS-compliant names for these files which look somewhat like 8.3 short-naming in windows, if you look carefully you'll probably see them. Or you can disable name-mangling using share-specific 'mangled names' directive, but this may create issues as even some non-windows software won't handle it properly. Better use scp/sftp or create an archive straight on the host.
 
Old 11-02-2020, 09:30 AM   #12
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
Problems with cifs mounted partitions

Thanks for the help. I think I said that I can copy the files to the PC. The problem is trying to verify the copy. I guess to solve
part of the problem I will only sync a few of the of the folders. I don't need to keep most folders up todate. Because they don't change.
So again thanks for the help.
 
Old 11-04-2020, 11:45 AM   #13
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
Problems with cifs mounted partitions

Found a new problem. I cp -rp a directory from the DNS323 ext2 partition to the Linux PC. After the copy I ended up with more files on the Linux PC that were on the DNS323. It turn out that when copying from the DNS323 using samba the case of the folder name is ignored. I ended up with the same files in Pod and pod folders.
Not sure how to handle this. I tried to use tar the files and then move the tar file to the Linux PC and it worked correctly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cifs "mount error 13 = Permission denied" CIFS SUCKS humbletech99 Linux - Networking 45 04-06-2020 05:31 AM
manual mount cifs works but srcipt mount cifs has mount error (13): Permission denied CADIT Linux - Newbie 6 11-20-2009 02:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration