Is it possible to create a NFS Share from a CIFS mounted directory

cifsmountnfs

The problem is that I have a directory which is mounted over CIFS. For this directory I want to create a NFS Share. I need this to create backups on a backup system which is only mountable over CIFS, from our ESX (But the ESX can only create backups on NFS Shared directorys with "ghettoVCB").

To solve this issue my first attempt was create a third Linux Machine with Debian.

test arrangement:

Backup Storage -> Debian machine (mounting CIFS directory and creating NFS Share) -> ESX (where we create the Backups)

Procedure:

Mount directory over CIFS.
Then create an entry in /etc/exports for this mounted directory.
After creating the export I get this Error:
exportfs: /mnt/backup does not support NFS export

I hope you get what I wanted to say. If you need more information let me know.

Well someone said to me that it is not possible. Perhaps anybody of you can help me with this issue or can give me an alternative solution.

Best Answer

You can pass from cifs mount to nfs export via a fuse filesystem, though I don't think I would recommend it for something as essential as backup.

When I tried this once I looked for a fuse filesystem that would be as transparent as possible, and ending up with fuse-convmvfs. This software is intended to convert filenames from one encoding to another, but if you configure it to the same encoding at both sides, it seems to work as you need.

Quite simply, if you have your cifs mount at /mnt/samba, you can mount your fuse at /mnt/fuse and export this directory by nfs using an /etc/exports entry like

/mnt/fuse backupmachine(ro,fsid=55)

and the commands

$ sudo sh -c 'echo user_allow_other >>/etc/fuse.conf'
$ sudo convmvfs /mnt/fuse -o srcdir=/mnt/samba,icharset=iso-8859-1,ocharset=iso-8859-1,user_allow_other
$ sudo exportfs -a

The user_allow_other part is probably not needed for nfs export. While this is ok as an experiment, note that nfs is dangerous with filesystems that do not use the same inode in a repeatable way, and that is probably why nfs on top of cifs is not implemented. Adding the fuse layer is not necessarily going to fix this. Perhaps if you can independently produce a list of md5 sums of each file locally on the cifs server, and locally on the backup machine, and compare the two, you might have some confidence in a backup.

Related Question