Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.