<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Mehul's Blog]]></title><description><![CDATA[Hi, I’m Mehul Minat. I build web apps, work on cloud, DevOps, and automation, and love sharing insights on tech, business, and development through my blog.]]></description><link>https://blog.mehul.uno</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Apr 2026 10:11:09 GMT</lastBuildDate><atom:link href="https://blog.mehul.uno/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[RAID Explained for Modern Infrastructure: From Bare Metal to VM Hosts]]></title><description><![CDATA[Why this topic still matters
RAID has been around for decades, but it is still one of the most practical storage design decisions you will make in real infrastructure. Whether you are planning a small]]></description><link>https://blog.mehul.uno/raid-explained-for-modern-infrastructure-from-bare-metal-to-vm-hosts</link><guid isPermaLink="true">https://blog.mehul.uno/raid-explained-for-modern-infrastructure-from-bare-metal-to-vm-hosts</guid><category><![CDATA[storage]]></category><category><![CDATA[raid]]></category><category><![CDATA[virtualization]]></category><category><![CDATA[storage management]]></category><category><![CDATA[vmware]]></category><category><![CDATA[hyper-v]]></category><category><![CDATA[infrastructure]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Datacenter]]></category><dc:creator><![CDATA[Mehul Minat]]></dc:creator><pubDate>Tue, 31 Mar 2026 03:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/613621ca766bb761a23802a4/b35bcb7e-1bb2-4284-a505-b697afbb5ed8.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Why this topic still matters</h2>
<p>RAID has been around for decades, but it is still one of the most practical storage design decisions you will make in real infrastructure. Whether you are planning a small application server, a NAS, a database box, or a virtualization host running multiple VMs, the RAID level you choose directly affects:</p>
<ul>
<li><p>performance</p>
</li>
<li><p>usable storage capacity</p>
</li>
<li><p>fault tolerance</p>
</li>
<li><p>rebuild risk</p>
</li>
<li><p>operational downtime</p>
</li>
</ul>
<p>The basic textbook definition is simple: <strong>RAID combines multiple disks into a single logical unit to improve speed, resilience, or both.</strong> But in real systems, the right answer is not “use the safest RAID.” The right answer is <strong>match the RAID level to the workload.</strong></p>
<hr />
<h2>What RAID actually does</h2>
<p>At a high level, RAID distributes data across multiple drives using one or more of these techniques:</p>
<ul>
<li><p><strong>Striping</strong>: data is spread across disks to improve performance</p>
</li>
<li><p><strong>Mirroring</strong>: the same data is written to more than one disk for redundancy</p>
</li>
<li><p><strong>Parity</strong>: extra calculated information is stored so lost data can be rebuilt after a disk failure</p>
</li>
</ul>
<p>That sounds abstract, so think of it this way:</p>
<ul>
<li><p><strong>RAID 0</strong> = speed first</p>
</li>
<li><p><strong>RAID 1</strong> = safety through duplication (entire mirring)</p>
</li>
<li><p><strong>RAID 5 / 6</strong> = balance of capacity and protection using parity</p>
</li>
<li><p><strong>RAID 10</strong> = striping + mirroring for strong performance and resilience</p>
</li>
</ul>
<hr />
<h2>RAID is not the same as backup</h2>
<p>This is one of the most common mistakes in infrastructure planning.</p>
<p>RAID helps you stay online when a disk fails. It does <strong>not</strong> protect you from:</p>
<ul>
<li><p>accidental deletion</p>
</li>
<li><p>file corruption</p>
</li>
<li><p>ransomware</p>
</li>
<li><p>bad application writes</p>
</li>
<li><p>VM snapshot mistakes</p>
</li>
<li><p>site-level failure</p>
</li>
<li><p>controller failure in some scenarios</p>
</li>
<li><p>human error</p>
</li>
</ul>
<div>
<div>💡</div>
<div>So treat RAID as <strong>availability and fault-tolerance tooling</strong>, not as your backup strategy.</div>
</div>

<hr />
<h2>The four things that matter when evaluating RAID</h2>
<p>Before looking at individual RAID levels, evaluate them through these four lenses.</p>
<h3>1. Reliability</h3>
<p>How many disk failures can the array tolerate before data is lost?</p>
<h3>2. Performance</h3>
<p>How well does it handle:</p>
<ul>
<li><p>sequential reads and writes</p>
</li>
<li><p>random reads and writes</p>
</li>
<li><p>mixed workloads</p>
</li>
<li><p>rebuild activity</p>
</li>
</ul>
<h3>3. Capacity</h3>
<p>How much of the raw disk space is usable after redundancy overhead?</p>
<h3>4. Recovery behavior</h3>
<p>How painful is the rebuild after a failed drive? Large arrays with parity can remain online, but rebuild times may be long and performance may drop sharply during recovery.</p>
<hr />
<h2>RAID levels in plain English</h2>
<img alt="RAID levels comparison" />

<h2>RAID 0 — Maximum speed, zero protection</h2>
<p><strong>How it works:</strong> data is striped across multiple disks with no mirror and no parity.</p>
<h3>Strengths</h3>
<ul>
<li><p>highest raw performance</p>
</li>
<li><p>full usable capacity</p>
</li>
<li><p>simple design</p>
</li>
</ul>
<h3>Weaknesses</h3>
<ul>
<li><p>one failed disk can destroy the whole array</p>
</li>
<li><p>not suitable for critical systems</p>
</li>
</ul>
<h3>Good fit</h3>
<ul>
<li><p>temporary scratch storage</p>
</li>
<li><p>cache or render workspace</p>
</li>
<li><p>non-critical high-speed data</p>
</li>
</ul>
<h3>Bad fit</h3>
<ul>
<li><p>production databases</p>
</li>
<li><p>important application data</p>
</li>
<li><p>VM hosts</p>
</li>
</ul>
<hr />
<h2>RAID 1 — Simple mirroring</h2>
<p><strong>How it works:</strong> every block is duplicated to another disk.</p>
<h3>Strengths</h3>
<ul>
<li><p>easy to understand and manage</p>
</li>
<li><p>very fast recovery after failure</p>
</li>
<li><p>strong protection for small deployments</p>
</li>
<li><p>often good for boot volumes and small critical servers</p>
</li>
</ul>
<h3>Weaknesses</h3>
<ul>
<li><p>only 50% usable capacity</p>
</li>
<li><p>write performance is not the main advantage</p>
</li>
<li><p>storage cost is high per usable TB</p>
</li>
</ul>
<h3>Good fit</h3>
<ul>
<li><p>OS volumes</p>
</li>
<li><p>small business servers</p>
</li>
<li><p>log servers</p>
</li>
<li><p>low-complexity critical data</p>
</li>
</ul>
<hr />
<h2>RAID 5 — Capacity-efficient parity</h2>
<p><strong>How it works:</strong> data is striped across disks and parity is distributed among them. The array can survive one disk failure.</p>
<h3>Strengths</h3>
<ul>
<li><p>good balance of capacity and resilience</p>
</li>
<li><p>better capacity efficiency than RAID 1 or RAID 10</p>
</li>
<li><p>common in general-purpose storage</p>
</li>
</ul>
<h3>Weaknesses</h3>
<ul>
<li><p>parity calculations slow writes</p>
</li>
<li><p>rebuilds can be stressful on large arrays</p>
</li>
<li><p>performance may drop badly during degraded mode</p>
</li>
<li><p>a second failure during rebuild can be catastrophic</p>
</li>
</ul>
<h3>Good fit</h3>
<ul>
<li><p>read-heavy workloads</p>
</li>
<li><p>file storage</p>
</li>
<li><p>environments where capacity matters more than write latency</p>
</li>
</ul>
<h3>Use carefully for</h3>
<ul>
<li><p>general VM workloads</p>
</li>
<li><p>mixed application stacks</p>
</li>
<li><p>larger disks where rebuild windows are long</p>
</li>
</ul>
<hr />
<h2>RAID 6 — Safer parity for larger arrays</h2>
<p><strong>How it works:</strong> similar to RAID 5, but stores double distributed parity and can survive two disk failures.</p>
<h3>Strengths</h3>
<ul>
<li><p>stronger protection than RAID 5</p>
</li>
<li><p>useful for larger disk pools</p>
</li>
<li><p>better choice when rebuild risk is a concern</p>
</li>
</ul>
<h3>Weaknesses</h3>
<ul>
<li><p>more parity overhead than RAID 5</p>
</li>
<li><p>slower writes than RAID 5 and RAID 10</p>
</li>
<li><p>usable capacity is reduced further</p>
</li>
</ul>
<h3>Good fit</h3>
<ul>
<li><p>large-capacity storage arrays</p>
</li>
<li><p>backup repositories</p>
</li>
<li><p>archive and file-serving systems</p>
</li>
<li><p>environments where availability matters more than peak write speed</p>
</li>
</ul>
<hr />
<h2>RAID 10 — The practical favorite for performance-sensitive systems</h2>
<p><strong>How it works:</strong> mirrored pairs are created first, then data is striped across those pairs.</p>
<h3>Strengths</h3>
<ul>
<li><p>excellent random read and write performance</p>
</li>
<li><p>strong fit for database and transactional workloads</p>
</li>
<li><p>faster rebuild behavior than parity-heavy arrays</p>
</li>
<li><p>widely preferred for virtualization and latency-sensitive workloads</p>
</li>
</ul>
<h3>Weaknesses</h3>
<ul>
<li><p>50% capacity overhead</p>
</li>
<li><p>more expensive than RAID 5 or 6</p>
</li>
<li><p>requires at least 4 disks</p>
</li>
</ul>
<h3>Good fit</h3>
<ul>
<li><p>databases</p>
</li>
<li><p>high-write applications</p>
</li>
<li><p>busy VM hosts</p>
</li>
<li><p>mixed production infrastructure</p>
</li>
</ul>
<hr />
<h2>RAID comparison table</h2>
<table>
<thead>
<tr>
<th>RAID Level</th>
<th>Min Disks</th>
<th>Fault Tolerance</th>
<th>Usable Capacity</th>
<th>Performance Profile</th>
<th>Best For</th>
</tr>
</thead>
<tbody><tr>
<td>RAID 0</td>
<td>2</td>
<td>0 disks</td>
<td>100%</td>
<td>Excellent reads/writes</td>
<td>Scratch, temporary data</td>
</tr>
<tr>
<td>RAID 1</td>
<td>2</td>
<td>1 disk per mirror pair</td>
<td>50%</td>
<td>Strong reads, simple recovery</td>
<td>OS volumes, small critical servers</td>
</tr>
<tr>
<td>RAID 5</td>
<td>3</td>
<td>1 disk</td>
<td>(N-1) disks</td>
<td>Good reads, slower writes</td>
<td>Read-heavy storage, general file data</td>
</tr>
<tr>
<td>RAID 6</td>
<td>4</td>
<td>2 disks</td>
<td>(N-2) disks</td>
<td>Good reads, slower writes than RAID 5</td>
<td>Large arrays, backups, safer parity</td>
</tr>
<tr>
<td>RAID 10</td>
<td>4</td>
<td>Depends on mirror-pair failures</td>
<td>50%</td>
<td>Excellent mixed I/O</td>
<td>Databases, production apps, VM hosts</td>
</tr>
</tbody></table>
<hr />
<h2>Why RAID decisions matter even more for VM hosts</h2>
<img src="REPLACE_WITH_HASHNODE_VM_IMAGE_URL" alt="RAID for VMs" style="display:block;margin:0 auto" />

<p>This is the part many introductory articles skip.</p>
<p>A physical server usually runs one operating system and one main workload. A virtualization host is different. It stacks many workloads on the same storage backend:</p>
<ul>
<li><p>web servers</p>
</li>
<li><p>databases</p>
</li>
<li><p>file servers</p>
</li>
<li><p>application servers</p>
</li>
<li><p>monitoring tools</p>
</li>
<li><p>backup proxies</p>
</li>
<li><p>domain controllers</p>
</li>
</ul>
<p>That means one storage issue can affect <strong>many VMs at once</strong>.</p>
<h3>What changes when you run VMs?</h3>
<h4>1. Random I/O becomes more important</h4>
<p>Even if each guest is small, many VMs together create a noisy mixed workload. Random reads and writes, bursty writes, metadata activity, guest paging, and application logs all pile onto the same datastore.</p>
<p>That is why a RAID level that looks “fine on paper” may feel slow in a VM host.</p>
<h4>2. Latency matters more than headline throughput</h4>
<p>For virtualization, low latency often matters more than peak MB/s. A parity-based array might have enough raw bandwidth, but still feel sluggish under write-heavy or mixed I/O.</p>
<h4>3. Rebuild periods are more painful</h4>
<p>When a parity array rebuilds, the whole storage pool stays busy. On a virtualization host, that means many VMs can experience degraded performance at the same time.</p>
<h4>4. Snapshots and dynamic growth add overhead</h4>
<p>Snapshots, differencing disks, and dynamically growing virtual disks can increase metadata work and I/O overhead. In busy hosts, these layers magnify storage bottlenecks.</p>
<hr />
<h2>Practical RAID guidance for VM environments</h2>
<h3>RAID 10 is usually the safest performance choice</h3>
<p>If your host runs:</p>
<ul>
<li><p>databases</p>
</li>
<li><p>ERP or CRM systems</p>
</li>
<li><p>application servers</p>
</li>
<li><p>mixed business VMs / NMS</p>
</li>
<li><p>write-heavy workloads</p>
</li>
</ul>
<p>then RAID 10 is usually the cleanest answer. It trades capacity for lower write penalty, better random I/O, and simpler rebuild behavior.</p>
<h3>RAID 5 can work, but know the trade-off</h3>
<p>RAID 5 may still be acceptable when:</p>
<ul>
<li><p>the environment is small</p>
</li>
<li><p>workloads are mostly read-heavy</p>
</li>
<li><p>capacity budget matters more than peak write performance</p>
</li>
<li><p>controller cache and SSD performance are strong</p>
</li>
</ul>
<p>But it is often not the first choice for busy, multi-VM production hosts.</p>
<h3>RAID 6 is stronger for bigger pools</h3>
<p>If you are working with larger capacity drives or bigger arrays and want better protection during rebuilds, RAID 6 is safer than RAID 5. The trade-off is heavier write overhead.</p>
<h3>RAID 1 is fine for small hosts or boot volumes</h3>
<p>A small two-disk mirror can still be perfectly reasonable for:</p>
<ul>
<li><p>hypervisor boot drives</p>
</li>
<li><p>labs</p>
</li>
<li><p>edge systems</p>
</li>
<li><p>lightweight branch deployments</p>
</li>
</ul>
<h3>RAID 0 should not be used for production VM datastores</h3>
<p>The performance looks attractive, but the blast radius is too high. One disk failure can take down every VM on that datastore.</p>
<hr />
<h2>VM-specific best practices beyond RAID level</h2>
<p>The RAID level is only one part of the answer. For VM infrastructure, also pay attention to the storage stack above it.</p>
<h3>Use the right virtual disk/controller format</h3>
<p>For Hyper-V environments, Microsoft recommends:</p>
<ul>
<li><p>SCSI for non-OS disks</p>
</li>
<li><p>VHDX instead of VHD on modern deployments</p>
</li>
<li><p>fixed VHDX when you need the best resiliency and performance</p>
</li>
</ul>
<h3>Keep snapshot chains short</h3>
<p>Long snapshot or differencing chains add lookup overhead and can hurt performance, especially for I/O-intensive VMs.</p>
<h3>Use storage QoS where available</h3>
<p>In shared environments, one “noisy neighbor” VM can consume disproportionate I/O. Storage QoS helps isolate workloads and preserve consistency.</p>
<h3>Watch alignment, sector size and block sizing</h3>
<p>Poor alignment or mismatched sector assumptions can quietly damage storage performance. This is especially important in virtual disk layers.</p>
<h3>Separate workload tiers when possible</h3>
<p>If budget allows, separate:</p>
<ul>
<li><p>boot volumes</p>
</li>
<li><p>production VM datastores</p>
</li>
<li><p>backup targets</p>
</li>
<li><p>archive workloads</p>
</li>
</ul>
<p>Not every workload needs the same RAID level.</p>
<hr />
<h2>Recommended RAID choices by use case</h2>
<table>
<thead>
<tr>
<th>Scenario</th>
<th>Recommended RAID</th>
<th>Why</th>
</tr>
</thead>
<tbody><tr>
<td>Hypervisor boot volume</td>
<td>RAID 1</td>
<td>Simple, resilient, cost-effective</td>
</tr>
<tr>
<td>Small lab VM host</td>
<td>RAID 1 or RAID 10</td>
<td>Enough protection with low complexity</td>
</tr>
<tr>
<td>Busy production VM host</td>
<td>RAID 10</td>
<td>Best overall mixed I/O behavior</td>
</tr>
<tr>
<td>General-purpose file server</td>
<td>RAID 5 or RAID 6</td>
<td>Better usable capacity</td>
</tr>
<tr>
<td>Large backup repository</td>
<td>RAID 6</td>
<td>Better protection for large arrays</td>
</tr>
<tr>
<td>Database server</td>
<td>RAID 10</td>
<td>Strong random write performance</td>
</tr>
<tr>
<td>Temporary processing / scratch</td>
<td>RAID 0</td>
<td>Only if data loss is acceptable</td>
</tr>
</tbody></table>
<hr />
<h2>A simple decision framework</h2>
<p>If you are unsure, use this logic:</p>
<h3>Choose RAID 10 when:</h3>
<ul>
<li><p>performance matters</p>
</li>
<li><p>workloads are mixed or write-heavy</p>
</li>
<li><p>VMs are important</p>
</li>
<li><p>rebuild risk needs to be minimized</p>
</li>
</ul>
<h3>Choose RAID 5 when:</h3>
<ul>
<li><p>capacity efficiency matters</p>
</li>
<li><p>workloads are more read-heavy</p>
</li>
<li><p>the environment is not extremely latency-sensitive</p>
</li>
</ul>
<h3>Choose RAID 6 when:</h3>
<ul>
<li><p>disks are large</p>
</li>
<li><p>rebuild risk worries you</p>
</li>
<li><p>the array stores important bulk data</p>
</li>
<li><p>you can tolerate slower writes</p>
</li>
</ul>
<h3>Choose RAID 1 when:</h3>
<ul>
<li><p>simplicity matters</p>
</li>
<li><p>the setup is small</p>
</li>
<li><p>you need a reliable mirror</p>
</li>
</ul>
<h3>Avoid RAID 0 when:</h3>
<ul>
<li>the data matters at all</li>
</ul>
<hr />
<h2>Final takeaway</h2>
<p>RAID is not just a storage chapter from a DBMS textbook. It is a live infrastructure decision that affects reliability, performance, and recovery behavior.</p>
<p>For modern systems, the best RAID choice depends on the workload:</p>
<ul>
<li><p><strong>RAID 0</strong> for speed-only temporary data</p>
</li>
<li><p><strong>RAID 1</strong> for simple redundancy</p>
</li>
<li><p><strong>RAID 5</strong> for balanced capacity in lighter workloads</p>
</li>
<li><p><strong>RAID 6</strong> for larger, safer parity arrays</p>
</li>
<li><p><strong>RAID 10</strong> for performance-sensitive and VM-heavy production systems</p>
</li>
</ul>
<p>If your environment runs multiple virtual machines, do not judge RAID only by raw capacity. Judge it by <strong>latency, rebuild behavior, and the number of workloads sharing the same backend</strong>.</p>
<p>That is usually where the real answer becomes clear.</p>
<hr />
<h2>References</h2>
<ul>
<li><p>VMware: vSphere 9.0 Performance Best Practices</p>
</li>
<li><p>Microsoft Learn: Hyper-V storage I/O performance</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[CI/CD with Angular & Jenkins]]></title><description><![CDATA[This guide presupposes the presence of an operational Jenkins instance on your Linux server, complete with a valid domain (not localhost). Additionally, it assumes that you have both GitLab and NodeJS plugins installed. Familiarity with the Angular f...]]></description><link>https://blog.mehul.uno/cicd-with-angular-jenkins</link><guid isPermaLink="true">https://blog.mehul.uno/cicd-with-angular-jenkins</guid><category><![CDATA[Jenkins]]></category><dc:creator><![CDATA[Mehul Minat]]></dc:creator><pubDate>Mon, 14 Aug 2023 18:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1696530189338/67a11085-5dec-493d-90ae-1952a82aaf81.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This guide presupposes the presence of an operational Jenkins instance on your Linux server, complete with a valid domain (not <a target="_blank" href="http://localhost">localhost</a>). Additionally, it assumes that you have both GitLab and NodeJS plugins installed. Familiarity with the Angular framework is also presumed.</p>
<p>To set up Jenkins, ensure the installation of the GitLab and NodeJS plugins. This article simplifies the automation process by utilizing basic shell commands for running tests and deploying applications to production.</p>
<h2 id="heading-configuring-gitlab-and-jenkins"><strong>Configuring Gitlab and Jenkins</strong></h2>
<h3 id="heading-jenkins-access-rights-to-gitlab"><strong>Jenkins: Access Rights to GitLab</strong></h3>
<p>To integrate GitLab with Jenkins, it's necessary to create an access token in GitLab. This can be achieved by <strong>User menu &gt; Settings &gt; Access tokens</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696543213075/e0444e5e-9c7b-44eb-930d-5fd007912a0e.png" alt class="image--center mx-auto" /></p>
<p>To set up the connection between Jenkins and GitLab, configure GitLab in Jenkins by adding the recently generated token. In Jenkins, navigate to <strong>Manage Jenkins &gt; Configure system</strong>. Find the GitLab section in the configuration settings.</p>
<p><img src="https://cdn.shortpixel.ai/spai/w_738+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/Manage-Jenkins-GitLab-section.jpg" alt class="image--center mx-auto" /></p>
<p>To include a previously generated token, click on "<strong>Add</strong>" in the Credentials input and select Jenkins. Within the credentials dialogue box, opt for <strong>GitLab API token</strong> from the Kind input, and paste the token obtained from GitLab into the API token input field.</p>
<p><img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/Jenkins-Credentials.jpg" alt class="image--center mx-auto" /></p>
<h3 id="heading-jenkins-configure-nodejsinstaller"><strong>Jenkins: Configure NodeJSInstaller</strong></h3>
<p>To enable the execution of npm scripts, it's essential to set up NodeJSInstaller. Navigate to <strong>Manage Jenkins &gt; Global Tool Configuration &gt; NodeJS installations.</strong></p>
<p><img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/Jenkins-Configure-NodeJSInstaller.jpg" alt class="image--center mx-auto" /></p>
<h3 id="heading-jenkins-create-ci-build-for-angular"><strong>Jenkins: Create CI build for Angular</strong></h3>
<p>To facilitate the execution of Angular tests and code style checks in Jenkins for the created merge request in GitLab, follow these steps:</p>
<ol>
<li><p>Select the New item link on the Jenkins dashboard.</p>
</li>
<li><p>Provide a name for the job and opt for a Freestyle project.</p>
<p> <img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/ci-build-for-angular.jpg" alt class="image--center mx-auto" /></p>
</li>
<li><p>Select the GitLab Connection recently established from the GitLab Connection segment.</p>
<p> <img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/GitLab-Connection.jpg" alt class="image--center mx-auto" /></p>
</li>
<li><p>Choose Git as your source code management. Enter your repository URL. Create new credentials on Jenkins. These credentials are for cloning the project. You use them to log in to Gitlab.</p>
<p> <img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/Source-Code-Management.jpg" alt class="image--center mx-auto" /></p>
</li>
<li><p>Subsequently, set up build triggers to specify the GitLab event that should initiate a build. In this specific instance, the angular-ci-build will be activated upon the creation of a new merge request.</p>
<p> <img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/Angular-ci-build.jpg" alt class="image--center mx-auto" /></p>
<p> In this step, return to GitLab and establish a hook that will initiate this build by navigating to <strong>Settings &gt; Integrations</strong>. Copy the URL supplied by Jenkins, insert it into the project hook form, and conclude by clicking on "<em>Add webhook</em>."</p>
<p> <img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/GitLab-webhook.jpg" alt class="image--center mx-auto" /></p>
</li>
<li><p>Specify the configured NodeJsInstaller in the global settings to enable the execution of npm commands.</p>
<p> <img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/NodeJsInstaller-npm-commands.jpg" alt class="image--center mx-auto" /></p>
</li>
<li><p>Lastly, within the Build section, opt for "<strong>Add build step</strong>" and then select "<strong>Execute shell</strong>." Craft shell scripts to assess the code of the Angular app and execute tests.</p>
<p> <img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/Build-step.jpg" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>Click Save, and the setup should be complete. At this stage, everything should function as intended.</p>
<p>Upon initiating a new merge request, GitLab is expected to activate angular-ci-build on Jenkins, and on the respective merge request page, you should observe a pending status.</p>
<p>Once Jenkins completes its process, the status on GitLab will be automatically updated. The color of the merge button will vary based on whether the build was successful or not.</p>
<h3 id="heading-jenkins-create-cd-build-for-angular"><strong>Jenkins: Create CD Build for Angular</strong></h3>
<p>To enable the deployment of Angular to another Linux machine, follow these steps:</p>
<p>Opt for a distinct configuration for deployment. This build will be triggered upon the acceptance of a merge request.</p>
<p><img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/Angular-ci-build-1.jpg" alt class="image--center mx-auto" /></p>
<p>Similar to the process for the CI build, establish a new GitLab hook that will invoke the Jenkins build endpoint.</p>
<p><img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/GitLab-hook.jpg" alt class="image--center mx-auto" /></p>
<p>This step mirrors the procedure in CI; we must specify the globally configured NodeJSInstaller.</p>
<p>In this step, there's a divergence from CI; this time, there's no need to conduct testing and linting checks. The focus is solely on building the application and transferring it to another machine using SSH.</p>
<p><img src="https://cdn.shortpixel.ai/spai/w_658+q_glossy+ret_img+to_webp/serengetitech.com/wp-content/uploads/2020/12/Build-the-application.jpg" alt class="image--center mx-auto" /></p>
<p>To facilitate the SSH process, as illustrated in the example, it's imperative to generate a private and public key pair for the Jenkins user on the machine where Jenkins is operational. Retain the private key on the Jenkins machine, and transfer the public key to the remote machine.</p>
<p>Utilizing the SCP command, copy the build to the remote machine. However, it's noteworthy that Jenkins is restricted to placing it only in the user folder. In the final step, access the remote machine via SSH and relocate the files. (In this case to <code>/var/www/html</code>)</p>
<p><em>Voila</em>, the application is deployed to the production server when the merge request is accepted through Jenkins.</p>
<h2 id="heading-angular-karma-unit-test-runner-configuration"><strong>Angular: Karma Unit Test Runner Configuration</strong></h2>
<p>To execute Angular tests on Jenkins, specific sections of the karma.conf file needs configuration. The following is the setup that introduces a customized launcher for running ChromeHeadless.</p>
<pre><code class="lang-yaml"><span class="hljs-string">module.exports</span> <span class="hljs-string">=</span> <span class="hljs-string">function(config)</span> {
  <span class="hljs-string">config.set(</span>{
    <span class="hljs-attr">basePath:</span> <span class="hljs-string">""</span>,
    <span class="hljs-attr">frameworks:</span> [<span class="hljs-string">"jasmine"</span>, <span class="hljs-string">"@angular-devkit/build-angular"</span>],
    <span class="hljs-attr">plugins:</span> [
      <span class="hljs-string">require("karma-jasmine")</span>,
      <span class="hljs-string">require("karma-chrome-launcher")</span>,
      <span class="hljs-string">require("karma-jasmine-html-reporter")</span>,
      <span class="hljs-string">require("karma-coverage-istanbul-reporter")</span>,
      <span class="hljs-string">require("@angular-devkit/build-angular/plugins/karma")</span>
    ],
    <span class="hljs-attr">client:</span> {
      <span class="hljs-attr">clearContext:</span> <span class="hljs-literal">false</span> <span class="hljs-string">//</span> <span class="hljs-string">leave</span> <span class="hljs-string">Jasmine</span> <span class="hljs-string">Spec</span> <span class="hljs-string">Runner</span> <span class="hljs-string">output</span> <span class="hljs-string">visible</span> <span class="hljs-string">in</span> <span class="hljs-string">browser</span>
    },
    <span class="hljs-attr">coverageIstanbulReporter:</span> {
      <span class="hljs-attr">dir:</span> <span class="hljs-string">require("path").join(__dirname</span>, <span class="hljs-string">"../coverage/jenkins-test-app"</span><span class="hljs-string">)</span>,
      <span class="hljs-attr">reports:</span> [<span class="hljs-string">"html"</span>, <span class="hljs-string">"lcovonly"</span>, <span class="hljs-string">"text-summary"</span>],
      <span class="hljs-attr">fixWebpackSourcePaths:</span> <span class="hljs-literal">true</span>
    },
    <span class="hljs-attr">reporters:</span> [<span class="hljs-string">"progress"</span>, <span class="hljs-string">"kjhtml"</span>],
    <span class="hljs-attr">port:</span> <span class="hljs-number">9876</span>,
    <span class="hljs-attr">colors:</span> <span class="hljs-literal">true</span>,
    <span class="hljs-attr">logLevel:</span> <span class="hljs-string">config.LOG_INFO</span>,
    <span class="hljs-attr">autoWatch:</span> <span class="hljs-literal">true</span>,
    <span class="hljs-attr">browsers:</span> [<span class="hljs-string">"Chrome"</span>, <span class="hljs-string">"ChromeHeadless"</span>],
    <span class="hljs-attr">singleRun:</span> <span class="hljs-literal">false</span>,
    <span class="hljs-attr">restartOnFileChange:</span> <span class="hljs-literal">true</span>,
    <span class="hljs-attr">customLaunchers:</span> {
      <span class="hljs-attr">ChromeHeadless:</span> {
        <span class="hljs-attr">base:</span> <span class="hljs-string">"Chrome"</span>,
        <span class="hljs-attr">flags:</span> [
          <span class="hljs-string">"--headless"</span>,
          <span class="hljs-string">"--disable-gpu"</span>,
          <span class="hljs-string">"--no-sandbox"</span>,
          <span class="hljs-string">"--remote-debugging-port=9222"</span>
        ],

      },
    }
  }<span class="hljs-string">);</span>
}<span class="hljs-string">;</span>
</code></pre>
<p>We can straightforwardly save our command in the package.json scripts section.</p>
<p>On Jenkins, we would execute our tests using the command <em>npm run test:ci.</em></p>
<pre><code class="lang-yaml"><span class="hljs-attr">"scripts":</span> {
    <span class="hljs-attr">"ng":</span> <span class="hljs-string">"ng"</span>,
    <span class="hljs-attr">"start":</span> <span class="hljs-string">"ng serve"</span>,
    <span class="hljs-attr">"build":</span> <span class="hljs-string">"ng build"</span>,
    <span class="hljs-attr">"test":</span> <span class="hljs-string">"ng test"</span>,
    <span class="hljs-attr">"test:ci":</span> <span class="hljs-string">"ng test --browsers=ChromeHeadless --watch=false"</span>,
    <span class="hljs-attr">"lint":</span> <span class="hljs-string">"ng lint"</span>,
    <span class="hljs-attr">"e2e":</span> <span class="hljs-string">"ng e2e"</span>
  }<span class="hljs-string">,</span>
</code></pre>
<p>I hope you found pleasure in exploring this article and that it served as a useful resource in your efforts to automate Angular deployment and testing.</p>
]]></content:encoded></item><item><title><![CDATA[Boot Sector Virus]]></title><description><![CDATA[Abstract
The idea of a program that replicates itself may have originated in the early days of computing, when programmers amused themselves by trying to write the shortest program that prints itself. In today’s world every organizations and individu...]]></description><link>https://blog.mehul.uno/boot-sector-virus</link><guid isPermaLink="true">https://blog.mehul.uno/boot-sector-virus</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[viruses]]></category><category><![CDATA[Case Study]]></category><dc:creator><![CDATA[Mehul Minat]]></dc:creator><pubDate>Sat, 07 Jan 2023 18:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1681062991850/90351d6e-0505-4c30-8816-d21fa55516e8.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-abstract"><strong>Abstract</strong></h3>
<p>The idea of a program that replicates itself may have originated in the early days of computing, when programmers amused themselves by trying to write the shortest program that prints itself. In today’s world every organizations and individuals using computer and internet need to have a wide-ranging virus protection policy to combat the growing threats of computer viruses by means of anti-virus. This is due to the fact that a computer virus may corrupt or delete data on a computer. Computer viruses also spread by using downloads on the Internet. Computer viruses can be hidden in pirated software or in other files or programs that you may download. Boot sector viruses take advantage of the boot process of personal computers (PCs). Because most computers do not contain an operating system (OS) in their read-only memory (ROM), they need to load the system from somewhere else, such as from a disk or from the network (via a network adapter).</p>
<blockquote>
<p><strong>Keywords</strong>: BSV (Boot Sector Virus), FAT(File Allocation Table), OS(Operating System), WOS(Windows Operating System), MBR(Master Boot Record), Bootstrap Loader, RC(Recovery Console), BSOD(Blue Screen of Death), PBS(Partition Boot Sector).</p>
</blockquote>
<h3 id="heading-introduction"><strong>INTRODUCTION</strong></h3>
<p>A biological virus (from the Latin for poison) is a shell filled with genetic material that it injects into a living cell, thereby infecting it. The cell then starts manufacturing copies of the virus. A computer virus behaves similarly. A computer virus is a malware, when executed, try to replicate itself into other executable code; when it succeeds, the code is said to be infected. The infected code, when run, can infect new code in turn. The self-replication into existing executable code is the key defining characteristic of virus. So it is the program that can copy itself and infects a computer without permission or knowledge of the user. In this paper we have discussed only about a special type of virus known as the BOOT SECTOR Virus. Before going in depth, the working definition of virus should be as under:</p>
<ol>
<li><p>It is capable of propagating between computers on a network. This is the most important attribute of a computer virus and it is what distinguishes a virus from other types of malicious software.</p>
</li>
<li><p>It installs itself in a host computer without the owner’s knowledge or consent.</p>
</li>
<li><p>It has the potential to damage software on the host by altering or deleting files.</p>
</li>
<li><p>It can prevent legitimate users from using some or all of the computer’s resources.</p>
</li>
<li><p>In general it embeds itself in an executable file (its host), such that when the file is executed, the virus is also executed. The virus is hidden inside the host.</p>
</li>
</ol>
<h3 id="heading-boot-sector-viruses"><strong>Boot Sector Viruses</strong></h3>
<p>A boot sector virus (BSV) is a computer virus that resides in the boot sector of a disk. Each time the disk is mounted, the boot sector is read and executed, causing the virus to be executed. The boot sector of a disk is normally the first sector of the disk, as its format depends on the operating system. Often, the boot sector occupies more than one disk sector. It may also include a table with information about the disk itself (such as maker, date of manufacture, model and serial numbers, size and number of tracks) and on the various partitions of the disk. The directory of a disk reflects the file structure of the disk and provides the user with all the information that’s normally needed about the files. However, in addition to the files listed in the directory, there is at least one program that’s not listed there. It resides in the boot sector of the disk and this is the program executed each time the disk is mounted and is responsible for OS Loading further.</p>
<h3 id="heading-boot-sector-loader"><strong>Boot Sector Loader</strong></h3>
<p>A computer operates by executing a program. A computer without a program can do nothing. This implies that a newly-bought computer must have a program built into it. This program is called the bootstrap loader and is stored in read-only memory (ROM), which is nonvolatile (it keeps its content when the power is turned off). Each time the computer is booted (started or restarted), it executes the bootstrap loader. This short program reads the first part (the kernel) of the operating system from a disk or a CD and starts it. The kernel then reads the remainder of the operating system and stores it in memory.</p>
<p>The point is that the bootstrap loader is stored in ROM and is difficult and time consuming to replace. It should therefore be general and be able to load any version of any operating system—past, present, and future—from any bootable device. Currently, PCs run Windows or Linux OSs and each of these goes through newer versions all the time. Another complication arises because a bootable volume may be divided into several partitions, each of which may have a different operating system. Thus, the bootstrap loader should not be limited to loading just one type or one version of the operating system. The bootstrap loader starts by looking for a bootable volume (disk or CD) and it follows simple rules to determine which bootable volume to select when it finds more than one. The bootstrap loader then reads the volume’s master boot sector, loads it in memory, and executes a jump instruction to its beginning of boot sector. The boot sector contains a short program called the master boot record (MBR). This program knows about the various partitions of the volume and how to read the boot sector of each. It locates all the operating systems in the various partitions of the volume and lists them for the user to select one. Once a specific operating system has been selected on partition P, the MBR reads the partition boot sector (PBS) of P and executes it. The short program of the PBS reads and loads the kernel of the operating system, and it loads the rest.</p>
<p>The best place for a virus is in the bootstrap loader; because this program is the very first one to execute but it is difficult since this loader is made in a factory and its content is permanent (modern bootstrap loaders have firmware and can be modified when new versions of the operating system are released). The next best place for a virus is the MBR or one of the PBSs. A virus that’s hidden in these locations is called a boot sector infector or BSI. The precise organization of a disk depends on the operating system. A disk may have one bit in its boot sector informing the bootstrap loader or other operating system routines whether the disk is bootable or not. Alternatively, a nonbootable disk may have a program in its boot sector and the operating system may have to execute this program to find out whether the disk is bootable. In the latter case, a virus can hide in the boot sector of nonbootable disks. An important point to consider is that the virus doesn’t have to be physically located in the boot sector. The boot sector contains a loader program that reads other operating system routines and stores them in memory. It is therefore enough for the virus writer to write the virus as a file on the bootable disk and to modify the loader to load the virus from the disk while it loads other programs. Even though the virus is written on the disk, it may not appear in the disk directory. It may also be written in an extra track, especially formatted on the infected disk. Disk utilities and anti-virus software read the number of tracks from a table in the disk itself, and therefore know how many tracks to read and examine. An extra, undocumented track, either close to the edge of the disk or between existing tracks, may be an ideal place to hide a virus.</p>
<blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1681063748481/2638b6c3-43fc-4cc5-97fb-864ab2c05ca4.jpeg" alt class="image--center mx-auto" /></p>
<p>Figure 1 illustrates two variations on this technique. Part (a) of the figure shows a bootstrap loader located in track 0, sector 0 of a disk. Part (b) shows how a virus may move the original loader to a new, extra track and install itself instead of the loader. Part (c) shows another bootstrap loader that’s going to be disturbed a little (in part d) by the incoming BSV virus. The virus installs itself in the new track. It cuts a small part (<em>x</em>) of the loader, moves it to the end of the virus, and replaces it with a JUMP to the start of the virus. When the virus completes its execution, part <em>x</em> is executed, and then control is transferred to the bootstrap, to finish its execution.</p>
</blockquote>
<h3 id="heading-implications-of-boot-sector-virus-on-windows-operating-system"><strong>IMPLICATIONS OF BOOT SECTOR VIRUS ON WINDOWS OPERATING SYSTEM</strong></h3>
<p>Boot sector viruses gain complete control of the master boot record or the DOS boot sector by replacing the operating system contents with that of its own. This allows the virus to spread fast and cause damages like to redirect disk reads, moving or damaging the master boot record to another location which further results the system to crash. The hard disk drive is partitioned into logical partitions. Each drive consists of four logical parts--Boot Sector, File Allocation Table (FAT), Directory and Data space. Of these, the Boot Sector contains information about how the disk is organized. That is, how many sides does it contain, how many tracks are there on each side, how many sectors are there per track, how many bytes are there per sector, etc. The files and the directories are stored in the Data Space. The Directory contains information about the files like its attributes, name, size, etc. The FAT contains information about where the files and directories are stored in the data space i.e. it is the index of all the files on the drive. When a file/directory is created on the disk, instead of allocating a sector for it, a group of sectors is allocated. This group of sectors is often known as a cluster. How many sectors together form one cluster depends upon the capacity of the disk. So, FAT contains information about the space used by each individual file, the unused disk space and the space that is unusable due to defects in the disk.</p>
<p>Boot sector virus spreads in the WOS by either by infecting the Master Boot Record (MBR) so that system is unable to boot itself. Another type of boot sector virus makes copies of itself to 3 blocks on a floppy diskette or hard drive and these blocks are marked bad in the File Allocation Table (FAT), so that they cannot be overwritten. Being so destructive in nature, virus completely destroys the information or data present on the hard disk. After the virus has encrypted the entire disk, the only way to get rid of this virus is to re-format the system. But, formatting removes all the data from the hard drive, which ultimately results in data loss.</p>
<p>One may receive a "Stop 0x0000007B" error message (often known as Blue Screen Of Death or BSOD), Figure(2), if computer is infected with a boot-sector virus which means "inaccessible boot device": Windows is not able to read from the device it is supposed to be booting from. That device in general be hard drive - but if one getting this during Windows installation, it could be something wrong.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1681063977352/4ca21e44-cc1d-447b-9652-536079244e69.jpeg" alt class="image--center mx-auto" /></p>
<p>Examples: Michelangelo, Disk Killer or Ogre, Brain, W32/ (A boot-sector virus infects various versions of the 32-bit Windows operating system).</p>
<p>On the other hand if everything is well in WOS then Loader with help of assembly instruction dw 0xAA55 simply puts the hexadecimal word "0xAA55" in memory, and org 0x7C00 puts the current memory address at 0x7c00, so any instruction after this will start at 0x7c00(assuming 16-bit storage) to load WOS.</p>
<p>(The hex value 0xAA55 is used as a key signature for boot sector, that mark it the active partition to load the OS startup code in memory to load boot sector in memory. dw 0xAA55 is the signature found at the end of the boot sector .The value 0x7C00 is the memory location where the boot sector code is loaded by the BIOS to execute the code.)</p>
<h3 id="heading-protection"><strong>Protection:</strong></h3>
<ol>
<li>To protect WOS from any type of virus infection and possibly recover is to have anti-virus software on computer.</li>
</ol>
<p>System using versions earlier to Windows XP use <strong>fdisk /mbr</strong> command, to fix the boot sector error, in MS-DOS during booting process. It should be noted that in WOS repartitioning with Fdisk does not rewrite the MBR and can only create re -partitions. But by using additional parameter called <strong>/mbr</strong> makes to write the master boot record to the hard disk without altering the partition table information using BIOS calls.</p>
<p>From Win XP onwards, where NTLDR is a boot loader, essential disk maintenance tools have been moved to the Recovery Console, which is available when one boot it from the original XP CD. Once accessed in the RC, use the command FIXMBR, which is the equivalent of fdisk /mbr (it writes a fresh copy of the MBR).</p>
<h3 id="heading-problems-in-bsv-detection"><strong>PROBLEMS IN BSV DETECTION</strong></h3>
<p>The possible problems in locating the BSVs are as under:</p>
<ol>
<li><p>BSV is so hazardous that it can exploit interrupts to hide itself and also can modify one of them. The task to detect it is too difficult. Suppose somebody wants to locate this virus on the disk. Then he has to read the boot sectors and examine them, but the (memory resident) virus can (and normally does) defeat that. The virus modifies some of the interrupt routines and also the part of the operating system responsible for disk input/output (in the old DOS operating system this part was called BIOS). If this is done properly, the virus is invoked by the BIOS routines each time a program wants to read a sector. The virus then examines the read command, and if the command wants to read a boot sector (sector 0 of track 0), the virus changes the disk address of the read operation from (0<em>,</em> 0) to where it has hidden the original boot sector. An associated problem faced by this type of virus is secondary infection. Before infecting a new disk, the virus has to make sure the disk hasn’t been infected already..Thus, the virus must contain a unique fingerprint or signature.</p>
</li>
<li><p>The virus can hide the original boot sector in one of the free sectors (if any) on the disk. The virus uses some of the free sectors, removes them from the chain, and declares them bad. An alternative is to create an extra cylinder on the disk. The capacity of a cylinder is larger than what a virus needs and its presence cannot be detected by the operating system because it receives the number of cylinders from the disk’s header. Modern hard drives have large capacities in a small volume, so any added cylinder would be too close to the edge of the disk and would be unreliable. Older disks, both hard and floppy, were more amenable to this technique. It takes an experienced virus detective to foil such a sophisticated virus.</p>
</li>
<li><p><strong>The BSV should establishes itself in memory (if it is not located there already) by modifying one or more interrupt-handling routines, especially the routine that is called when a removable disk is inserted. This way the virus will be able to infect the boot sectors of new disks inserted into the computer.</strong></p>
</li>
<li><p>The computer owner can prepare in advance a copy of the boot sector, and later compare it to the boot sector of a suspicious disk. However, a well-designed virus can often defeat this simple check because of the way disks are read and checked.</p>
</li>
<li><p>Furthermore in order to read the boot sector and print it, display it, or compare it to a list of instructions, a program is needed. The program should work by invoking operating system routines (sometimes called basic input/output system or BIOS) and the point is that the program can able to modify these routines. Specifically, the routines can be modified such that when they are asked to read the boot sector, they will provide a copy of the original, non-infected sector that had been hidden on the disk by the virus. The security expert can take the suspect disk to another computer and try to read the boot sector there, but the virus may be executed from the boot sector (and modify the BIOS routines) as soon as the disk is inserted into the new computer. The disk should therefore be read in a different type of computer or in the same platform but under an operating system that the virus doesn’t recognize. An alternative is for a security expert to write low-level disk routines, similar to the ones used by BIOS, and read the disk with these routines.</p>
</li>
</ol>
<h3 id="heading-conclusions"><strong>CONCLUSIONS</strong></h3>
<p>A boot sector virus embeds itself in the boot sector of a disk (floppy, zip, or hard disk) or a CD, and becomes memory resident when the computer is booted from the disk (if the disk is bootable) or when the disk is inserted into a disk drive and is read. The virus stays in memory while the computer is on, so it can infect any disk mounted in the computer. And this is the fact that this virus that it is easy to detect, because it (or at least its first part) is located at the same position on every infected disk. Furthermore, since BSV can infect hard disks so one has to avoid its propagation by using infected removable disk (a floppy disk, a zip cartridge, or other removable media) from computer to computer. Some BSV itself does not locate themselves in the boot sector but hides elsewhere (generally in extra track) on the disk and be loaded by the loader in the boot sector when the disk is mounted. Such a virus modifies the boot sector, but only in an insignificant way, by adding a few instructions that load the virus. The virus itself may be hidden in an extra track or in unused disk space but in this case the virus may be erased when a new file is written on the disk.</p>
<p>Most programs (executable files) never change their content. The program does not modify itself when executed. The same is true for the boot sectors on disk drives. Such sectors contain programs that load files from the disk, and those programs are always the same (they change only when new versions of the operating system are installed). It is therefore relatively easy to write an anti-virus program that will scan all the executable files on a disk, store their sizes in a table, and use this table in future executions to locate those executable files whose sizes have changed. This anti-virus program should be run periodically, to notify the user of any changes. In WOS, DOS 6.22 Msav.exe will clean the MBR and RAM of the computer. However Mac OS and Linux both have safeguard built in to protect you from these problems.</p>
<h2 id="heading-authors">Authors</h2>
<blockquote>
<ul>
<li><p><a class="user-mention" href="https://hashnode.com/@mehulminat">Mehul Minat</a></p>
</li>
<li><p><a class="user-mention" href="https://hashnode.com/@devarshidoshi">Devarshi Doshi</a></p>
</li>
</ul>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[How to get beautiful PowerShell with Git Branches]]></title><description><![CDATA[Introduction

Why should you customize PowerShell?


As developers we tend to use Git, to be more specific Git CLI. Natively PowerShell doesn't show much information e.g. which branch we are working on. Using some modules and a terminal we can get di...]]></description><link>https://blog.mehul.uno/how-to-get-beautiful-powershell-with-git-branches</link><guid isPermaLink="true">https://blog.mehul.uno/how-to-get-beautiful-powershell-with-git-branches</guid><category><![CDATA[Powershell]]></category><category><![CDATA[terminal]]></category><category><![CDATA[Git]]></category><category><![CDATA[theme]]></category><dc:creator><![CDATA[Mehul Minat]]></dc:creator><pubDate>Sat, 11 Sep 2021 14:04:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630996744005/MzFr35ckr.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction</h1>
<ul>
<li><h3 id="heading-why-should-you-customize-powershell">Why should you customize PowerShell?</h3>
</li>
</ul>
<p>As developers we tend to use Git, to be more specific Git CLI. Natively PowerShell doesn't show much information e.g. which branch we are working on. Using some modules and a terminal we can get different themes for our PowerShell.</p>
<ul>
<li><h3 id="heading-what-is-windows-terminal-wt">What is Windows Terminal (WT)</h3>
</li>
</ul>
<p>Windows Terminal is a terminal application with shells like Command Prompt, PowerShell, and WSL all in one application. Its main features include multiple tabs, panes, custom themes, styles, and configurations.</p>
<h1 id="heading-tools-module-used">Tools / Module Used</h1>
<ul>
<li><p>Windows Terminal</p>
</li>
<li><p>oh-my-posh (for PowerShell theme)</p>
</li>
<li><p>posh-git (for git autocompletion, branch name,...)</p>
</li>
<li><p>Powerline Fonts (Nerd Font Recommended or Cascadia PL)</p>
</li>
<li><p>git-bash <strong>(assumed to be already installed)</strong></p>
</li>
</ul>
<h1 id="heading-steps-at-a-glance">Steps at a glance</h1>
<ol>
<li><p>Install Windows Terminal</p>
</li>
<li><p>Install Powerline Fonts</p>
</li>
<li><p>Install Required Modules</p>
</li>
<li><p>Add modules and desired theme to profile</p>
</li>
<li><p>Configure PowerShell to run scripts</p>
</li>
<li><p>Add font family in JSON file of terminal</p>
</li>
</ol>
<h1 id="heading-detailed-steps">Detailed Steps</h1>
<h3 id="heading-step-1-install-windows-terminal">Step 1: Install Windows Terminal</h3>
<ul>
<li><p>Go to Microsoft Store and install <a target="_blank" href="https://www.microsoft.com/store/productId/9N0DX20HK701">Windows Terminal</a>.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631359606062/gVof6pRz8.png" alt="wt.png" /></p>
</li>
<li><p>After installing it will appear in the start menu as well.</p>
</li>
</ul>
<blockquote>
<p>TIP: Windows Terminal can be opened from a run using <strong>wt</strong> like cmd</p>
</blockquote>
<h3 id="heading-step-2-install-fonts">Step 2: Install Fonts</h3>
<ul>
<li><p>Any Nerd Font will work with the standard themes of Oh My Posh, but recommended is <strong>MesloLGM Font</strong>.</p>
</li>
<li><p><a target="_blank" href="https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Meslo.zip">Get MesloLGM Fonts here</a></p>
</li>
</ul>
<blockquote>
<p>Cascadia Font is also compatible but some glyphs are not supported yet you need to patch with custom Unicode manually.</p>
</blockquote>
<ul>
<li>Install MesloLGM Windows Compatible fonts</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631361425281/j-n7T0FFk.png" alt="fonts.png" /></p>
<blockquote>
<p>NOTE: Install font for all users by right-clicking and install for all users</p>
</blockquote>
<h3 id="heading-step-3-install-modules">Step 3: Install Modules</h3>
<ul>
<li>Using PowerShell, install oh-my-posh and posh-git.</li>
</ul>
<blockquote>
<p>You may install these using Terminal itself</p>
</blockquote>
<pre><code class="lang-plaintext">Install-Module posh-git -Scope CurrentUser
</code></pre>
<pre><code class="lang-plaintext">Install-Module oh-my-posh -Scope CurrentUser
</code></pre>
<ul>
<li><p><strong>You need to press A in PowerShell while installation of both modules to install from the repository. See the image below 👇</strong></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631362965965/6i2hKbjjt.png" alt="image.png" /></p>
</li>
</ul>
<h3 id="heading-step-4-configure-powershell-profile">Step 4: Configure PowerShell Profile</h3>
<ul>
<li>Enter the below-shown command in PowerShell.</li>
</ul>
<pre><code class="lang-plaintext">notepad $PROFILE
</code></pre>
<ul>
<li><p>If there is no file profile file, then a dialog box will be prompted to create one, hit yes.</p>
</li>
<li><p>Now inside PowerShell_profile.ps1 file which is currently opened, add the following lines👇</p>
</li>
</ul>
<pre><code class="lang-plaintext">Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme paradox
</code></pre>
<ul>
<li>Save the file and close the notepad.</li>
</ul>
<blockquote>
<p>You can change the theme later on as you want, the cover photo is using aliens theme.</p>
</blockquote>
<h5 id="heading-changing-themes-will-be-covered-in-another-blog">Changing themes will be covered in another blog.🙂</h5>
<h3 id="heading-step-5-configure-powershell-to-run-scripts">Step 5: Configure PowerShell to run scripts</h3>
<ul>
<li><p>We need to change the execution policy so that we can run our profile script(the one created in the above step).</p>
</li>
<li><p>To change execution policy open <strong>new PowerShell window as administrator.</strong></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631364864266/H5eOM6W2F.png" alt="image.png" /></p>
</li>
</ul>
<blockquote>
<p>There will be some errors when you open a new PowerShell window, that is due to restricted execution policy but after executing the below step it won't appear next time.</p>
</blockquote>
<ul>
<li>Enter the below-shown command(to change policy to unrestricted)</li>
</ul>
<pre><code class="lang-plaintext">Set-ExecutionPolicy Unrestricted
</code></pre>
<h3 id="heading-step-6-add-font-family-in-json-file-of-terminal">Step 6: Add Font Family in JSON file of Terminal</h3>
<ul>
<li><p>Open Settings of Terminal. From the Dropdown menu adjacent to the + button.</p>
</li>
<li><p>Or Use <code>ctrl + ,</code> as a shortcut to open settings of terminal.</p>
</li>
<li><p>Now click on the bottom left button labeled as <code>Open JSON File</code>.</p>
</li>
<li><p>On clicking the button JSON file would be opened in the desired editor, if VS Code is available then it would be opened in that else another editor would be chosen.</p>
</li>
<li><p>Now add Font Family by Adding the below code in the default section of the JSON file.👇</p>
</li>
</ul>
<pre><code class="lang-JSON"><span class="hljs-string">"fontFace"</span>: <span class="hljs-string">"MesloLGM NF"</span>
</code></pre>
<ul>
<li><p><strong>Note:</strong> You must add the above code in the default section only. Don't alter the other code written, we will discuss customizing WT using JSON later in detail, in another blog.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631366954223/m8siHdxdY.png" alt="image.png" /></p>
</li>
</ul>
<h2 id="heading-congrats-you-have-customized-the-terminal">Congrats🎉, You have customized the Terminal.</h2>
<h4 id="heading-now-change-to-a-git-initialized-directory-any-cloned-repository-you-will-be-seeing-an-extra-label-indicating-on-what-branch-you-are-working-on">Now change to a git initialized directory / any cloned repository, you will be seeing an extra-label indicating on what branch you are working on.</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631367475459/yEJ1hFQUf.png" alt="image.png" /></p>
<h1 id="heading-extra-themes">Extra Themes</h1>
<ul>
<li><p>To check all available themes head over to <a target="_blank" href="https://ohmyposh.dev/docs/themes">Oh-My-Posh | Themes</a></p>
</li>
<li><p>You may check-in PowerShell as well using :</p>
</li>
</ul>
<pre><code class="lang-plaintext">Get-PoshThemes
</code></pre>
<ul>
<li>For changing theme open the profile file using <code>notepad $profile</code> and change the theme by changing the old theme to the new one.</li>
</ul>
<blockquote>
<p>You can also try theme by temporarily changing theme in PowerShell Using <code>Set-PoshPrompt -Theme &lt;themename&gt;</code> for e.g. <code>Set-PoshPrompt -Theme mt</code></p>
</blockquote>
<h1 id="heading-react-comment-and-share">React 🤟, Comment and Share</h1>
<h2 id="heading-follow-me-more-cool-stuff-on-its-way">Follow Me, More cool stuff on its way.</h2>
]]></content:encoded></item></channel></rss>