Open main menu

CDOT Wiki β

Changes

SYA710 Lab01

5,629 bytes added, 06:05, 9 September 2008
no edit summary
<br>
mount -a <br>
 
<br>
</li>
<li>Answer the rest of the questions in PART D.<br>
</li>
</ol>
=== PART C (Container is a logical volume): ===
Perform the following steps:
<ol>
<li>Reboot (start with a fresh image) and login to your Fedora 8 Test system as root.</li>
<li>Open a shell and use fdisk to create an extended partition of
3GB. This should be partition 4. Also create two
logical partitions of sizes 1GB and 2GB respectively. <br>
</li>
<li>So this is what your partition table should look like:
<p>
<table style="text-align: left; width: 30%;" border="1"
cellpadding="2" cellspacing="2">
<tr>
<td style="vertical-align: top;">Device<br>
</td>
<td style="vertical-align: top;">Size<br>
</td>
<td style="vertical-align: top;">Type<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">/dev/sda1<br>
 
</td>
<td style="vertical-align: top; text-align: center;">400M<br>
</td>
<td style="vertical-align: top; text-align: center;">/boot<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">/dev/sda2<br>
 
</td>
<td style="vertical-align: top; text-align: center;">5G<br>
</td>
<td style="vertical-align: top; text-align: center;">/<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">/dev/sda3<br>
 
</td>
<td style="vertical-align: top; text-align: center;">500M<br>
</td>
<td style="vertical-align: top; text-align: center;">swap<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">/dev/sda4<br>
 
</td>
<td style="vertical-align: top; text-align: center;">3G<br>
</td>
<td style="vertical-align: top; text-align: center;">Extended<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">/dev/sda5<br>
 
</td>
<td style="vertical-align: top; text-align: center;">1G<br>
</td>
<td style="vertical-align: top; text-align: center;">Unused<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">/dev/sda6<br>
 
</td>
<td style="vertical-align: top; text-align: center;">2G<br>
</td>
<td style="vertical-align: top; text-align: center;">Unused<br>
</td>
</tr>
</table>
</p>
</li>
<li>When you are done with partitioning with fdisk, use the partprobe
command to inform Linux of your changes.</li>
<li>Now initialize the two unused partitions so they will be
avialable to LVM.
<pre> pvcreate /dev/sda5 /dev/sda6</pre>
</li>
<li>Create a volume group with the name of 'seneca' and put physical
volume /dev/sda5 into it.
<pre> vgcreate seneca /dev/sda5</pre>
 
</li>
<li>Run the 'vgscan' command to verify the previous step worked.</li>
<li>Now create a logical volume with name 'home' and a size of 500MB.
<pre> lvcreate -n home --size 500M seneca</pre>
</li>
<li>This logical volume you created can now be accessed as device
'/dev/seneca/home' and can be formatted and mounted just like any other
partition.</li>
<li>Format this logical partition as ext3 type.
<pre> mkfs.ext3 /dev/seneca/home</pre>
 
</li>
<li>We'll now mount this file system on empty directory /mnt.
<pre> mount /dev/seneca/home /mnt</pre>
</li>
<li>Use the 'df -Ti' command to verify the mount was successful. Save
the output, you'll need it for PART D.<br>
</li>
<li>Now use the 'e2label' command to give this partition a label
named 'myhome' like
this
<pre> e2label /dev/seneca/home myhome</pre>
 
</li>
<li>Verify the labeling worked with the command
<pre> e2label /dev/seneca/home</pre>
</li>
<li>Use the 'lvdisplay' command to view your logical volume.</li>
<li>Now move your old /home contents to your new logical volume.
<pre> mv /home/* /mnt</pre>
 
</li>
<li>In order to use your new /home directory you'll have to update
your /etc/fstab file. You can do this by adding
in the following line:
<pre> LABEL=myhome /home ext3 defaults 1 3</pre>
</li>
<li>Unmount /mnt and then remount all file systems listed in
/etc/fstab with the command<br>
<pre> mount -a</pre>
</li>
 
<li>Again record the output of the 'df -Ti' command which you will
need for PART B.<br>
</li>
<li>You should now be able to logout of root and login as joker. If
this was
successful, you can go on to the next step, otherwise you have a
problem which must be fixed first, so see your teacher or lab tutor for
assistance.</li>
<li>As joker open a BASH shell and switch to root with the command
<pre> su -</pre>
</li>
<li>Now we'll increase the size of our home directory by first adding
the second unused partition, /dev/sda6, to the volume group like this
<pre> vgextend seneca /dev/sda6</pre>
 
</li>
<li>Ok, our volume group has two physical volumes in it and therefore
is larger, so we can
now expand by 1 GB our logical volume, home, with this command
<pre> lvextend -L+1G /dev/seneca/home</pre>
</li>
<li>So now our 'home' logical volume should be about 1.5GB. However,
if you use the 'df' command you'll see that nothing has changed - the
size of our home directory is still 500MB. So now we need to resize the
ext3 file system to fill all the space of the logical volume. We can do
this with the command
<pre> resize2fs /dev/seneca/home</pre>
</li>
<li>Once again record the output of the 'df -Ti' command.<br>
 
</li>
</ol>
<ol>
</ol>
<ol>
</ol>
63
edits