<?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[Jirawat Uttayaya]]></title><description><![CDATA[Jirawat Uttayaya DevOps Blog]]></description><link>https://devops-blog.com</link><image><url>https://cdn.hashnode.com/uploads/logos/69c85d2b7cf270651076d644/360d129a-293f-43b4-baa4-5b7c94ca99a3.jpg</url><title>Jirawat Uttayaya</title><link>https://devops-blog.com</link></image><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 08:11:22 GMT</lastBuildDate><atom:link href="https://devops-blog.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Add hard disk to VMware Linux VM]]></title><description><![CDATA[There are two easy steps to add a hard disk for a VMware Linux VM.

Assign a new hard disk in VMware vSphere

Configure the new hard disk in CentOS


This example assigns a new 5 GB hard disk as the /]]></description><link>https://devops-blog.com/add-disk-vmware-linux</link><guid isPermaLink="true">https://devops-blog.com/add-disk-vmware-linux</guid><category><![CDATA[vmware]]></category><category><![CDATA[Linux]]></category><category><![CDATA[centos]]></category><dc:creator><![CDATA[Jirawat Uttayaya]]></dc:creator><pubDate>Fri, 26 Oct 2018 05:21:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/194e3a78-1c86-40b0-9ae0-95ab75f78eff.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There are two easy steps to add a hard disk for a VMware Linux VM.</p>
<ol>
<li><p>Assign a new hard disk in VMware vSphere</p>
</li>
<li><p>Configure the new hard disk in CentOS</p>
</li>
</ol>
<p>This example assigns a new 5 GB hard disk as the <code>/backup</code> directory on CentOS 7</p>
<h2><strong>Assign hard disk in vSphere</strong></h2>
<ol>
<li><p>In VMware vSphere, right click on the VM and select <strong>"Edit Settings..."</strong></p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/336c55cd-cc38-48ee-9739-ca126a1409c8.webp" alt="" style="display:block;margin:0 auto" />
</li>
<li><p>In the <strong>"New device:"</strong> section, select <strong>"SCSI Controller"</strong>, and click the <strong>"OK"</strong> button. Note, there is a hard limit of 4 SCSI Controllers per VM.</p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/5f3676d0-ee96-4428-957d-7c6a5fa23d33.webp" alt="" style="display:block;margin:0 auto" />
</li>
<li><p>Right click <strong>"Edit Settings..."</strong> again and select <strong>"New Hard Disk"</strong></p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/a604baf0-a0e1-465a-a471-50332ee75ede.webp" alt="" style="display:block;margin:0 auto" />
</li>
<li><p>Input the byte size of the new hard disk (in this example, 5 GB). In the <strong>"Virtual Device Node"</strong> section, assign the new SCSI controller number. Click the <strong>"OK"</strong> button.</p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/acc3fbef-44fd-4e2d-8149-5e2a275ea0f1.webp" alt="" style="display:block;margin:0 auto" /></li>
</ol>
<h2><strong>Configure new hard disk in CentOS</strong></h2>
<ol>
<li><p>SSH into the CentOS VM and sudo to root<br /><code>sudo su -</code></p>
</li>
<li><p>List the block device to see the newly assigned vSphere hard disk.<br /><code>lsblk</code>  </p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/c60f5aaa-fa3c-4717-b623-48616bce19e9.webp" alt="" style="display:block;margin:0 auto" />

<p>If you do not see the vSphere hard disk, force a rescan</p>
<pre><code class="language-shell">for host in $(ls -1d /sys/class/scsi_host/);
  do echo "- - -" &gt; ${host}/scan
done

for device in $(ls -1d /sys/class/scsi_disk/);
  do echo "1" &gt; ${device}/device/rescan
done
</code></pre>
</li>
<li><p>Format the disk partition. Get the device name from the previous <em>lsblk</em> output<br /><code>fdisk /dev/sdb</code><br />See the screenshot for the options you should pick<br /><em>n (new partition)<br />p (primary)<br />(Press ENTER) (Use default partition number)<br />(Press ENTER) (Use default first sector)<br />(Press ENTER) (Use default last sector)<br />t (change the partition type)<br />8e (Linux LVM)<br />w (write)</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/6ea93cef-06ae-420f-b064-8482ae535531.webp" alt="" />

</li>
<li><p>List the block device again to display the new disk partition /dev/sdb1<br /><code>lsblk</code></p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/2b4fe6d3-03f4-4b15-97d5-37c19eb60c0c.webp" alt="" />
</li>
<li><p>Initialize the physical volume<br /><code>pvcreate /dev/sdb1</code><br /><em>T</em>o display the new physical volume<br /><code>pvs</code></p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/27e18c16-daed-4364-9354-e06bef4c01a8.webp" alt="" />
</li>
<li><p>Create the volume group<br />Note: vgBackup is just an name for this example. The volume group name can be whatever you want<br /><code>vgcreate vgBackup /dev/sdb1</code><br />To display the volume group<br /><code>vgs</code></p>
</li>
<li><p>Create the logical volume for the volume group<br />Note: lvBackup is just an name for this example. The logical volume name can be whatever you want<br /><code>lvcreate -n lvBackup -l +100%FREE vgBackup</code><br />To display the logical volume<br /><code>lvs</code></p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/b1de7bb2-6c45-4597-b02a-e4c44a542525.webp" alt="" style="display:block;margin:0 auto" />
</li>
<li><p>Construct an XFS filesystem on the new logical volume<br /><code>mkfs.xfs /dev/vgBackup/lvBackup</code>  </p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/f4234b3b-f600-4af9-bb60-4bd5992d8261.webp" alt="" style="display:block;margin:0 auto" />

  
</li>
<li><p>Edit the text file <strong>/etc/fstab</strong> and add the line below:</p>
<pre><code class="language-plaintext">/dev/vgBackup/lvBakup /backup xfs defaults 1 2
</code></pre>
</li>
<li><p>Mount a Unix directory to the logical volume<br /><code>mkdir -p /backup</code><br /><code>mount /backup</code></p>
</li>
<li><p>You now have a new 5 GB hard disk assigned as the <code>/backup</code> directory</p>
<img src="https://cdn.hashnode.com/uploads/covers/69c85d2b7cf270651076d644/bfccc567-b487-4636-8473-08bccf6e2af9.webp" alt="" style="display:block;margin:0 auto" /></li>
</ol>
<p>To learn more about Unix Logical Volumes, go to official <a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/lvm_definition">RedHat LVM docs</a></p>
]]></content:encoded></item></channel></rss>