Today, let's continue to talk about shared storage, and talk about something that everyone doesn't often come into contact with: iSCSI.
This thing does not belong to the category of NAS, but belongs to the SAN (Storage Area Network) we mentioned earlier. To be honest, it is not necessary to build a SAN in the home of ordinary users, and most ordinary users often do not understand the network cable, and the cost of getting a Fibre Channel switch is not worth it, and it is more troublesome to maintain.
But there are things you don't have at home, but you need to understand them, after all, these things are the ceiling in the field of technology, and you can't keep up which users who love to toss will do that.
When many people are talking about the 10 Gigabit network, now the FC channel of SAN has reached 256G, and even the channel of the slower Ethernet SAN can reach 100Gbps, which is 100 Gigabits.
Compared with everyone's NvME SSD, it can only be said that this thing is a civilian product, after all, when the read speed is more than 3000, the merchant can mark it with the slogan "read up to".
Many people think that SSDs are infinitely fast. Of course, the fastest SSD drive reads now seem to be over 10,000. It seems to give the average user a feeling that the SSD is really fast.
If you don't take the cost into account, the results of a SAN are not the same. On the latest SAN this year, 49,700 MB/s of data traffic can be provided for each port, which is one of the bandwidth advantages of SAN.
Today, let's build a very simple SAN server, connect it to the computer, and see what is the difference between sharing with NAS.
The system used is more niche: ESOS, which is called "Enterprise Storage OS". It was developed in 2012 by Quantum, the storage giant of the year. Now also maintained by Quantum's team, the latest update was released in May 2023. At present, there are not enough hundreds of ESOS systems on the earth, which can be checked on the use status of the ESOS site, and you can also have a new picture to play.
Let's talk about how to deploy it first:
Preparation for deployment requires you to have a separate computer, the computer has a hard disk and a network card, of course, if you want to really play SAN, then the array card, HBA card is supported on this system. Although there are few people who use ESOS, the hardware support is not afraid to come.
Secondly, there is an idle U disk above 4G, ESOS and UNraid, both are U disk boot installation and deployment.
Computer, hard disk, network card, USB flash drive, when ready, we can start to deploy ESOS.
Step 1: Download a set of ESOS installation packages.
I have to say here that there seems to be a problem with the windows installer of ESOS 4.X, and iN has a linux machine on this side, so I didn't force this installation package to be generated on Windows. Just do it in Linux
Enter the command in Linux
wget https://download.esos-project.com/packages/4.x.x/esos-4.2.1_z.zip --content-disposition
Download the latest ESOS installation package
After downloading, unzip unzip to the current directory
Step 2: Generate an ESOS boot USB flash drive
After entering the ESOS directory, there are two installation commands in the directory, install.sh and install.vbs, which can be used to install them from the command line in Linux and windows, respectively.
It is said to be installed, but in fact, it is to use this command to generate a boot USB flash drive.
Before that, we need to use the lsscsi command to determine the path of the USB flash drive, for example, iN's machine, when the USB flash drive is not inserted, use the lsscsi command to see that it is two drive letters: /dev/sda and /dev/sr0.
After inserting the USB flash drive, you will find that there is a drive letter path of /dev/sdb, which is a USB flash drive, remember this path. Enter "sudo ./install.sh" on the command line
Wait a while, you can see the prompt to enter the path of the USB flash drive, this step press "/dev/sdb", the rest is to wait for the boot USB disk to be established.
Step 3: Set up the ESOS system
When the ESOS boot USB stick is generated, use this USB stick to boot a computer.
iN's suggestion is that you should have an idle computer, and all the data in this computer has been backed up, and the hard disk should be initialized. The reason is that ESOS is a storage system that resets all hard disk information under the management of this system.
After successful booting, you can log in to the system with the default username "root" and password "esos".
This is a system based on the TUI interface, and unlike the GUI, all system interfaces are completely user interfaces generated by character terminals. Somewhat similar to the feeling of the Bios. But that's what ESOS is all about. Basically, we may not be able to do it once for a long time to manage ESOS settings, so we can do this interface.
The first step to enter the interface is to do the network settings of the system, press s s to enter the system settings menu, and select the network settings:
The first item sets the overall network configuration:
Here, let's set the hostname, subdomain, gateway, and DNS address of ESOS according to your actual situation, for example:
After OK, the system makes a basic setting for the network:
Then set the IP address of the network card: or S enter the system settings and select the network settings:
At this time, the local NIC will be listed in the interface. Select a NIC to enter:
To set the static address, there is a point to explain here is the broadcast address "Broadcast", which is a special address with all subnet host IDs of 1 in the IP network
For example, if your network address is 192.168.10.100 and the subnet mask is 255.255.255.0, then the first three digits of your network address are the network ID or subnet ID, so it is 192.168.10.0, if you calculate the broadcast address, you can calculate the last number 0 is all binary 1, that is, 11111111, converted to 10 is 255, so your broadcast address is 192.168.10.255.
In this iN installation example, since the network at iN's home is set to a 16-bit subnet mask (255.255.0.0), the last two digits are the host ID, and the broadcast address is 172.16.255.255.
The default value is 1500, but if you want to get higher performance and the switch supports it, you can set a jumbo frame here - for example, 9000. But this brings us to out-of-band management (using a different network to manage devices), so let's keep the 1500 for a while. This will reduce the performance a little bit.
After setting the network parameters, the ESOS can be remotely accessed and managed.
There is no difference between SSH login and keyboard display. So, monitors, keyboards, and so on can be removed from this "storage server".
Step 4: Set up ESOS storage
When you log in to ESOS from the far end, you will find that the system is still "empty" and seems to have nothing.
There are two main areas of the interface that we can see so far, the first is an overview of the taget and the second is an overview of the session
Taget is the storage target that ESOS can provide externally, and session is the customer connection connected to the ESOS system.
In the top menu, Hardware RAID, Software RAID, LVM, and File Systems correspond to the four major functional points that need to be planned for a storage server: hardware RAID, software RAID, logical volume management, and file system management.
On this machine, the iN only has an SSD hard drive attached to it, so we will find an opportunity to talk about the deeper things in the future, and today's goal is to make this system work.
Briefly, if you open the file system menu, you can use the file system's functionality to create a virtual disk based on disk files.
At this time, the hard disk connected to the system can be exposed:
When setting up a file system, ESOS can support four file systems:
In fact, it is also possible to download other ESOS sub-versions to support systems such as ZFS. In today's example, we choose Btrfs, a high-performance block file system based on a binary tree that supports write replication.
After the file system is defined, the entire disk mounted by the system can host the files on the virtual disk
We also need to set up a virtual disk:
Select the file system you just created:
Define the name and size of the virtual disk
In this example, we will first create two 40G virtual disks.
Now we can see these two virtual disks in the file system - virtual disk file list.
It should be noted here that this is a virtual disk file, which already exists in the system, but cannot be directly used by the outside world. If we look on the command line, we will see that these two "disks" are just two files under /mnt.
But once we've built up the virtual disk, we can start building the virtual drive. This is the second row of the Devices section of the menu.
The device is the system object that ESOS can really target, let's take a closer look:
In the process of setting up the drive, we have a number of optional items, including:
- dev_disk
- dev_disk_perf
- vcdrom
- vdisk_blockio
- vdisk_fileio
- vdisk_nullio
- dev_changer
- dev_tape
- dev_tape_perf
Among them, dev_disk and dev_disk_perf refer to the direct connection of the physical disks mounted on the system.
VCTROM is an ISO file that emulates a CD-ROM drive, and the ISO file of the CD can be pulled directly from the command line interface of ESOS:
vdisk_blockio and vdisk_fileio mount virtual disk files as "block I/O" or "file I/O".
vdisk_nullio are non-storage targets for performance testing
dev_changer, dev_tape and dev_tape_perf are the device entry points for ESOS to mount tape libraries and tapes for backup.
We've just created two virtual drive files, so we can choose vdisk_fileio mount the disk files as virtual drives.
There are a few settings in this
Block Size, which is the size of the base data unit used by the file system when interacting with the storage device.
NV Cache, indicates whether to use non-volatile cache
Removable, whether it is removable media, that is, whether it can be ejected from the system like a USB flash drive
Write Through, direct write flag, straight write means that data will be written directly to disk, while non-direct writes can get the most write performance optimization, but there is a risk of data loss if the power goes down during the write process.
Read Only: This is a read-only mark, which protects disk data and cannot be written to the disk
Rotational, this is an interesting option that defines whether your storage medium is a rotating mechanical disk. Follow the honest method to do it, SSD choose No, mechanical disk choose Yes.
Combined with the current demo machine, we can set it up like this:
Once it is set up, we can see the two drives that we have just set up in the drive information.
Now the memory layer is done.
If we want to do iSCSI, we're going to start defining the target on this storage server.
Step 5: Set the ESOS storage target, the word "target" is a direct translation of the original text "Target" in our IT circle, and a more appropriate translation is actually "target"
"Target" and "target" are both the same word in English. Let's not delve into translation. In a SAN-level storage server, all storage resources are exposed in the form of "targets", and the remote host projects data onto the "targets".
If you don't set a "target", then it doesn't make sense to insert more hard drives into a storage server – it's just a bunch of hard drives.
Therefore, before other hosts can connect to the storage, we need to set the "target" first.
The "target" is very simple to set up, just give a name, the general rule is to write that this is an IQN (iSCSI Qualified Name, ISCSI global name).
IQN strives to be globally unique, so basically everyone's rule starts with "IQN", followed by year-month, reverse domain: unique identifier. Writing is a non-mandatory standard, and if you are willing to comply with it, you can avoid a lot of potential name collision problems, and if you are willing to comply with it, it is not a big deal.
So our IQN is written as: iqn.2024-04.esos.esosHost:w25011
The target is erected, who will shoot?
Step 6: Set up the initiator
The concept of an initiator is a bit counterintuitive, but as we explain, the average person can understand what an initiator is all about.
The storage itself is dependent on the computer device.
According to the architecture of the computer, the computer is divided into five parts: input device, output device, combinator, controller and memory. But "memory" here means "memory". Of course, the input device of the computer is not the keyboard, mouse, touch screen, and output device, nor does it refer to the monitor and speaker. With the exception of these five devices, all devices on the computer, whether or not they are in the chassis, are actually called peripherals.
The respective peripherals are connected to the computer through the bus to complete their respective functions.
Although a SAN storage has a CPU, memory, and an operating system, for a computer, the storage itself is a peripheral, no different from a portable hard drive plugged into a USB port. So we talked about this half-day ESOS storage server itself as a secondary device for the computer. Although it can set up a "target", it still has to let the "gun" fight, this is the concept of the "initiator", and the initiative is on the "gun" of the computer rather than on the "target".
So let's build an initiator first. Switch to Windows and select "iscsi Initiator" in the Server Manager program
Windows systems use iSCSI initiators to build their own initiators.
Once opened, you can open the configuration window:
We go to the configuration tab and we can see the default settings of the initiator:
There is a default name for the initiator, it is recommended to click the "Change" button to modify it:
Now "iqn.2024-04.rihome:win25" in the windows interface is the IQN name of the Windows gun in the storage network.
Add a group in ESOS:
Select the targets to be included in the group, and a storage group can contain a large number of targets.
Give the group a name:
Add the initiator after naming:
Select the target:
To associate to a group:
Then fill in the initiator IQN that you just set up in Windows:
At this point, we have placed the Target in the Match Channel, and we have registered a Match Initiator for this Channel.
The gunman raises his gun, only to find ...... And there was nothing wrong with the virtual drive just now.
Well, that's right, the target is just a spiritual symbol, and we also need to associate the drive to the target.
这里“Map to Host Group”要把磁盘也放在比赛的通道里面去。 它才是实质的东西。
First, select the disk that already exists
Then select Taget
Then select the group you just set
Set a logical unit number in the target for this disk, which is 0 by default, but iN is usually set from 1. Also make sure that this is a read-only disk, set it to No.
In this case, the disk is associated with the target and the host's access group.
Then go to the target menu and open the tagert:
Select the target you want to open from the list:
Press OK after selecting Enable:
Finally, make sure that the state in the target list is changed to Enable
At this point, the ESOS setup is complete, and when you go back to the Windows ISCSI launcher, you will find that the target you just set in ESOS has already appeared in the window (this is the function of the broadcast mentioned earlier).
If not, enter the IP address of the ESOS server in the destination
Then select Quick Connect and we can connect directly to the ESOS target
So far, the ISCSI established by ESOS has been successfully connected to the Windows system.
However, if you look at "My Computer" at the moment, it will not include the disk you just connected.
The reason for this is that this disk is like a new drive that you just bought and plugged into your Windows system.
We also need to do the final step to mount the iSCSI drive.
Open Computer Management:
In the disk management menu, we can see this 40G disk that we have planned. It is currently offline.
Click on the disk with a key and select Online
Once online, right-click Initialize Disk
Select a partitioned table format and click OK.
Right-click on the disk partition and select Create Volume, which is a simple volume
Then format the hard drive, and eventually the Iscsi hard drive is mounted in Windows as an E drive.
On the Esos side, we can also see that there is already a session in the Session area.
At this point, this remote hard drive is ready to use.
It seems like a lot of work, but it only adds a virtual hard disk from the remote end to Windows. What are the benefits of this?
Actually, that's productivity. Let's do a test:
Now there is an Ubuntu installation package in the D drive:
If we copy it to an SMB share target:
We will find that in the gigabit network, the file transfer operation is basically full of gigabit, with a transfer rate of about 90~110MB.
But what if we copy the files to the e-drive of iscsi???
That's it!
The reason is simple. SMB is a file encapsulation for data transfer. The system transmission overhead is large and the efficiency is low.
In iSCSI, the operation commands and disk data blocks are directly sent over the network for file transfer. Even with a small bandwidth (1Gbps), it can still operate at high speeds at the system level.
As a productivity tool, the iscsi can basically exceed the speed of NAS shared folders several times faster at the same configuration level.
Of course, in general, an iSCSI can only be used by one host, which is a flaw for iSCSI, but in a real productivity environment, we can completely synchronize the data between several different iSCSI drives by background replication, which can solve the so-called sharing problem. In fact, no, the Btrfs or ZFS file system used on the storage server is itself block-level storage, and the same data will not occupy additional space twice. So even if there are hundreds of iSCSI targets on a storage server with hundreds of identical files, they are actually only taking up space for one file.
For the specific matter of ISCSI synchronization, we will find time to talk about it in detail, and let's stop here today.