Changes

Jump to: navigation, search

SYA710 Lab01

6,898 bytes added, 18:36, 17 September 2008
PART C (Container is a logical volume):
with password 'seneca99'.</li>
<li>Open a console window and switch to superuser with this command:<br>
<brpre> su - <br> <br/pre>
</li>
<li>Create a regular file (filled with zeros) which will be the
container for our file system.
Use this command:<br>
  <brpre> dd if=/dev/zero of=fakedisk bs=1024 count=10000 <br> <br/pre>
</li>
<li>Use the losetup command to associate your file with /dev/loop0
like this:<br>
<brpre> losetup /dev/loop0 fakedisk <br> <br/pre
</li>
<li>Now create a file system in the container:<br>
<brpre> mkfs -t ext2 /dev/loop0 <br> <br/pre>
</li>
<li>Make a directory to be a mount point for the file system:<br>
<brpre mkdir /mnt1 <br> <br/pre>
</li>
<li>Mount the file system:<br>
<brpre> mount /dev/loop0 /mnt1 <br> <br/pre>
</li>
 
<li>Record the output of the following command:<br>
<brpre> df -Thi/dev/loop0<br> <br/pre>
</li>
<li>Unmount the file system<br>
<brpre> umount /mnt1 <br>  <br/pre>
</li>
<li>Delete the loop device<br>
<brpre> losetup -d /dev/loop0 <br> <br/pre>
</li>
<li>Delete the fakedisk fileusing the rm command.<br> 
</li>
<li>Answer the questions 1 to 4 in PART D, then do PART B.<br>
</li>
</ol>
 
=== PART B (Container is a partition): ===
Perform Reboot the system and perform the following steps:
<ol>
<li>Use fdisk to make primary partition #4 of about 1GB size.<br>
</li>
 
<li>Inform the kernel of the change in the partition table with the
command:<br>
<brpre> partprobe <br> <br/pre>
</li>
<li>Make an ext3 file system in the new partition:<br>
<brpre> mkfs -t ext3 /dev/sda4<br>  <br/pre>
</li>
<li>Make a new directory (mkdir /mnt1) and mount the file system onto it like this<br>
<brpre> mount /dev/sda4 /mnt1 <br> <br/pre>
</li>
<li>Now copy the contents of your /home directory to this new file
system like this:<br>
  <brpre> cp -a /home/* /mnt1 <br> <br/pre>
</li>
<li>Add the following line for your /etc/fstab file<br>
<pre> /dev/sda4 /home ext3 defaults 1 3</pre>
</li>
<li>Unmount /mnt1</li>
<pre> umount /mnt1 </pre>
<li>Close the console window and logout of joker.</li>
<li>Login as root and open a console window.</li>
<li>Enter the command<br>
<brpre> mount -a <br>  <br/pre>
</li>
<li>Enter the 'df -Thi' command to verify that /dev/sda4 is mounted
<li>Login as joker, open a console window and use the df command to
verify that /dev/sda4 is mounted at /home.</li>
<li>Answer the rest of the questions 5 through 11 in PART D.<br> </li></ol> === PART C (Container is a logical volume): ===Reboot the system and perform the following steps:<ol> <li>Login to your Fedora 8 Test system as root.</li> <li>Open a shell and use fdisk to create an extended partition of3GB. This should be partition 4. Also create twological 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 partprobecommand to inform Linux of your changes.</li> <li>Now initialize the two unused partitions so they will beavialable 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 D.<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>
 
=== PART D: (Questions) ===
Answer the following questions and email them to your teacher.
<ol>
<li>What is your full name?</li>
<li>What is the exact size (in bytes) of the fakedisk file you
created in PART A?</li>
<li>What is the exact output of the command used in question 8 in
PART A?</li>
<li>How many total inodes are there in the file system you created in
PART A?<br>
</li>
<li>What is the exact output of the command used in question 11 in
PARTB?</li>
<li>How many inodes are there in the file system you created
in PART B?</li>
<li>What is the purpose of the e2label command?</li>
<li>If you added a label of /home to the file system you created in
PART B, how would you change step 6 of PART B?</li>
<li>List the steps needed to perform a file system check on the file
system you created in PART B.</li>
 
<li>The file system you created in PART B occupied the entire 1GB
partition. List the steps you would need to do to increase the file
system size to 2GB.</li>
<li>What command would you use to set the maximum mount count of the
file system in PART B to 100? Give the full command.<br>
</li>
<li>Using LVM, explain, in your own words, how a file system can be increased and decreased. Be sure to include the commands you would use.</li>
</ol>
63
edits

Navigation menu