<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>inode on Digi Hunch</title><link>https://static.digihunch.com/tag/inode/</link><description>Recent content in inode on Digi Hunch</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Thu, 26 Dec 2024 13:22:48 -0400</lastBuildDate><atom:link href="https://static.digihunch.com/tag/inode/index.xml" rel="self" type="application/rss+xml"/><item><title>How RPC and NFS work</title><link>https://static.digihunch.com/2020/07/nfs-network-file-system-and-rpc-remote-procedure-call/</link><pubDate>Wed, 15 Jul 2020 10:45:00 -0400</pubDate><guid>https://static.digihunch.com/2020/07/nfs-network-file-system-and-rpc-remote-procedure-call/</guid><description>&lt;p class="wp-block-paragraph"&gt;I touched on NFS in several previous postings, and here is a deeper dive of this particular protocol. NFS is built on top of Remote Procedure Call (RPC) and therefore it is important to understand RPC first. In fact NFS is one of the most prominent user of RPC and the best example for learning RPC.&lt;/p&gt;&#10;&lt;h3 class="wp-block-heading"&gt;RPC overview&lt;/h3&gt;&#10;&lt;p class="wp-block-paragraph"&gt;According to &lt;a href="https://en.wikipedia.org/wiki/Remote_procedure_call"&gt;Wikipedia&lt;/a&gt;, an RPC is when a computer program causes a procedure to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote. This is a form of client–server interaction (caller is client, executor is server), typically implemented via a request–response message-passing system. In the object-oriented programming paradigm, RPCs are represented by remote method invocation (RMI), such as Java RMI API.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;RPCs are a form of inter-process communication (IPC), in that other processes have a different address spaces: if on the same host machine, they have distinct virtual address spaces, even though the physical address space is the same; while if they are on different hosts, the physical address space is different. &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;RPC is a&amp;nbsp;&lt;a href="https://en.wikipedia.org/wiki/Request%E2%80%93response"&gt;request–response&lt;/a&gt;&amp;nbsp;protocol, and therefore synchronous. An RPC is initiated by the&amp;nbsp;&lt;em&gt;client&lt;/em&gt;, which sends a request message to a known remote&amp;nbsp;&lt;em&gt;server&lt;/em&gt;&amp;nbsp;to execute a specified procedure with supplied parameters. The remote server sends a response to the client, and the application continues its process. While the server is processing the call, the client is blocked (it waits until the server has finished processing before resuming execution), unless the client sends an asynchronous request to the server. There are many variations and subtleties in various implementations, resulting in a variety of different (incompatible) RPC protocols.&lt;/p&gt;&#10;&lt;figure class="wp-block-image size-large"&gt;&lt;img loading="lazy" decoding="async" width="694" height="475" src="https://static.digihunch.com/wp-content/uploads/2020/07/image-1.png" alt="" class="wp-image-1161"/&gt;&lt;/figure&gt;&#10;&lt;h3 class="wp-block-heading"&gt;NFS overview&lt;/h3&gt;&#10;&lt;p class="wp-block-paragraph"&gt;NFS is defined as a set of RPCs, including their arguments, results and effects. RPC makes NFS protocol transparent. RPC is also stateless so the server does not keep the state of RPCs once the request has been served. Each RPC contains the necessary information to complete the call. In the event of server failure, client will need to resubmit requests. &lt;a href="https://en.wikipedia.org/wiki/Network_File_System"&gt;NFS&lt;/a&gt; has several versions, with v3 and v4 most popular. We will focus on v3 in this posting and brief on v4.&lt;/p&gt;&#10;&lt;h3 class="wp-block-heading"&gt;Portmap&lt;/h3&gt;&#10;&lt;p class="wp-block-paragraph"&gt;RPC makes a remote call appears to client application as a local call, with the help of &lt;a href="https://en.wikipedia.org/wiki/Portmap"&gt;portmap&lt;/a&gt;. The utility for portmap is rpcbind. In RedHat/CentOS 5 or prior, it was even simply called portmap but they are essentially the same service for RPC port mapper. &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The rpcbind service is required on both NFS client and NFS server. On the client, it talks to client application, as well as its counterpart on the server. Its main function is query its counterpart on the server, providing a RPC program number, and expects a port number in return. On the server, the rpcbind utility listens at port 111, waiting for request with RPC program number(service), and return the TCP or UDP port number on which the requested service is hosted. RPC program number is reserved numeric indicator of services as outlined in &lt;a href="https://www.iana.org/assignments/rpc-program-numbers/rpc-program-numbers.xhtml"&gt;RFC5531&lt;/a&gt;. For example, 100005 for mountd, 100021 for nlockmgr, and 100003 for nfs. &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The port that rpcbind service itself listens on is always at port 111, which is known to both client and server. This is also referred to as portmapper daemon. Other than this fixed port, each NFS-related service (with their respect reserved program number) may be hosted on different ports on the server. The client rpcbind service must first look up for the port for the requested program number, then it directs the client to initiate connection to the specified port for the specific service. &lt;/p&gt;&#10;&lt;figure class="wp-block-image"&gt;&lt;img decoding="async" src="https://docs.oracle.com/cd/E37838_01/html/E61058/figures/S9_portmap_seq.jpg" alt="image:Graphic illustrates portmap sequence for TCP/IP only"/&gt;&lt;/figure&gt;&#10;&lt;p class="wp-block-paragraph"&gt;With the following command rpcinfo command you may look up the program to port number mapping on destination server isilon.company.com&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# rpcinfo -p isilon.company.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="wp-block-paragraph"&gt;The following command is commonly used for displaying mountpoint and troubleshooting mount. Under the hood it is using the information from rpcinfo.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;showmount -e isilon.dcb.digitalhunch.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="wp-block-paragraph"&gt;On the NFS server side, rpcbind service must start before nfs service start. Otherwise nfs service cannot register ports to rpcbind. If you restart rpcbind, every service that had registered to rpcbind must restart to register themselves again. By default, NFS server can dynamically assign a port for mountd, nlockmgr within a port range. &lt;a href="https://www.systutorials.com/fixing-ports-used-by-nfs-server/"&gt;This&lt;/a&gt; makes firewall setting a pain. These dynamically assigned port can be fixed via configuration files. &lt;/p&gt;&#10;&lt;h3 class="wp-block-heading"&gt;File handle&lt;/h3&gt;&#10;&lt;p class="wp-block-paragraph"&gt;NFS uses &lt;a href="https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxb500/bpx1fr_NFS_file_handles.htm"&gt;file handles&lt;/a&gt; (or fhandle) to represent files. It is a better mechanism to reference a file object than pathname for three reasons: 1. file handle has fixed length (32bytes); 2. If the file is renamed, the file handle reference remain the same; 3. If a file is deleted, and then a new file is created with the same path, a new file handle will be created. A file handle has three parts:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&lt;li&gt;volume ID: to identify the mounted file system&lt;/li&gt;&lt;li&gt;inode #: to identify the file within the mounted file system&lt;/li&gt;&lt;li&gt;&lt;a href="https://utcc.utoronto.ca/~cks/space/blog/unix/NFSFilehandleInternals"&gt;generation #&lt;/a&gt;: to detect when file handle refers to an older version of inode. Traditional Unix filesystems may reuse inode and thus NFS client could mistakenly use an old file handle and access a new file.&lt;/li&gt;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The file handle information is only meaningful to the server. New file handles are returned to client by certain procedures, such as LOOKUP, CREATE, and MKDIR. The file handle for the root of the file system, is obtained by the client when it mounts the file system, as permission allows.&lt;/p&gt;&#10;&lt;h3 class="wp-block-heading"&gt;Permission and Locking&lt;/h3&gt;&#10;&lt;p class="wp-block-paragraph"&gt;When accessing a file on server, the client passes uid/gid info in RPCs, and the server performs permission checks as if the user was performing the operation locally. So users and groups are represented as integers. There are two security problems:&lt;/p&gt;&#10;&lt;ol class="wp-block-list"&gt;&lt;li&gt;The mapping from uid/gid to user must be the same on all clients. This is not practical in large deployment, although can be solved via Network Information Service (NIS);&lt;/li&gt;&lt;li&gt;Whether the root user on the client has root access to files on the server, is a server policy configuration. This can be addressed by enabling &amp;#8220;root squashing&amp;#8221; on server, so that client&amp;#8217;s uid 0 (root) is mapped to 65534 (nobody).&lt;/li&gt;&lt;/ol&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Unix has &lt;a href="https://gavv.github.io/articles/file-locks/"&gt;two locking mechanisms&lt;/a&gt; (fcntl and flock). NFS protocol supports fcntl but not flock. The flock function is managed by a separate service (nfslock) to allow NFS to lock files. The &lt;a href="https://www.thegeekdiary.com/linux-os-service-nfslock/"&gt;nfslock&lt;/a&gt; daemon provides the ability to lock regions of NFS files. NFS service itself is still completely stateless with locking managed separately. This is changed in NFSv4.&lt;/p&gt;&#10;&lt;h3 class="wp-block-heading"&gt;Procedures used in NFS service&lt;/h3&gt;&#10;&lt;p class="wp-block-paragraph"&gt;NFS service defines a &lt;a href="https://docs.oracle.com/cd/E19620-01/805-4448/z4000027624/index.html"&gt;list of procedures&lt;/a&gt;. Here is a list with brief summary of activities. The bottom five RPCs are introduced in v3.&lt;/p&gt;&#10;&lt;figure class="wp-block-table is-style-regular"&gt;&lt;table class="has-background" style="background-color:#e9fbe5"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Procedure&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;Activity&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;GETATTR(fh)&lt;/td&gt;&lt;td&gt;Returns the attributes of a file, similar to stat syscall.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;SETATTR(fh, attr)&lt;/td&gt;&lt;td&gt;Sets the attributes of a file (mode, uid, gid, size, atime, mtime); setting the size to 0 truncates the file&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;STATFS(fh)&lt;/td&gt;&lt;td&gt;Returns the status of a filesystem, such as block size, number of free blocks. e.g. df command.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;LOOKUP (dirfh, name)&lt;/td&gt;&lt;td&gt;Returns fhandle and attributes for the named file in the directory specified by dirfh&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;READ (fh, offset, count)&lt;/td&gt;&lt;td&gt;Reads from a file, with offset and count specified. In v2, the length is up to 8192 bytes; v3 support more.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;WRITE (fh, offset, count, data)&lt;/td&gt;&lt;td&gt;Writes to a file, with offset and count specified, as well as a separate field called data. Returns the new attributes of the file after the write.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CREATE (dirfh, name, attr)&lt;/td&gt;&lt;td&gt;Creates a file with the name, in directory, returns new fhandle and attributes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;REMOVE (dirfh, name)&lt;/td&gt;&lt;td&gt;Deletes the named file in from directory dirfh and returns status.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;RENAME (dirfh, name, tofh, toname)&lt;/td&gt;&lt;td&gt;Renames name in directory dirfh, to toname in directory tofh.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;LINK (dirfh, name, tofh, toname)&lt;/td&gt;&lt;td&gt;Creates a hard link toname, in directory tofh, that points to name, indirectory dirfh.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;SYMLINK (dirfh, name, string)&lt;/td&gt;&lt;td&gt;Creates a symbolic link name, in the directory dirfh, with value string.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;READLINK (fh)&lt;/td&gt;&lt;td&gt;Reads a symbolic link and get file name of the target.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;MKDIR (dirfh, name, attr)&lt;/td&gt;&lt;td&gt;Creates a directory name in the directory dirfh, and returns the new fh and attributes.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;RMDIR(dirfh, name)&lt;/td&gt;&lt;td&gt;Removes a directory with the name, from parent directory dirfh.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;READDIR (dirfh, cookie, count)&lt;/td&gt;&lt;td&gt;Reads a directory and returns up to count bytes of directory entries from the directory dirfh. The cookie is used in subsequent readdir calls to start reading at a specific entry in the directory. Cookie of zero get the server to start with the first entry in the directory.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;NULL&lt;/td&gt;&lt;td&gt;No activity. Used for testing only.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ACCESS&lt;/td&gt;&lt;td&gt;Helps with client caching.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;MKNOD&lt;/td&gt;&lt;td&gt;Makes a device special file.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;FSINFO&lt;/td&gt;&lt;td&gt;Returns information about the server&amp;#8217;s capabilities. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;READDIRPLUS&lt;/td&gt;&lt;td&gt;Returns both file handle and attributes to eliminate LOOKUP calls when scanning a directory&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;COMMIT&lt;/td&gt;&lt;td&gt;In NFSv3, the server can reply to WRITE RPCs immediately without syncing to disk. When client wants to ensure that the data is on stable storage, it sends a COMMIT RPC. This is used in asynchronous writes for better performance, which is an option negotiated at mount time.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/figure&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The addition of COMMIT procedure in v3 offers the option to improve write performance in place of synchronous write. However, asynchronous write requires more coordination to ensure data integrity during transmission, in the event of server crash. NFSv3 uses write verifier for this purpose. A write verifier is an 8-bye value that the server must change if it crashes. &lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&lt;li&gt;After an asynchronous write, the reply from WRITE RPC includes a write verifier, the client must keep it for later use;&lt;/li&gt;&lt;li&gt;The client then sends a COMMIT RPC and the reply contains another write verifier;&lt;/li&gt;&lt;li&gt;The client compares the verifiers from the two returns for crash detection. If the verifiers don&amp;#8217;t match, the client must rewrite all uncommitted data.&lt;/li&gt;&lt;li&gt;The client must keep all uncommitted data in case of a server crash.&lt;/li&gt;&lt;/ul&gt;&#10;&lt;h3 class="wp-block-heading"&gt;Additional daemon processes&lt;/h3&gt;&#10;&lt;p class="wp-block-paragraph"&gt;In addition to the three essential services, (nfs, rpcbind and nfslock), there are several auxiliary processes that facilitates NFS services. Their functions are listed &lt;a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/ch-nfs"&gt;here&lt;/a&gt;:&lt;/p&gt;&#10;&lt;figure class="wp-block-table is-style-regular"&gt;&lt;table class="has-background" style="background-color:#e9fbe5"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Process&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;rpc.mountd&lt;/td&gt;&lt;td&gt;Used by NFS server to process MOUNT requests from NFSv3 client. It checks that the requested NFS share is currently exported by the NFS server, and that the client is allowed to access it. If the mount request is allowed, the rpc.mountd server replies with a Success status and provides the File-Handle for this NFS share back to the NFS client.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;rpc.nfsd&lt;/td&gt;&lt;td&gt;Allows explicit NFS versions and protocols the server advertises to be defined. It works with the Linux kernel to meet the dynamic demands of NFS clients, such as providing server threads each time an NFS client connects. This process corresponds to the nfs service.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;rpc.lockd&lt;/td&gt;&lt;td&gt;A kernel thread which runs on both clients and servers. It implements the Network Lock Manager (NLM) protocol, which allows NFSv3 clients to lock files on the server, using procedures such as NLM_NULL, NLM_TEST, NLM_LOCK, NLM_GRANTED, NLM_UNLOCK, NLM_FREE. The service is started automatically whenever the NFS server is run and whenever an NFS file system is mounted.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;rpc.statd&lt;/td&gt;&lt;td&gt;This process implements the Network Status Monitor (NSM) RPC protocol, which notifies NFS clients when an NFS server is restarted without being gracefully brought down. rpc.statd is started automatically by the nfslock service, and does not require user configuration. This is not used with NFSv4.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;rpc.rquotad&lt;/td&gt;&lt;td&gt;This process provides user quota information for remote users. rpc.rquotad is started automatically by the nfs service and does not require user configuration.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;rpc.idmapd&lt;/td&gt;&lt;td&gt;provides NFSv4 client and server upcalls, which map between on-the-wire NFSv4 names (strings in the form of user@domain) and local UIDs and GIDs. For idmapd to function with NFSv4, the /etc/idmapd.conf file must be configured. At a minimum, the &amp;#8220;Domain&amp;#8221; parameter should be specified, which defines the NFSv4 mapping domain. If the NFSv4 mapping domain is the same as the DNS domain name, this parameter can be skipped. The client and server must agree on the NFSv4 mapping domain for ID mapping to function properly.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/figure&gt;&#10;&lt;h3 class="wp-block-heading"&gt;NFSv4&lt;/h3&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Even NFSv4 was introduced in 20 years ago, it improves access and performance of NFS on the Internet. It should be the default option for any new deployment.&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&lt;li&gt;NFSv4 is TCP only protocol and it is stateful. &lt;/li&gt;&lt;li&gt;NFSv4 combines mount and lock protocols into NFS so only one port is being used. &lt;/li&gt;&lt;li&gt;Users and groups are identified with strings (user@domain, or group@domain where domain represents a registered DNS domain or sub-domain), instead of integers. The access control policies are compatible with both Unix and Windows.&lt;/li&gt;&lt;li&gt;NFSv4 mandates strong RPC security built on cryptography, with negotiation at the time of mount&lt;/li&gt;&lt;li&gt;NFSv4 adopted a framework for authentication, integrity and privacy at RPC level&lt;/li&gt;&lt;li&gt;Introduced new RPC COMPOUND, which allows for several operations in one go. At the server, operations are evaluated in order, and each has a return value.&lt;/li&gt;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;NFSv4.1 was release in 2010, and 4.2 in 2016. Both AWS EFS and Azure File storage supports 4.1.&lt;/p&gt;&#10;&lt;nav class="wp-post-navigation" aria-label="Post navigation"&gt;&#10;&lt;a rel="prev" href="https://static.digihunch.com/2020/07/emc-productlines/"&gt;&lt;span class="wp-post-navigation-label"&gt;Previous Post&lt;/span&gt;&lt;strong class="wp-post-navigation-title"&gt;EMC Isilon storage product&lt;/strong&gt;&lt;/a&gt;&#10;&lt;a rel="next" href="https://static.digihunch.com/2020/07/zookeeper-and-kafka-overview/"&gt;&lt;span class="wp-post-navigation-label"&gt;Next Post&lt;/span&gt;&lt;strong class="wp-post-navigation-title"&gt;Kafka high-level Overview&lt;/strong&gt;&lt;/a&gt;&#10;&lt;/nav&gt;&#10;</description></item><item><title>Storage Nitty-Gritty 1 of 5 – Disk and RAID</title><link>https://static.digihunch.com/2019/03/storage-nitty-gritty-1-5/</link><pubDate>Sat, 09 Mar 2019 22:25:52 -0500</pubDate><guid>https://static.digihunch.com/2019/03/storage-nitty-gritty-1-5/</guid><description>&lt;p class="wp-block-paragraph"&gt;On my trip I have been through several pre-sales discussions on storage. Therefore I&amp;#8217;m taking this opportunities to write up a series of postings deep diving into storage technologies. In this first section, we lay out the foundation of storage technology, from physical device to RAID, focusing on the concepts. Some contents are excerpts from Information Storage and Management.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Volume Manager&lt;/strong&gt; &amp;#8211; In early days, a file system occupies the entire disk drive, and presents continuous disk blocks directly to operating systems. Logical Volume Manager (LVM) was then introduced to bring a layer of abstraction (logical volume) on top of disks. The layers are shown as follows:&lt;/p&gt;&#10;&lt;p&gt;&lt;svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="604px" viewBox="-0.5 -0.5 604 186" style="max-width:100%;max-height:186px;"&gt;&lt;defs&gt;&lt;/defs&gt;&lt;g&gt;&lt;rect x="0" y="127" width="120" height="50" fill="#dae8fc" stroke="#6c8ebf" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(6.5,145.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="106" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 107px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Physical Hard Drive&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="53" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Physical Hard Drive&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="240" y="147" width="300" height="30" fill="#dae8fc" stroke="#6c8ebf" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(336.5,155.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="106" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 106px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Physical Hard Drive&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="53" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Physical Hard Drive&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="120" y="127" width="120" height="50" fill="#dae8fc" stroke="#6c8ebf" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(126.5,145.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="106" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 107px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Physical Hard Drive&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="53" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Physical Hard Drive&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="240" y="127" width="120" height="20" fill="#f5f5f5" stroke="#666666" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(277.5,130.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="44" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; vertical-align: top; width: 45px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Partition&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="22" y="12" fill="#333333" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Partition&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="360" y="127" width="180" height="20" fill="#f5f5f5" stroke="#666666" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(427.5,130.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="44" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; vertical-align: top; width: 45px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Partition&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="22" y="12" fill="#333333" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Partition&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="240" y="97" width="120" height="30" fill="#ffffff" stroke="#000000" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(255.5,105.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="88" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 89px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Physical Volume&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="44" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Physical Volume&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="120" y="97" width="120" height="30" fill="#ffffff" stroke="#000000" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(135.5,105.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="88" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 89px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Physical Volume&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="44" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Physical Volume&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="0" y="97" width="120" height="30" fill="#ffffff" stroke="#000000" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(15.5,105.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="88" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 89px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Physical Volume&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="44" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Physical Volume&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="360" y="97" width="180" height="30" fill="#ffffff" stroke="#000000" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(405.5,105.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="88" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 89px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Physical Volume&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="44" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Physical Volume&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="0" y="67" width="360" height="30" fill="#ffe6cc" stroke="#d79b00" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(141.5,75.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="77" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 78px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Volume Group&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="39" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Volume Group&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="360" y="67" width="180" height="30" fill="#ffe6cc" stroke="#d79b00" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(411.5,75.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="77" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 78px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Volume Group&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="39" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Volume Group&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="0" y="37" width="170" height="30" fill="#fff2cc" stroke="#d6b656" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(43.5,45.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="82" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 83px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Logical Volume&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="41" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Logical Volume&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="170" y="37" width="190" height="30" fill="#fff2cc" stroke="#d6b656" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(223.5,45.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="82" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 83px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Logical Volume&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="41" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Logical Volume&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="360" y="37" width="180" height="30" fill="#fff2cc" stroke="#d6b656" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(408.5,45.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="82" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 82px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;Logical Volume&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="41" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;Logical Volume&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="0" y="7" width="170" height="30" fill="#d5e8d4" stroke="#82b366" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(53.5,15.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="63" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 63px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;File System&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="32" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;File System&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="170" y="7" width="190" height="30" fill="#d5e8d4" stroke="#82b366" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(233.5,15.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="62" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 64px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;File System&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="31" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;File System&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="360" y="7" width="180" height="30" fill="#d5e8d4" stroke="#82b366" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(418.5,15.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="62" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 64px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;File System&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="31" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;File System&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="560" y="117" width="40" height="20" fill="none" stroke="none" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(556.5,120.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="46" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 47px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;pvcreate&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="23" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;pvcreate&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="560" y="87" width="40" height="20" fill="none" stroke="none" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(556.5,90.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="46" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 47px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;vgcreate&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="23" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;vgcreate&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="560" y="57" width="40" height="20" fill="none" stroke="none" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(558.5,60.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="42" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 43px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;lvcreate&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="21" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;lvcreate&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="550" y="32" width="40" height="20" fill="none" stroke="none" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(556.5,35.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="26" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 27px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;mkfs&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="13" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;mkfs&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;rect x="550" y="137" width="40" height="20" fill="none" stroke="none" pointer-events="all"&gt;&lt;/rect&gt;&lt;g transform="translate(557.5,140.5)"&gt;&lt;switch&gt;&lt;foreignObject style="overflow:visible;" pointer-events="all" width="25" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 26px; white-space: nowrap; overflow-wrap: normal; text-align: center;"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;white-space:normal;"&gt;fdisk&lt;/div&gt;&lt;/div&gt;&lt;/foreignObject&gt;&lt;text x="13" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica"&gt;fdisk&lt;/text&gt;&lt;/switch&gt;&lt;/g&gt;&lt;path d="M 550 177 L 550 13.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"&gt;&lt;/path&gt;&lt;path d="M 550 8.12 L 553.5 15.12 L 550 13.37 L 546.5 15.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;With all these layers, a byte in user file maps to disk sectors through several layers:&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-3.png" alt="" class="wp-image-311" width="519" height="348"/&gt;&lt;figcaption class="wp-element-caption"&gt;Mapping from user file to physical disk&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;File System&lt;/strong&gt; &amp;#8211; a hierarchical structure of files. It organizes data in a structural hierarchical manner. It includes files, directories as well as metadata. metadata must be consistent for the file system to be considered healthy. In Linux, metadata consists of:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;strong&gt;Superblock&lt;/strong&gt;: important information about file system, e.g. type, creation and modification dates, size, mount status flag&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Inodes&lt;/strong&gt;: a data structure that contains information associated with every file or directory&lt;/li&gt;&#10;&lt;li&gt;list of data blocks free and in use&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Host connects to storage through various Interface Protocols. Common interface protocols include:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;IDE/&lt;strong&gt;ATA&lt;/strong&gt; and Serial &lt;strong&gt;ATA&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;SCSI&lt;/strong&gt; (Small Computer System Interface)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;FC&lt;/strong&gt; (Fibre Channel)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;IP&lt;/strong&gt; (Internet Protocol per se is a network protocol traditionally used for host-to-host traffic in the early days. In the virtualization era, it has become a viable option for host-to-storage communication. Examples are &lt;strong&gt;iSCSI&lt;/strong&gt; and &lt;strong&gt;FCIP&lt;/strong&gt;)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The most prevalent disk drive types are &lt;strong&gt;SSD&lt;/strong&gt; (solid state drive) and &lt;strong&gt;HDD&lt;/strong&gt; (hard disk driveA). SSD (solid state drive) is newer, flash-based technology. Without seek and rotational latencies they deliver a high number of IOPS with low response times. They are especially suited for applications with small block size and random-read workloads requiring constant latency &amp;lt;1ms.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;HDD is traditional and more cost effective. Its physical components are illustrated in the following two graphs:&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-4.png" alt="" class="wp-image-312" width="325" height="226"/&gt;&lt;figcaption class="wp-element-caption"&gt;Hard disk component&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-5.png" alt="" class="wp-image-313" width="367" height="213"/&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;For HDD, disk service time (time taken by a disk to complete an I/O request) is determined by the following factors:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;strong&gt;Seek time&lt;/strong&gt; (aka access time) describes the time taken to position the R/W heads across the platter with a radial movement (moving along the radius of the platter). In other words, it is the time taken to position and settle the arm and the head over the correct track.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Rotation latency&lt;/strong&gt; is the time taken by the platter to rotate and position the data under the R/W head. It depends on the rotation speed of the spindle and is measured in milliseconds.&lt;/li&gt;&#10;&lt;li&gt;(&lt;strong&gt;Data) transfer rate &lt;/strong&gt;is the average amount of data per unit time that the drive can deliver from disk controller to the HBA (on the host).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Zone Bit Recording&lt;/strong&gt; &amp;#8211; a mechanism to use disk efficiently by grouping tracks into zones based on their distance from the disk.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Logical Block Addressing (LBA) &lt;/strong&gt;&amp;#8211; disk controller translates LBA to a physical address (CHS, cylinder, head and sector). The host only needs to know the size of disk drive in terms of number of blocks. The logical blocks are mapped to physical sectors on a 1:1 basis&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;IO request processing &lt;/strong&gt;&amp;#8211; I/O controller is introduce to improve response time for I/O request, in this model, The I/O requests arrive at the controller at the rate generated by the application. This rate is also called the arrival rate. These requests are held in the I/O queue, and the I/O controller processes them one by one, as shown here:&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-6.png" alt="" class="wp-image-314" width="541" height="57"/&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The relationship between controller utilization and average response time is: &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Average response time = Service time / (1 – Utilization) &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;where service time is the time taken by disk controller to service the I/O request. This results in a classic relation between response time and utilization, as plotted below:&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-7.png" alt="" class="wp-image-315" width="434" height="196"/&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The graph indicates that the response time changes are nonlinear as the utilization increases. When the average queue sizes are low, the response time remains low. The response time increases slowly with added load on the queue and increases exponentially when the utilization exceeds 70 percent. Therefore, for performance-sensitive applications, it is common to utilize disks below their 70 percent of I/O serving capability. &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Command queuing&lt;/strong&gt; is a technique implemented on modern disk drives that determines the execution order of received I/Os and reduces unnecessary drive-head movements to improve disk performance. When an I/O is received for execution at the disk controller, the command queuing algorithms assign a tag that defines a sequence in which the commands should be executed. With command queuing, commands are executed based on the organization of data on the disk, regardless of the order in which the commands are received. Below is an example:&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-8.png" alt="" class="wp-image-318" width="525" height="383"/&gt;&lt;figcaption class="wp-element-caption"&gt;Disk Command Queuing&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;RAID is a technology that leverages multiple drives as part of a set that provides data protection against drive failures. It may also improve performance by serving I/Os from multiple disks simultaneously. It is primarily used in HDD but SSD may still benefit from it. RAID may be implemented by software but hardware RAID with a controller is widespread. RAID is built on three basic techniques:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;strong&gt;Striping&lt;/strong&gt;: spread data across multiple drives (more than one) to use the drives in parallel.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Mirroring&lt;/strong&gt;: same data is stored on two different disk drives, yielding two copies of the data.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Parity&lt;/strong&gt;: a method to protect striped data from disk drive failure without the cost of mirroring. An additional disk drive is added to hold parity, a mathematical construct that allows re-creation of the missing data.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Basic RAID levels are summarized here:&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-9.png" alt="" class="wp-image-320" width="520" height="199"/&gt;&lt;figcaption class="wp-element-caption"&gt;RAID summary&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;RAID 0, 1, 5 and 6 are pretty common in data centre operations. In addition to these levels above. If you hear RAID 1+0, 5+0 and RAID 6+0, they are called nested RAID. They are simply a RAID 0 on top of RAID1, RAID 5 and RAID 6, respectively.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;RAID 0&lt;/strong&gt; &amp;#8211; data striping technique utilizes full capacity of drives. Although it is a good option for applications that need high I/O throughput. It lacks data protection so it cannot drive application requiring high availability.&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-10.png" alt="" class="wp-image-321" width="256" height="364"/&gt;&lt;figcaption class="wp-element-caption"&gt;RAID 0&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;RAID 1&lt;/strong&gt; &amp;#8211; mirroring technique ensures data duplication. In the event of disk failure, it introduces minimal impact to the disk array. It is suitable for applications that require high availability and cost is no constraint.&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-11.png" alt="" class="wp-image-322" width="294" height="382"/&gt;&lt;figcaption class="wp-element-caption"&gt;RAID 1&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;RAID 1+0 or RAID 10&lt;/strong&gt; &amp;#8211; performs well for workloads with small, random, write-intensive I/Os. Some applications that benefit from RAID 1+0 include the following:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;High transaction rate Online Transaction Processing (OLTP)&lt;/li&gt;&#10;&lt;li&gt;Large messaging installations&lt;/li&gt;&#10;&lt;li&gt;Database applications with write intensive random access workloads&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-12.png" alt="" class="wp-image-323" width="334" height="367"/&gt;&lt;figcaption class="wp-element-caption"&gt;RAID 1+0&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;RAID 3&lt;/strong&gt; &amp;#8211; RAID 3 stripes data for performance and uses parity for fault tolerance. the total disk space required is 1.25 times the size of the data disks. RAID 3 always reads and writes complete stripes of data across all disks because the drives operate in parallel. RAID 3 provides good performance for applications that involve large sequential data access, such as data backup or video streaming.&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-13.png" alt="" class="wp-image-324" width="266" height="370"/&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;RAID 5&lt;/strong&gt; &amp;#8211; RAID5 is similar to RAID 4 because it uses striping. The drives (strips) are also independently accessible. The difference between RAID 4 and RAID 5 is the parity location. In RAID 4, parity is written to a dedicated drive, creating a write bottleneck for the parity disk. In RAID 5, parity is distributed across all disks to overcome the write bottleneck of a dedicated parity disk.&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-14.png" alt="" class="wp-image-325" width="281" height="390"/&gt;&lt;figcaption class="wp-element-caption"&gt;RAID 5&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;RAID 5 is good for random, read-intensive I/O applications and preferred for messaging, data mining, medium-performance media serving, and relational database management system (RDBMS) implementations, in which database administrators (DBAs) optimize data access.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;RAID 6&lt;/strong&gt; &amp;#8211; works the same way as RAID 5, except that RAID 6 includes a second parity element to enable survival if two disk failures occur in a RAID set. The write penalty in RAID 6 is more than that in RAID 5; therefore, RAID 5 writes perform better than RAID 6. The rebuild operation in RAID 6 may take longer than that in RAID 5 due to the presence of two parity sets.&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-15.png" alt="" class="wp-image-326" width="288" height="405"/&gt;&lt;figcaption class="wp-element-caption"&gt;RAID 6&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Intelligent Storage System&lt;/strong&gt; involves cache as the core component. An intelligent storage system involves front end, cache, back end and physical disks, as shown here:&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-16.png" alt="" class="wp-image-330" width="565" height="255"/&gt;&lt;figcaption class="wp-element-caption"&gt;Intelligent Storage System components&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;A variety of &lt;strong&gt;physical disk&lt;/strong&gt; types and speed (e.g. mix of FC, SATA, SAS and flash) can be supported in a modern intelligent storage system.&amp;nbsp;The &lt;strong&gt;front end&lt;/strong&gt; provides the interface between the storage system and the host. It consists of ports and controllers, with redundancy. The &lt;strong&gt;back end&lt;/strong&gt; provides an interface between cache and the physical disks. It consists of ports and controllers. For high data protection and high availability, storage systems are configured with dual controllers with multiple ports.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Cache&lt;/strong&gt; improves storage system performance by isolating hosts from mechanical delays associated with hard disks. In intelligent storage system, read and write are first attempted on cache.&lt;/p&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-17.png" alt="" class="wp-image-334" width="454" height="226"/&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Page is the basic unit of cache, and the size of page is configured based on application I/O size. Cache consists of:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;strong&gt;data store&lt;/strong&gt;: holds the actual data temporarily&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;tag RAM&lt;/strong&gt;: mainly serves three purposes:&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;it tracks locations of data in cache and on disk; &lt;/li&gt;&#10;&lt;li&gt;it maintains dirty bit flag to indicate whether data in cache has been committed to disk;&lt;/li&gt;&#10;&lt;li&gt;it keeps time based information such as last access time, for cache management&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Read Operation with Cache&lt;/strong&gt;: When host issues a read request, the storage controller reads the tag RAM first to determine whether required data is available in cache:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;strong&gt;Read cache hit&lt;/strong&gt;: data is sent to host without any disk operation;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Read cache miss&lt;/strong&gt;: back end access the disk to retrieve the requested data. Data is then placed in cache and sent to host through front end.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-18.png" alt="" class="wp-image-335" width="546" height="466"/&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Cache miss increases I/O response time, to increase read hit ratio, read-ahead algorithm can be used when read requests are sequential. In a sequential read request, a contiguous set of associated blocks is retrieved. Several other blocks that have not yet been requested by the host can be read from the disk and placed into cache in advance. When the host subsequently requests these blocks, the read operations will be read hits. &lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;strong&gt;Fixed prefetch&lt;/strong&gt; &amp;#8211; the intelligent storage system prefetches a fixed amount of data. It is most suitable when host I/O sizes are uniform. &lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Variable prefetch&lt;/strong&gt;, the storage system prefetches an amount of data in multiples of the size of the host request. &lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Maximum prefetch&lt;/strong&gt; limits the number of data blocks that can be prefetched to prevent the disks from being rendered busy with prefetch at the expense of other I/Os.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Write Operation with Cache&lt;/strong&gt;: When an I/O is written to cache and acknowledged, it is completed in far less time (from the host’s perspective) than it would take to write directly to disk. Sequential writes also offer opportunities for optimization because many smaller writes can be coalesced for larger transfers to disk drives with the use of cache. Write operation with cache can be implemented in two ways:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;strong&gt;Write-back cache&lt;/strong&gt;: Data is placed in cache and an acknowledgment is sent to the host immediately. Later, data from several writes are committed (de-staged) to the disk. Write response times are much faster because the write operations are isolated from the mechanical delays of the disk. However, uncommitted data is at risk of loss if cache failures occur.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Write-through cache&lt;/strong&gt;: Data is placed in the cache and immediately written to the disk, and an acknowledgment is sent to the host. Because data is committed to disk as it arrives, the risks of data loss are low, but the write-response time is longer because of the disk operations.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;If the size of an I/O request exceeds the &lt;strong&gt;write aside size&lt;/strong&gt;, writes are sent to the disk directly to reduce the impact of large writes consuming a large cache space. This is helpful where cache resources are constrained and cache is required for small random I/Os. &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Cache space can be assigned in two ways:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;strong&gt;dedicated cache&lt;/strong&gt;: separate sets of locations are reserved for read and write;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;global cache&lt;/strong&gt;: user may specify percentage of cache for read and write based on application workload pattern; or the system set is dynamically.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Cache Management algorithm is used to determine when, and what pages of the cache need to be free up during maintenance. Most commonly used algorithms are:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;LRU (least recently used): assuming data not accessed for a while will not be requested by host any more;&lt;/li&gt;&#10;&lt;li&gt;MRU (most recently used): assuming data recently accessed will not be requested by host again&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;As cache fills, the storage system must take action to flush dirty pages by committing data from cache to disk. There are several triggers for cache management action:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;Idle flushing &amp;#8211; occurs continuously at modest rate when cache utilization level is between high and low watermark;&lt;/li&gt;&#10;&lt;li&gt;High watermark flushing &amp;#8211; activated when utilization hits high watermark; and stops at low watermark; this has impact to I/O processing;&lt;/li&gt;&#10;&lt;li&gt;Forced flushing &amp;#8211; occurs in the event of large I/O burst when cache reaches 100% capacity; this significantly impacts I/O response time&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="wp-block-image"&gt;&#10;&lt;figure class="aligncenter is-resized"&gt;&lt;img loading="lazy" decoding="async" src="https://static.digihunch.com/wp-content/uploads/2019/11/image-19.png" alt="" class="wp-image-336" width="523" height="184"/&gt;&lt;figcaption class="wp-element-caption"&gt;Types of Flushing&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;/div&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Cache data protection&lt;/strong&gt; is the mechanism to prevent losing uncommitted data held in cache. Common mechanisms are:&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Cache mirroring&lt;/strong&gt; &amp;#8211; Each write to cache is held in two different memory locations on two independent memory cards. If a cache failure occurs, the write data will still be safe in the mirrored location and can be committed to the disk. The array operating environment needs to maintain cache coherency between the redundant memory locations. Read cache does not need mirroring.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Cache vaulting&lt;/strong&gt; &amp;#8211; In the event of server power failure, use battery power to write the cache content to the disk (vault drive). When power is restored, data from these disks is written back to write cache and then written to the intended disks.&lt;/p&gt;&#10;&lt;p&gt;&lt;!--StartFragment--&gt;&lt;/p&gt;&#10;&lt;h4 class="wp-block-heading" id="h-related-postings"&gt;Related Postings&lt;/h4&gt;&#10;&lt;ul class="wp-block-list"&gt;&#10;&lt;li&gt;&lt;a href="https://static.digihunch.com/2019/03/storage-nitty-gritty-1-5/"&gt;SAN&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://static.digihunch.com/2019/07/storage-nitty-gritty-3-of-5-nas-and-object-storage/"&gt;NAS and Object Storage&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://static.digihunch.com/2019/10/storage-nitty-gritty-4-of-5-backup-and-archive-solutions/"&gt;Backup and Archive Solution&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://static.digihunch.com/2019/11/storage-nitty-gritty-5-of-5-replication/"&gt;Replication&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;!--EndFragment--&gt;&lt;/p&gt;&#10;&lt;nav class="wp-post-navigation" aria-label="Post navigation"&gt;&#10;&lt;a rel="prev" href="https://static.digihunch.com/2019/02/package-repository-management-in-linux/"&gt;&lt;span class="wp-post-navigation-label"&gt;Previous Post&lt;/span&gt;&lt;strong class="wp-post-navigation-title"&gt;Package Repository Management for Linux&lt;/strong&gt;&lt;/a&gt;&#10;&lt;a rel="next" href="https://static.digihunch.com/2019/04/build-a-wordpress-site-in-one-hour-with-lightsail/"&gt;&lt;span class="wp-post-navigation-label"&gt;Next Post&lt;/span&gt;&lt;strong class="wp-post-navigation-title"&gt;Lightsail – create a WordPress site in one hour&lt;/strong&gt;&lt;/a&gt;&#10;&lt;/nav&gt;&#10;</description></item><item><title>Basics Terms in Linux OS</title><link>https://static.digihunch.com/2018/04/basics-of-linux-os/</link><pubDate>Tue, 24 Apr 2018 19:16:00 -0400</pubDate><guid>https://static.digihunch.com/2018/04/basics-of-linux-os/</guid><description>&lt;p class="wp-block-paragraph"&gt;These are the things quite confusing or abstract while I was at school but now makes lots of sense after many years working with different flavours of OS.&lt;/p&gt;&#10;&lt;h4 class="wp-block-heading"&gt;&lt;strong&gt;GPL and BSD as software license types&lt;/strong&gt;&lt;/h4&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The main difference is that BSD (Berkeley Software Distribution) is a permissive (non-protective) license, while GPL(GNU General Public License) is a copyleft (protective) license.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Permissive licenses do not protect the code from being used in non-open source apps and apply no restrictions on the derivatives, while copyleft licenses force the creator of derivatives or re-distributor of the software to open the modified code. Under GPL you can&amp;#8217;t sub-license, meaning, you can’t change any of the original license terms or introduce any of your own. You’re also required to state all the changes you make to the original code. That is why components licensed under GPL and other copyleft licenses should be avoided in commercial products that would later be distributed under proprietary licenses.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;The BSD license family (including the Modified BSD License), on the other hand, doesn’t compel you to do any of the above. They have fairly relaxed redistribution terms.&lt;/p&gt;&#10;&lt;h4 class="wp-block-heading"&gt;&lt;strong&gt;GNU/Linux and BSD as operating systems&lt;/strong&gt;&lt;/h4&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Unix &lt;/strong&gt;&amp;#8211; the name of the original system designed at AT&amp;amp;T in the 1970s. At the time, it featured a great deal of novelties such as multi-tasking, multi-user support, time sharing, etc. It was made portable by using C language.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Linux Kernel&lt;/strong&gt; &amp;#8211; a free, open-source, monolithic, Unix-like OS kernel. It was conceived and created in 1991 by Linus Torvalds for his personal computer. The word Linux, technically, is just the kernel. By itself, Linux (Kernel) has no place for user to land (e.g. no apps, no commands)&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;GNU/Linux&lt;/strong&gt; &amp;#8211; GNU project has developed a comprehensive set of free software tools for use with Unix and Linux. GNU/Linux involves the software tools along with the Linux Kernel.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;GNU/Linux distribution&lt;/strong&gt; &amp;#8211; ready-to-use full OS, including Linux Kernel, GNU library and tools, whose developers have made a commitment to follow GNU GFSD, X Window and desktop environment (e.g. KDE, GNOME) and includes many pieces of software. GNU/Linux distro is what many people refer to as &amp;#8220;Linux&amp;#8221;, and it includes Debian, Ubuntu, RedHat and CentOS. &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;BSD (Berkeley Software Distribution) &amp;#8211; an OS based on Research Unix, originally developed at Bell Labs, eventually grown into a complete operating system. Today, &amp;#8220;BSD&amp;#8221; often refers to its decendants, such as FreeBSD, OpenBSD, NetBSD, or DragonFly BSD. Each of these are both a kernel and an operating system. Another famous BSD descendant is Darwin, which is what Mac OS X based on.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Comparing &amp;#8220;BSD&amp;#8221; with &amp;#8220;Linux&amp;#8221;&lt;/strong&gt; &amp;#8211; Linux is more popular and tends to support new hardware sooner. Typical users usually don&amp;#8217;t feel the difference between them. FreeBSD as desktop OS uses the same GNOME, KDE, or Xfce desktop environments that many flavours of Linux use as well. Although you need to install the desktop environment yourself. Another important difference is the licensing model as mentioned above between GPL and BSD. This article is a good reference about all the differences bewteen &amp;#8220;BSD&amp;#8221; and &amp;#8220;Linux&amp;#8221;&lt;br&gt; https://www.educba.com/linux-vs-bsd/&lt;/p&gt;&#10;&lt;h4 class="wp-block-heading"&gt;&lt;strong&gt;Swap, Cache and Buffer&lt;/strong&gt;&lt;/h4&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Swap &lt;/strong&gt;&amp;#8211; swap file or swap partition. The primary function is to substitute disk space for RAM memory when real RAM fills up and more space is needed. The kernel uses a memory management program that detects blocks, aka pages, of memory in which the contents have not been used recently. The memory management program swaps enough of these relatively infrequently used pages of memory out to a special partition on the hard drive specifically designated for “paging”, or swapping. This frees up RAM and makes room for more data to be entered into your spreadsheet. Those pages of memory swapped out to the hard drive are tracked by the kernel’s memory management code and can be paged back into RAM if they are needed.&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&lt;li&gt;&lt;strong&gt;Swapping &lt;/strong&gt;moves entire process between main memory and secondary storage; this is the original Unix method and can cause severe performance loss;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Paging &lt;/strong&gt;moves small unites of memory (i.e. pages with 4Kbytes). It is more efficient and was added to BSD&lt;/li&gt;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;In both cases, least recently used memory is moved to secondary storage and back to main memory only when needed again. In Linux, the term swapping is used to refer to paging. Older Unix-style swapping of entire thread and process is no longer supported.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;CPU Cache&lt;/strong&gt; &amp;#8211; a hardware cache used by CPU to reduce the average time to access data from the main memory. A cache is a smaller, faster memory, located closer to a processor core, which stores copies of the data from frequently used main memory locations. Most CPUs have different independent caches, inclusing insructions and data caches, where the data cache is usually organized as a hierarchy of more cache levels (L1, L2, L3, L4, etc)&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Page Cache (or disk cache)&lt;/strong&gt; &amp;#8211; kept by the OS in computer&amp;#8217;s main memory and controlled by the computer. The OS keeps a page cached in otherwise unused portions of the main memory, resulting in quicker access to the contents of cached pages and overall performance.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Disk Buffer&lt;/strong&gt; &amp;#8211; (or ambiguously called disk cache or cache buffer) the embedded memory in a hard disk drive acting as a buffer between the rest of the computer and the physical hard disk platter that is used for storage. Modern hard disk drives come with 8 to 256 MiB of such memory. Disk buffer is physically distinct from and is used differently from page cache. It is controlled by the microcontroller in the hard disk drive.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;GRUB (GNU GRand Unified Bootloader)&lt;/strong&gt; &amp;#8211; a boot loader package from GNU project. It is predominantly used for Unix-like systems. Current version is GRUB2&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;System call&lt;/strong&gt; &amp;#8211; In computing, a system call is the programmatic way in which a computer program requests a service from the kernel of the operating system it is executed on. This may include hardware-related services (for example, accessing a hard disk drive), creation and execution of new processes, and communication with integral kernel services such as process scheduling. System calls provide an essential interface between a process and the operating system. Below is a list of key system calls:&lt;/p&gt;&#10;&lt;figure class="wp-block-table is-style-stripes"&gt;&lt;table class="has-background" style="background-color:#e9fbe5"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;System Call&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;read()&lt;/td&gt;&lt;td&gt;read bytes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;write()&lt;/td&gt;&lt;td&gt;write bytes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;open()&lt;/td&gt;&lt;td&gt;open a file&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;close()&lt;/td&gt;&lt;td&gt;close a file&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;fork()&lt;/td&gt;&lt;td&gt;create a new process&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;exec()&lt;/td&gt;&lt;td&gt;execute a new program&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;connect()&lt;/td&gt;&lt;td&gt;connect to a network host&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;accept()&lt;/td&gt;&lt;td&gt;accept a network connection&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;stat()&lt;/td&gt;&lt;td&gt;fetch file statistics&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ioctl()&lt;/td&gt;&lt;td&gt;set I/O properties, or other miscellaneous functions&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;mmap()&lt;/td&gt;&lt;td&gt;map a file to the memory address space&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;brk()&lt;/td&gt;&lt;td&gt;extend the heap pointer&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/figure&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;&lt;a href="http://man7.org/linux/man-pages/man2/syscalls.2.html"&gt;strace &lt;/a&gt;&lt;/strong&gt;is the tool to trace system calls and signals in Linux. &lt;/p&gt;&#10;&lt;h4 class="wp-block-heading"&gt;&lt;strong&gt;sysVinit, runit and systemd&lt;/strong&gt;&lt;/h4&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;init &lt;/strong&gt;&amp;#8211; in Unix-based OS, init is the first process started during booting of OS. Init is a daemon process that continues running until the system is shutdown. It is the direct or indirect ancestor of all other processes and automatically adopts all orphaned processes. Init is started by the kernel during the booting process; a kernel panic will occur if the kernel is unable to start it. Init is typically assigned process identifier 1 and its job is to start other programs that are essential to the operation of your system. All other processes are descended from init.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;init systems&lt;/strong&gt;&lt;br&gt; Linux has several options as init systems. For example: sysvinit, runit, systemd and upstart. Here is a comparison of commands involved in managing each. &lt;br&gt; http://unix.cafe/wp/en/2017/07/howto-manage-a-service-in-systemd-sysvinit-upstart-runit-and-openrc/&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;SysV init&lt;/strong&gt; &amp;#8211; System initialization process is handled by the init daemon. One of the original daemon is SysVinit, which is a collection of System V-style init programs. init process starts serially. It is a run-once process during the start of the OS. One task starts only after the last task startup was successful and it was loaded in the memory. This often resulted in delayed and long booting time. &lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Runit &lt;/strong&gt;&amp;#8211; an init scheme for Unix-like operating systems that initializes, supervises, and ends processes throughout the operating system. It is a replacement of sysvinit and features brevity and simplicity.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Systemd &lt;/strong&gt;&amp;#8211; A init replacement daemon designed to start process in parallel, implemented in a number of standard distribution – Fedora, OpenSuSE, Arch, RHEL, CentOS, etc. Its flexibility comes with more complexity. It is an event driven init system, that not only starts stuff at boot (hence managing dependencies), but also after that. It also keeps track of many things after boot, such as mounts, availability of services, integration with resource management, etc. Because of that, systemd is also good at logging and monitoring. Systemd allows services to start when:&lt;/p&gt;&#10;&lt;ul class="wp-block-list"&gt;&lt;li&gt;the system boots&lt;/li&gt;&lt;li&gt;a hardware components attaches to the system&lt;/li&gt;&lt;li&gt;other service started&lt;/li&gt;&lt;li&gt;a timer fires&lt;/li&gt;&lt;/ul&gt;&#10;&lt;p class="wp-block-paragraph"&gt;To determine which system initialization method your current Linux distribution is using (SysVinit or systemd), simply check process id 1:&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt; $ ps -p 1&lt;/p&gt;&#10;&lt;h4 class="wp-block-heading"&gt;&lt;strong&gt;Soft link and hard link&lt;/strong&gt;&lt;/h4&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;inode &lt;/strong&gt;&amp;#8211; stores the attributes and disk block locations of a file or directory&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Soft/Symbolic link&lt;/strong&gt; &amp;#8211; essentially a shortcut to another file. The link itself is a separate file, pointing to the destination file or directory. The inode of the file is different from that of the symbolic link. Deleting the destination file will leave the symbolic link file a &amp;#8220;dangling link&amp;#8221;. Symbolic file may also have different permissions from the destination file or directory.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;&lt;strong&gt;Hard link&lt;/strong&gt; &amp;#8211; essentially an alias of a file. The link itself is not a separate file, and the destination can only be a file (no directory). The inode of the link the the same as the file itself. So there is actually no distinction between destination file and link. Both files are equal. If you delete the file, the link continue to work until the number of hard links to the file becomes zero.&lt;/p&gt;&#10;&lt;p class="wp-block-paragraph"&gt;Soft link points to a file by name whereas hard link points by inode number.&lt;/p&gt;&#10;&lt;nav class="wp-post-navigation" aria-label="Post navigation"&gt;&#10;&lt;a rel="prev" href="https://static.digihunch.com/2018/04/centos-remove-swap-safely/"&gt;&lt;span class="wp-post-navigation-label"&gt;Previous Post&lt;/span&gt;&lt;strong class="wp-post-navigation-title"&gt;CentOS – Remove Swap safely&lt;/strong&gt;&lt;/a&gt;&#10;&lt;a rel="next" href="https://static.digihunch.com/2018/05/cron-and-logrotate-in-centos/"&gt;&lt;span class="wp-post-navigation-label"&gt;Next Post&lt;/span&gt;&lt;strong class="wp-post-navigation-title"&gt;cron and anacron in RedHat Linux (How logrotate works)&lt;/strong&gt;&lt;/a&gt;&#10;&lt;/nav&gt;&#10;</description></item></channel></rss>