Network and Storage Protocols

Sharing a CIFS or NFS LUN

ASHISH_VERMA
22,608 Views

Hello guys,

I am new to NAS environment ( NETAPP).

I want to know the procedure of how a LUN can be shared between 2 or more servers through NFS & CIFS. Also, is it possible to specify the server IPs and the users on those IPs who can access that particular shared LUN and if YES then what would be the procedure to do it .

13 REPLIES 13

ken_foster
22,560 Views

you don't share a LUN with cifs or nfs.  LUN is SAN, CIFS/NFS are NAS.  Two completely different things.

LUNs are typically mounted to one server and have the characteristics of an internal hard drive.  so you could mount a LUN to a unix box and then share it out with SaMBa.

or

i think you really want to do is create a volume, and share it out with both NFS and CIFS.  that you can do.  so just add the volume to your /etc/exports, and then use the cifs shares command and share it out with CIFs.    or use system manager and do it all in the gui.

SUDHEER_H21
22,560 Views

If you want to write to a LUN using a NAS protocol, you must take the LUN offline or unmap it to prevent an iSCSI or FCP host from overwriting data in the LUN. Remember, a LUN cannot be extended or truncated using NFS or CIFS protocols. If you want read access, the LUN can remain online. If you want write access, ensure that the LUN is offline or unmapped. Hit command: " lun share lun_path {none|read|write|all} "

Example

lun share /vol/vol1/qtree1/lun2 read

(The LUN is now readable over NAS).

ken_foster
22,560 Views

i think you misunderstood that command.  you can NOT access the contents of a LUN via NAS protocols that way.  the LUN share command gives you access to the file that makes up the LUN, not the contents of the LUN.

a LUN must be mounted via a SAN protocol to accessible.

this information is continued here.

https://communities.netapp.com/thread/3779

a quick search in the docs, or in the community, on the lun share command will help you understand it.

scottgelb
22,560 Views

I have seen an nfs mount of a volume with a Lun shared. Then a loop back mount to the Lun after the nfs mount. All over nfs. But not sure the point of doing that unless there is no iscsi license.

ken_foster
22,560 Views

what you are describing is impossible.  you can not mount a LUN with a NAS protocol.

maybe you thought you saw something like that, but you didn't really see it. 

but, if you want to think you saw it.  thats cool.

scottgelb
22,560 Views

Lofi. Loop back of a mount. Let me find documentation on it. Was really slow but positively remember it. Really was treated as a block device using loopback

Sent from my iPhone 4S

scottgelb
22,560 Views

Here is an example from CentOS and a 7-Mode VSIM mounting with NFS only (and a loopback to the lun object after).  It is possible, seen in the example below, and I think it is pretty cool.  NFS alone isn't handling it, but the loopback of the block device seen only over NFS without using iSCSI, FC or FCoE.  The application of this would be questionable if someone had iSCSI licensed.  I wouldn't recommend it, but some may have a use for this.  The first example is an iSCSI lun where file1.txt and file2.txt are written, then I cloned the volume to export the clone over NFS only then the loopback mount.

Create and mount a LUN iSCSI from Linux

vsim-7m-1> vol create test aggr2 10g

vsim-7m-1> iscsi start

vsim-7m-1>lun create -s 1g -t linux /vol/test/testlun.lun

[root@localhost~]# /etc/init.d/iscsid start

[root@localhost~]# iscsiadm -m discovery -t sendtargets -p 192.168.150.210

vsim-7m-1>igroup create -i -t linux linux iqn.1994-05.com.redhat:a3dd625ebee5

vsim-7m-1> lun map /vol/test/testlun.lun linux

vsim-7m-1>lun show

        /vol/test/testlun.lun          1g (1073741824)    (r/w, online, mapped)

vsim-7m-1> igroup show -v

    linux (iSCSI):

        OS Type: linux

        Member:iqn.1994-05.com.redhat:a3dd625ebee5 (logged in on: e0a)

[root@localhost~]# tail -f /var/log/messages

Jun 24
17:39:26 localhost kernel: scsi 4:0:0:0: Direct-Access     NETAPP 
LUN              810a PQ: 0 ANSI:5

Jun 24
17:39:26 localhost kernel: sd 4:0:0:0: Attached scsi generic sg2 type 0

Jun 24
17:39:26 localhost kernel: sd 4:0:0:0: [sdb]
2097152 512-byte logical blocks: (1.07 GB/1.00 GiB)

[root@localhost~]# fdisk /dev/sdb

Command (mfor help): c

DOS Compatibility flag is not set

Command (mfor help): u

Changing display/entry units to sectors

Command (mfor help): n
primary partition          p

Partitionnumber (1-4): 1

[root@localhost~]# mkdir /mnt/iscsi

[root@localhost~]# mkfs /dev/sdb ; mount /dev/sdb /mnt/iscsi

[root@localhost~]# cd /mnt/iscsi

[root@localhost iscsi]# ls -l

total 16

drwx------ 2  root root 16384 Jun 24 17:50 lost+found

[root@localhostiscsi]# > file1.txt

[root@localhostiscsi]# > file2.txt

[root@localhostiscsi]# ls -l

total 16

-rw-r--r-- 1 root root     0 Jun 24 17:51 file1.txt

-rw-r--r-- 1 root root     0 Jun 24 17:51 file2.txt

drwx------ 2 root root 16384 Jun 24 17:50 lost+found

Clone the iSCSI LUN volume and export nfs for loopback mount (no lun mapping)

vsim-7m-1> vol clone create test_clone -b test

vsim-7m-1> lun show

        /vol/test/testlun.lun          1g (1073741824)    (r/w, online, mapped)

        /vol/test_clone/testlun.lun      1g (1073741824)    (r/w, offline)

vsim-7m-1> lun online /vol/test_clone/testlun.lun

vsim-7m-1> lun show

        /vol/test/testlun.lun          1g (1073741824)    (r/w, online, mapped)

        /vol/test_clone/testlun.lun      1g (1073741824)    (r/w, online)

vsim-7m-1> lun share /vol/test_clone/testlun.lun all

vsim-7m-1> exportfs -i -o anon=0 /vol/test_clone

vsim-7m-1> exportfs

/vol/test_clone -sec=sys,rw,anon=0

[root@localhost~]# mount 192.168.150.210:/vol/test_clone /mnt/nfs

[root@localhost~]# ls -l /mnt/nfs

total 17492

-rw------- 1 root root 1073741824 Jun 24 17:55 testlun.lun

[root@localhost~]# losetup /dev/loop0  /mnt/nfs/testlun.lun

[root@localhost~]# mkdir /mnt/loopback

[root@localhost~]# mount /dev/loop0 /mnt/loopback

[root@localhost ~]# ls -l /mnt/loopback/

total 16

-rw-r--r-- 1 root root     0 Jun 24 17:51 file1.txt

-rw-r--r-- 1 root root     0 Jun 24 17:51 file2.txt

drwx------ 2 root root 16384 Jun 24 17:50  lost+found

ken_foster
22,560 Views

i will stand corrected.

though i expect whatever crack smoking guy that did that to report for medical help immediately.

that has got to be the slowest block access in the world.

good job though.

scottgelb
22,560 Views

The use case is limited but the one I remember was for backup (can't remember if mirrored or vaulted to the target controller) without SAN protocol and it gave the ability to get file level backup instead of ndmp of the lun object.  I agree that I wouldn't do it or recommend it though, and when I saw it there was a double and triple take looking at lofiadm running for the backup.

This does differentiate NetApp as a true multi-protocol controller unlike other vendors who claim they are the same, but can't do this.  With gateway devices and several operating systems, using loopback to a lun, or even ndmp of a lun isn't possible on other vendors.  There are some customers who use NDMP for very fast backups of luns with millions of files (although I don't like that either since full every backup, restore is the entire lun and all white space and deleted/nonreclamated space is backed up), but the ability to handle all simultaneously in ONTAP is flexible and unique.

I agree this is off track from the original question though... keep NAS on CIFS/NFS and SAN on FC/FCoE/iSCSI.  Exceptions and edge cases are there for some (with medical advice pending)... anyone using loopback mounts who will admit it and why?

ASHISH_VERMA
11,314 Views

HI Ken in the given link ( https://communities.netapp.com/thread/3779) provided by you.

It says "You will see the LUN via NFS, but not the data inside the LUN.  This is most useful for things like backing up a LUN via NFS."

My question is that , do we usually map the LUNs via NFS/CIFS to a host if it is a backup server, so the LUNS will get backed up to the TAPE from that host .

Please confirm if I have the correct understanding .

ogra
11,314 Views

Aashish,

I think if you spell out your requirement you are trying to meet we all can help you getting there.

There could be a lot of possibilities to do a step in technology especially more with NetApp as it's a TRUE unified storage.

If your question is : Do we usually map the LUN's via NFS/CIFS to get them backed up. Answer is NO.

Backup is not only backup only. It's also restoration which I think lot of people miss. Doing Backup via NFS/CIFS is doable but is restoration of my individual file possible ? What happens if you have a strict RTO and NFS/CIFS can't help you get there ( since it's already hosting production data or lesser bandwidth). Especially when with NFS/CIFS the backup will a LAN based and load of people don't want to go that route.  

You question of doing the Backup of LUN's is actually a architecture question. Since you can do the backup of LUN's in 3 primarily ways:

1) NDMP Based - Backup directly to Tape ( Via a Backup software )

2) Backup Server - Your Snapshot based LUNs ( LUN Clones) can be mounted on the Backup Server and they can push the data to the Tapes via Backup Software.

3) Directly using Backup Software with Agents installed on the your Production server hosting production LUN's.

Now the question is : Is this what you are looking for ? Or there is something else we can assist.

My personal choice is option 1.

As scott above said with LUN backup you need to push all the data to the Tape but that is where your incremental backup will come via Snapshots. For selective data you always have LUN clone with you absolutely FREE.

If you aren't comfortable with that you can take option 2. There are people who use option 2 and get granular level backup ( though in this backup server is a bottleneck).

Option 3 is okay if the setup is small as the licensing model for option 3 is on the No. of Agents you will have and the load is on the production server during backup. Plus it will be LAN backup.

ASHISH_VERMA
11,314 Views

Hi Bakshana , 

Thanks for mentioning about the different options, as i was not aware of it . I had initially 2 queries in my mind actually as I am new to NETAPP.

Query 1 ) In what why we can share a LUN with both windows & Unix host .

Query 2) procedure to share a volume between win & unix hosts and what are the cases in which case we use this option.

i am trying to explore the different ways and different work around which can be applied in different situation .

- Thanks in advance 🙂

ogra
11,314 Views

ASHISH_VERMA wrote:

Hi Bakshana , 

Thanks for mentioning about the different options, as i was not aware of it . I had initially 2 queries in my mind actually as I am new to NETAPP.

Query 1 ) In what why we can share a LUN with both windows & Unix host .

Well, this is only because NetApp is a true Unified Storage Architecture. It allows you to share your LUN. But the question is does it solve your problem ?

Query 2) procedure to share a volume between win & unix hosts and what are the cases in which case we use this option.

I suggest you explore the multi-protocol TR in the NetApp site. It should answer all your queries.

From architecture perspective, you will ideally share a Volume with both unix & windows hosts > Home Folders where the users use both Linux & Windows machines to log-in and access the data. ( I have done few deployments for this).


i am trying to explore the different ways and different work around which can be applied in different situation .

- Thanks in advance :-)

Public