CIFS on linux ?


 
Thread Tools Search this Thread
Operating Systems Linux CIFS on linux ?
# 1  
Old 06-20-2007
CIFS on linux ?

I have a program which reads all the files in a path given as argument into a buffer (And does something with it). The program makes use of several file processing APIs such as: stat(), fopen(), read() etc..

Now, it is possible that the directory specified by the path is actually a volume which is nfs mounted from a filer. Now, as far as I can tell it does not make any difference to the program whether the path contains files that are local to the client or if it is nfs mounted from the filer.

What I want to know is whether the program will work if CIFS (or SMBFS) was used to mount the volume. (or any other protocol other than NFS)


(I thought cifs was only for windows, but turns out you can use cifs to mount a volume on a linux machine, I tried using cifs to mount the volume but my kernel does not support it.

% r mount -t cifs sys1:/vol/vol1 ~/dir1
mount: fs type cifs not supported by kernel)

)
# 2  
Old 06-20-2007
Quote:
Originally Posted by the_learner
What I want to know is whether the program will work if CIFS (or SMBFS) was used to mount the volume. (or any other protocol other than NFS)
For plain file reading that should be okay. Of course, not necessarily apply if you use chmod or other filesystem-specific features.

Try smbmount if your kernel doesn't have cifs compiled in (or in some distros without mount.cifs), or if possible just recompile the kernel with the needed option.
# 3  
Old 06-21-2007
Hey, thanks for your reply..

So, I was able to do a cifs mount ! One thing that is odd is that whenever I mount a volume using cifs.. the size of the destination directory (mount point) becomes zero

Code:
 % mkdir temp
 % ls -ld temp/
drwxr-xr-x  2 vj enr 4096 Jun 21 14:41 temp/
 % r mount -t cifs sys1:/vol1 ~/temp
 % ls -ld temp/
drwxrwxrwx  3 root root 0 Jun 21 12:14 temp/
 % cd temp/
 % ls -l
total 10264
-rwxrwSrwt  1 root root 10506529 Jun 21 12:15 file10MB*

Is this the expected behaviour ? If not, then what does it depend on ?

Thanks again !!
# 4  
Old 06-21-2007
It's not the size of the directory. It's the size of the inode entry representing that directory on the filesystem. How large that value is depends on how many "links" point to it, which is more likely dependent on the number of entries in the directory, rather than the individual file sizes. So, a directory with just a big ISO file of several Gigabytes, it is not unusual that the directory inode size is a mere under 100 bytes, while your /etc inode size may be many times larger.

To tell the size of files under a directory, use du.

As for a remotely mounted directory, I think you cannot rely on that size reported anyway. Because that is ordinarily the inode size occupied by that directory entry in the filesystem, and for a remotely mounted volume that inode size is mostly irrelevant anyway (not a local filesystem).
# 5  
Old 06-21-2007
Thanks !!

Oh I get it, its just the size of the inode entry for that directory. Even then, why is it 0 ? Is it because we just cannot say anything about the inode entry for that directory in the remote file system ?

Well, I did an nfs mount and the size of directory inode did /not/ change. ls -l still reports it as 4096.

hmmm.. is 4096 the size of inode entry of the directory on the local machine or is it the size of the inode entry of the volume on the remote filesystem.
# 6  
Old 06-21-2007
Quote:
Originally Posted by the_learner
Oh I get it, its just the size of the inode entry for that directory. Even then, why is it 0 ? Is it because we just cannot say anything about the inode entry for that directory in the remote file system ?
I will be inclined to say, for remote filesystems, that size is many times irrelevant or otherwise meaningless, and quite probably it can just be anything. That value I guess is filesystem/driver-specific. Say, SSHFS may take an entirely different approach from CIFS. As CIFS is designed for Windows-based systems, its protocol may not necessarily honour the "inode size" at all even though you may be mounting a Unix remote partition. As you can see, there are a lot of possible reasons.

If you are really so keen in knowing why that is 0 or 4096 or something else, you should look at the driver source code. It's the only way to know why it is so.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

unable to automount a cifs drive in linux

Hi I am using SUSE 11 linux I have couple of "nfs" entries in /etc/fstab which are automatically loaded after system restart. One of the entry is windows drive mounted using cifs as shown below //IP-Address/Partition /mnt/x cifs credentials=/creds/.creds,rw,uid=<name> 0 0 I want to... (1 Reply)
Discussion started by: rakeshkumar
1 Replies

2. Shell Programming and Scripting

Directory / File changes on CIFS share mounted on Red Hat Linux

I have a requirement to copy the changed file on CIFS share mounted on Red Hat Linux to a remote FTP/SFTP server. I tried inotify-tools, but this didn't track the modified files. Has anyone tried incron or any other suggestion? (1 Reply)
Discussion started by: SupeAlok
1 Replies

3. UNIX for Dummies Questions & Answers

Umount CIFS

hi guys I have to umount a CIFS from a Windows machine...but it's been imposible there is one special task /sbin/umount.cifs /mondobackup that task cannot be kill...so I cannot umount the unit any idea how to kill this and umount this CIFS share? by the way I've tried umount... (5 Replies)
Discussion started by: kopper
5 Replies

4. Windows & DOS: Issues & Discussions

Linux mount cifs with Windows ACL support

I'm in the process of migrating my windows file servers to a Ubuntu Samba server. My plan is to use cp -Rp to copy all the mounted files to the proper directory on my Ubuntu server. I can mount them just fine but if I run getfacl against a mounted directory its not showing any of my Windows... (0 Replies)
Discussion started by: binary-ninja
0 Replies

5. AIX

mounting cifs

Dear All, I mounted a windows share on AIX 5.3. with cifs. The write on it is much slower than from other windows clients. Could you help me with any tricks to speed the writing process? Thanks, Zoltán Patalenszki (0 Replies)
Discussion started by: zoltanp
0 Replies

6. AIX

cifs

Hi, I want to access windows folder from aix and viceversa. Is it possible to do that? I came to know we can do that from cifs but when tried to install cifs.base.cmd 3.2.1.0 cifs.base.lic 3.2.1.0 cifs.base.smit 3.2.1.0 cifs.basic.rte 3.2.1.0 cifs.client.rte 3.2.1.0 cifs.websm.apps 3.2.1.0... (4 Replies)
Discussion started by: vjm
4 Replies

7. OS X (Apple)

OS X - cifs - What's Up?

Can all you OS X xperts help me? OS X Leopard 10.5.6: mount -t cifs -o username=name,password=secret //server/share /mnt/dir Works from every linux box I have ever used. This does not work from the OS X terminal. Why? The gui/finder/go: cifs://server/share just works... command line... (2 Replies)
Discussion started by: cjohnsoia
2 Replies

8. HP-UX

mount with CIFS

hi everyone months ago i installed software on hp-ux box. So instead of going to the server room (which is far and cold :) ), I put the DVD in my windows xp box and mount it using CIFS, it was successful. Now I want to install another software on the same hp-ux box using the same windows... (3 Replies)
Discussion started by: neemoze
3 Replies

9. Shell Programming and Scripting

Cifs + 2 gb

Hi all, I am using script to take mysql database backup... its arrround 12 GB ...... I have used tar -a , cp -a and rsync -a to take backup on CIFS mounted drive but it fails to take backup more than 2 GB as well as not able to take backup with ownership,timestamps. Conf files... (3 Replies)
Discussion started by: jagnikam
3 Replies

10. AIX

share with cifs

Im trying to share a directory with cifs my aix box with a windows server. but when I try to mount mount -v cifs -n 172.19.90.240/suc_user/tommy /directory /directory1/directory1 I got this error There was an error connecting the share or the server. Make sure the lsdev command shows that... (1 Reply)
Discussion started by: lo-lp-kl
1 Replies
Login or Register to Ask a Question