SAN vs. NAS - Block I/O versus File I/O

I checked out several links regarding the difference between a SAN and a NAS and I'm not understanding HOW block I/O is different than file I/O?
I also don't understand why block I/O is better than file I/O?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
NAS do File I/O, e.g. the file is access through a remote file system, as a file reference. The file is read as a complete file. The file system will ask for the file, and a number of bytes will be read for the complete file.

SAN do Block I/O - when a request comes for a file, it's turned into a request to read several blocks which make up the file.
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
You can imagine block I/O to be like accessing a hard disk. All sectors and blocks can be addressed directly. File I/O (usually) requires to read a stream up to the position you need data from.
Block I/O enables the host to know about the virtual or physical disk layout, cache and manage content aso. Changes are made at a very low level of disk operations, allowing for all kind of optimizations.
File I/O only can tell about the file name, and even needs to ask the storage system for size info and such. All tasks like "list directory" have to be sent to the storage system, which cannot know of the specifics of the application needing the info, and so not much of optimization of consecutive requests can be made.

NAS uses a file based approach, it is just another device connected remote, without the OS having sophisticated control over it.
SAN implements a storage access protocol you can imagine as IDE / SATA / SCSI / aso. embedded in network packets. This operates on a very low level, with sophisticated control over data.
Thomas RushCommented:
It's also different in this:
In NAS, the NAS file-oriented device manages the space, creation of files, directories, etc.
In a SAN, the SAN block device presents a certain amount of space to the client, and then the client is responsible for managing the space.

The user sees some space and uses it -- doesn't usually make too much difference.

SAN-attach storage will typically be higher performance than NAS-attach storage, for what it's worth.  Historically, part of that was that NAS used an Ethernet network, and SAN used a Fibre Channel network, but with increasing speed on Ethernet, and use of iSCSI (over Ethernet) for SANs, the difference is a bit harder to categorize.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Neither is "best" in all situations.  Rather than go through all the permutations, may I suggest you provide details about YOUR intended use, and then you can get an answer that is more relevant to your needs.
SAN resources are presented as local drives on the system to which they are allocated.
NAS are remote resources.

Depending on your environment defines/limits functionality and which as Dlethe pointed is the best for your circumstances.
Some iscsi based sans provide you the option to choose the mode. Some OS/Application combination can not function with a NAS as the resource.

As others pointed out, a SAN presents you with a notebook into which you write and from which you read.  A NAS presents you with a notebook and writer/reader to whom you have to dictate what you want written, and who has to read the data back to you that you want.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aaron TomoskyDirector of Solutions ConsultingCommented:
It may help if you think of this question as Nfs vs iscsi, instead of nas/San. Personally I run FreeBSD on a box. This box has one nic on my normal LAN sharing files over samba. That makes it a "nas". I have a second nic that shares over iscsi on a vlan just for esxi, that would be a "San". I can also share on my "San" over Nfs which is a file based share like samba, but it's on a "storage area network".

My point is that San and nas shouldn't really be compared. As you can see from my example, my box is both. The experts before me have treated your question as Nfs vs iscsi basically already, I just wanted to clear that up.  Once you search for Nfs vs iscsi you will find a bunch of opinions on the subject.
Aaron makes a good point, NFS vs iSCSI is a great real world analogy because it is a block vs. file I/O comparison using two well understood implementations of block and file I/O that often use the same low-level protocols and usually the same cabling.  They can also coexist on same cabling and  server.

I use Solaris O/S and have ZFS shares on same host that use iSCSI, NFS and SMB.  The nice thing this does is that I can take  HOT LIVE SNAPSHOT BACKUPS of all of these from my solaris host no matter what the remote machines are doing, even if the O/S on the system mounting that data doesn't support such things.

So to add another twist, you should consider how these shares exist on the server that creates them, and what that server's file system can do.

Just because you can't take a hot snapshot of a NTFS share in windows w/o specialized hardware, doesn't mean it can't be done if the share is presented on a filesystem such as ZFS.

P.S. forgot, the same system emulates an Apple time capsule, so I use it as an apple time machine backup  for 2 MacBooks.  Also with ZFS I can tell it to do data compression on a share, or directly, or even keep extra copies of the data if I want.   You have flexibility on a host that has such features.
Dlethe, I'm hesitant to ..

A SAN can include a NAS, a NAS can not include a SAN.

The main issue is scale.
The difference deals with level on which the commands are.
Iscsi still sends scsi commands over IP.  I believe some iscsi SANs provide an option on whether to use block or file I/O.

A NAS is either NFS or SAMBA. For unix/Linux environments the distinction is without a difference "functionally" /mounted resource or /mounted NFS resource .....

On a windows platform however, certain application will not function when the resource is not seen as a local resource (iscsi or FC than LUN) versus a network resource (samba, NFS share from NAS)
An appliance is  an appliance.   They all have CPUs, local memory, local storage, and network interfaces.   They all run an O/S and software stacks that perform various services.  I assure you, a system can do all of the above.  

It is not a  NAS doing a  SAN or SAN doing a NAS.  You have an appliance that does both at the same time.  Yes, do not  use a windows based O/S as the appliance. That limits you.  

Read up on Solaris + ZFS, and you can do all of the above, at once.  I know an ISP that has around 500 petabytes doing this on tens of thousands of solaris-based servers.
The issue in difference deals with scope and scale.

An appliance that presents both options (NFS/samba and iscsi/FC), would you not agree, would be referred to as a SAN
While an appliance that can only do (NFS/samba) will generally be referred to as a NAS.

The OS based distinction I was making dealt with the clients that access the resources.
Not the OS that runs/makes up the appliance.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.