Object, Block and File Storage
Compare the three main ways to store data in the cloud, how programs reach each one, and which fits databases, shares or media.
Key takeaways
- Block storage behaves like a disk attached to one machine and suits operating systems and databases.
- File storage provides folders and file locking over a network protocol, so several machines can share it.
- Object storage addresses whole objects by key through an HTTP interface and scales to enormous collections.
- The choice affects performance, sharing, editing behavior and price, so match it to how your program reads and writes.
- None of the three is a backup on its own; snapshots and separate copies still matter.
Block storage gives a computer what looks like a raw disk. File storage gives many computers a shared tree of folders and files. Object storage holds items in a flat collection, each fetched by a unique key over a web interface. They're built for different jobs, and picking the wrong one leads to slow applications, awkward workarounds or needless cost.
As a rule of thumb, put databases and operating systems on block storage, shared working folders on file storage and large collections of media, backups and logs in object storage.
Block storage
A block device presents storage as a long series of fixed-size chunks, numbered like pages. It knows nothing about files. The operating system formats it with a file system such as NTFS or ext4, and that file system decides which blocks belong to which file.
In the cloud, a block volume is usually delivered over the provider's internal network and attached to a virtual machine. You choose its size and sometimes its performance level, often described in input/output operations per second (IOPS) and throughput. Because a program can change a few blocks in the middle of a large file, it suits databases, which make many small, precise updates.
A volume is normally attached to one machine at a time and commonly lives in a single availability zone. Some platforms offer multi-attach options, but they require software designed to coordinate writes. Without it, two machines writing to the same ordinary file system will corrupt it.
Traditional data centers deliver block storage over a storage area network, using protocols such as Fibre Channel or iSCSI. Your laptop's internal drive is block storage as well.
File storage
File storage exposes directories and files over a network. The server manages the file system, and clients ask it to open, read, write, rename and lock. The two protocols you'll meet most are SMB, common with Windows and well supported elsewhere, and NFS, common with Linux and Unix.
On Linux, mounting an NFS share looks like this, using a private example address.
sudo mount -t nfs 192.168.1.10:/srv/share /mnt/share On Windows PowerShell, mapping an SMB share to a drive letter looks like this.
New-PSDrive -Name S -PSProvider FileSystem -Root \\fileserver\share -Persist File storage fits teams editing documents, applications that expect an ordinary path, and several web servers that must see the same uploads. Its limits show with huge numbers of tiny files or heavy concurrent access, where metadata operations and locking become bottlenecks. Network delay matters too, which is why file sharing protocols often feel sluggish across a long-distance link.
A home or office network-attached storage device is a small file server of exactly this kind.
Object storage
Object storage drops the hierarchy of a real file system. You create a container, often called a bucket, and put objects into it. Each object has a key (its name), the data itself and metadata such as content type and custom labels. Keys can contain slashes, so tools show what looks like folders, but they're just parts of the name.
Programs reach objects with HTTP requests: put, get, list and delete. Amazon S3's interface became a common pattern, and many other services offer compatible versions, with differences in which features they support.
Objects are generally written and replaced whole. Changing one byte in a large object means uploading a new version, although large uploads can be split into parts. That makes object storage a poor home for a running database file. In return, it scales to vast numbers of items, is usually inexpensive per gigabyte and offers useful features:
- Versioning, which keeps earlier copies of an overwritten or deleted object.
- Lifecycle rules, which move old objects to cheaper classes or expire them.
- Object lock or immutability settings, which block deletion for a period.
- Direct delivery to browsers, often behind a content delivery network.
- Temporary signed links that grant access to one object for a limited time.
Access settings deserve care. A bucket accidentally opened to the public is a well-known way for private data to leak. Many providers offer an account-level switch that blocks public access; leave it on unless you have a specific reason.
Side by side
| Feature | Block | File | Object |
|---|---|---|---|
| You see | A raw disk | Folders and files | Keys and objects |
| Typical access | Attached to a machine | SMB or NFS | HTTP API |
| Shared by many clients | Rarely | Yes | Yes |
| Edit part of a file | Yes | Yes | No, replace the object |
| Latency | Lowest | Moderate | Higher per request |
| Scale | Per-volume limits | Large | Very large |
| Common use | Databases, boot disks | Team shares | Media, backups, logs |
These are tendencies; specific products vary, so read the limits for the one you pick.
Performance in practice
Three measures describe how storage feels. Latency is how long one operation takes to complete. IOPS counts how many small operations happen each second. Throughput is how many bytes move each second. A database answering many small queries cares about latency and IOPS. A video processing job reading huge files cares mostly about throughput.
Mismatches cause confusing symptoms. A server can show an idle processor while users wait, because every request is queued behind a disk that has reached its limit. Cloud volumes often tie performance limits to size or to a paid setting, so check the metrics before assuming the application is at fault. The virtual machine has its own storage bandwidth ceiling too, which can cap a fast volume.
For file shares, count round trips. Opening a project with thousands of small files requires many separate requests, each paying the network delay. Moving the compute closer to the share, or packaging files together, usually helps more than buying more capacity.
For object storage, run requests in parallel, split very large transfers into parts and keep the application in the same region as the bucket. Cache anything that's read repeatedly.
Consistency and concurrent changes
Think about what happens when two writers act at once. A file system offers locks so that one program can claim a file while editing it, although programs have to cooperate for locks to help, and behavior differs between SMB and NFS.
Object storage generally has no equivalent of editing in place. If two clients write the same key, one version typically ends up as the current one, and versioning keeps the other recoverable if you've enabled it. Some services support conditional requests that refuse a write if the object has changed since you read it. Applications that need many users updating the same record should keep that record in a database and leave object storage to hold the files.
Block storage leaves all of this to whatever file system or database sits on top, which is another reason a single attached machine is the normal arrangement.
What you pay for
Block volumes are usually billed on the size you provision, even if half empty, plus any extra performance. File services often bill on capacity used or provisioned, with throughput options. Object storage bills on capacity stored, number of requests, retrieval from colder classes and data transferred out.
Request charges can matter. Storing millions of tiny objects may cost more in operations than in capacity, and cold classes may charge a minimum duration, so deleting early still bills for the full period. Bundling small files into archives often helps.
A worked example
Say you're building a photo-sharing site for a club. The database of members and captions goes on a block volume or a managed database that uses one. Uploaded photos go to object storage, and the web application records each object's key in the database. Visitors fetch images through a content delivery network using signed or public links, depending on privacy. If an old desktop tool needs to drop files into a folder for processing, a small file share serves that one purpose.
This split also makes the web servers disposable, since nothing important lives on their own disks. That helps if you run them in containers.
Protecting the data
Providers replicate storage to survive hardware failures, with levels that depend on the service and options chosen. That doesn't protect against a bad script or a deleted bucket. Use snapshots for block volumes and file shares, versioning for objects, and copies in a separate account or provider for anything irreplaceable. Sync is not backup explains the principle, and it applies just as well to replication.
Common questions
Can I mount object storage like a drive?
Tools exist that make a bucket look like a folder. They can be handy for simple copying, but renames, partial writes and locking behave differently from a real file system, so don't point a database at one.
Is object storage slow?
Individual requests take longer to start than local disk reads. Total throughput can be very high when many requests run in parallel.