Changes

Jump to: navigation, search

OPS235 Lab 5

307 bytes removed, 09:31, 15 March 2017
no edit summary
<li>Re-issue the '''ssm''' command. Do you see a new /dev/vda3 partition under Physical Volumes?</li>
<li>To add the newly created partition, you need to add it into LVM to be used. Issue the following command to add the partition into LVM: <br><b><code><span style="color:#3366CC;font-size:1.2em;">pvcreate /dev/vda3</span></code></b> (or ''pvcreate /dev/sda3'' ) (enter '''y''' to proceed - ignore warning)</li>
</ol>{{Admon/important|Check your VG name|Run <b>vgs</b> to determine your VG name. If it is just <b>centos</b>, you will need to rename it to <b>centos_centos2</b> using the <b>vgrename</b> command.}}<ol><li value="17">Issue the following command to add your new-created and formatted partition called /dev/vda3 to your volume group:<br><b><code><span style="color:#3366CC;font-size:1.2em;">vgextend centos_centos2 centos /dev/vda3</span></code></b></li><li>Create a new logical volume by issuing the following command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">lvcreate -L 2G -n archive centos_centos2centos</span></code></b></li><li>Format your newly-created partition by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">mkfs -t ext4 /dev/centos_centos2centos/archive</span></code></b></li>
<li>Issue the '''ssm list''' command to view the new physical volume and logical volume information.</li>
</ol>
{{Admon/important|Pay attention to syntax|Note that the prefixed "+" or "-" in lvextend and lvreduce will add or subtract from the current size. Omitting these prefixes will <b>set</b> the LV size to what you specified.}}
<ol><li value="21">Reduce the file-size by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">lvreduce -r -L -0.5G centos_centos2centos/archive</span></code></b></li>
<li>Issue the '''ssm list''' command to verify.</li>
<li>Increase the file-size by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">lvextend -L +1G centos_centos2centos/archive</span></code></b></li>
<li>Issue the '''ssm list''' command to verify.</li>
</ol>
<li>Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">ls /dev/vd*</span></code></b>, what has changed?</li>
<li>Use '''fdisk''' (''refer to how to use in Part 1'') to create a new single '''primary''' partition for '''/dev/vdb''' that fills the ''entire'' disk, save partition table (accepting defaults prompts would work), restart your '''centos2''' VM and then '''format''' that partition for file type: '''ext4'''.</li>
<li>Now we'll make the new device a '''physical volume''', add it to the '''volume group'''by issuing the following commands:<br><b><code><span style="color:#3366CC;font-size:1.2em;">pvcreate /dev/vdb1</span></code></b> (enter '''y''' to proceed - ignore warning)<br><b><code><span style="color:#3366CC;font-size:1.2em;">vgextend centos_centos2 centos /dev/vdb1</span></code></b><br><br>'''NOTE:''' If you experience an error message, issue the '''ssm list''' command, and check the '''volume group name''' under the '''"pool"''' section.<br>If the volume group name is different than '''centos_centos2centos''', then use that volume group name for all remaining commands that use "centos_centos2centos"<br><br></li>
<li>Re-issue the '''ssm list''' command to see if there is any change.</li>
<li>Issue the following command to extend the logical volume for the home file-system: <b><code><span style="color:#3366CC;font-size:1.2em;">lvextend centos_centos2centos/home --size +2G</span></code></b></li>
<li>Record the size of the volume group and the amount of free space. What has changed and what caused those changes?</li>
<li>Issue the '''ssm list''' command. Note that your home file-system is now 2GB bigger, and you have not even rebooted your machine since you used fdisk to create a partition!</li>
# Perform this part in your '''centos2''' VM.
# Issue the following command to create a mount-point (directory to connect /dev/dva3 partition to):<br><b><code><span style="color:#3366CC;font-size:1.2em;">mkdir /archive</span></code></b>
# Issue the following command to mount the partition:<br><b><code><span style="color:#3366CC;font-size:1.2em;">mount -t ext4 /dev/centos_centos2centos/archive /archive</span></code></b>
# Use the '''ls''' command to view the contents of the /archive directory. What do you see?
# Issue the '''mount''' command (without arguments) to confirm it has been mounted.
<ol><li value="8">View the contents of the file-system table '''/etc/fstab''' by issuing the following command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">cat /etc/fstab</span></code></b></li>
<li>Issue the following command to add an entry to automatically mount the /archive directory upon bootup:<br><b><code><span style="color:#3366CC;font-size:1.2em;">echo "/dev/centos_centos2centos/archive /archive ext4 defaults 1 2" >> /etc/fstab</span></code></b></li>
<li>'''Reboot''' your centos2 VM so see if the /archive directory is automatically mounted.<br><br>'''Note:''' You could have also issued the command: '''mount -a''' to <u>automatically</u> mount the file-systems contained in the '''/etc/fstab''' file without booting the VM (good for testing before trying a reboot).<br><br></li>
</ol>

Navigation menu