How exactly does a storage system work in local storage

481 views

I don’t understand how storage works in the real work nor with computers. This is impeding me from being productive.

I was trying to create a small storage system of my own, but could not understand which functions could handle storage. So, how exactly can I replicate a system similar to those in the basic local file system? Something like c++ might work, but the procedures are unclear to me.

In: Technology

2 Answers

Anonymous 0 Comments

Depends on how low level you’re willing to go.
I think the one you’re likely to get to is something like a block device.
All logical drives are split up into blocks of a certain size. The blocks contain the actual contents of the file.
This splitting is mainly handled by the drivers, though the operating system can do funny things with that.
In linux there are things called inodes, short for “index nodes”. They define files.
It stores the metadata, and a list of blocks where you can find the actual data for the file.
It can be just a small files so multiple inodes fit in a single block, or with more recent files systems, span multiple blocks.

For linux block #2 contains the root inode. The computer will go to that place to start figuring out what your file system looks like.

Note all of this is handled by the operating system, it’s almost never handled by applications running on top of it.

Usually you’ll just have a method in C++ or whatever to open a path to a file, then use another method to write/read from that files.
These abstractions wrap up slightly more complicated requests to the operating system to do the inode stuff.

Anonymous 0 Comments

Computer storage is either done as a file, maybe something like an XML file where you can store fields and values such you might use to store something like user settings for a game or an application, or for larger data storage we would tend to use a database, which is made up of tables (rows and columns) and shows fields, values and how they relate to each other.

A common way of interacting with a database is through Structured Query Language (SQL), where you can write Queries that will perform functions on your data, such as Read the data or Update the data, or even change the structure of the database by adding or removing tables and fields.