Changes

Jump to: navigation, search

SYA710 Lab01

8,236 bytes added, 18:36, 17 September 2008
PART C (Container is a logical volume):
== SYA710 Lab #1 ==
=== Focus: Working With File Systems ===
=== PART A(Container is a file): ===Perform the following steps: ===
<ol>
<li>Power on your PC and boot up Fedora 8 Test and login as 'joker'
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>
<pre> umount /mnt1 </pre> </li> <li>Delete the loop device<br><pre> losetup -d /dev/loop0 </pre> </li> <li>Delete the fakedisk file using the rm command.<br> </li> <li>Answer the questions 1 to 4 in PART D.<br> </li></ol> === PART B (Container is a partition): ===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 thecommand:<br><pre> partprobe </pre> </li> <li>Make an ext3 file system in the new partition:<br><pre> mkfs -t ext3 /dev/sda4</pre> </li> <li>Make a new directory (mkdir /mnt1) and mount the file system onto it like this<br><pre> mount /dev/sda4 /mnt1 </pre> </li> <li>Now copy the contents of your /home directory to this new filesystem like this:<br><pre> cp -a /home/* /mnt1 </pre> </li> <li>Add the following line for your /etc/fstab file<br> <brpre> /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><pre> mount -a </pre> </li> <li>Enter the 'df -Thi' command to verify that /dev/sda4 is mountedas /home.</li> <li>Close the console window and logout.</li> <li>Login as joker, open a console window and use the df command toverify that /dev/sda4 is mounted at /home.</li> <li>Answer 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> <br/p>
</li>
<li>Delete When you are done with partitioning with fdisk, use the loop 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 physicalvolume /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 otherpartition.</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. Savethe output, you'll need it for PART D.<br> </li> <li>Now use the 'e2label' command to give this partition a labelnamed 'myhome' likethis <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 updateyour /etc/fstab file. You can do this by addingin 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>losetup <pre> mount -d a</pre> </li>  <li>Again record the output of the 'df -Ti' command which you willneed for PART D.<br> </li> <li>You should now be able to logout of root and login as joker. Ifthis wassuccessful, you can go on to the next step, otherwise you have aproblem which must be fixed first, so see your teacher or lab tutor forassistance.</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 addingthe second unused partition, /dev/loop0 sda6, to the volume group like this <brpre> vgextend seneca /dev/sda6</pre>  </li> <li>Ok, our volume group has two physical volumes in it and thereforeis larger, so we cannow 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 - thesize of our home directory is still 500MB. So now we need to resize theext3 file system to fill all the space of the logical volume. We can dothis with the command <pre> resize2fs /dev/seneca/home</pre> </li> <li>Once again record the output of the 'df -Ti' command.<br>
</li>
<li/ol>Delete the fakedisk file.<brol></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>Answer What is the questions 1 exact output of the command used in question 11 inPARTB?</li> <li>How many inodes are there in the file system you createdin PART B?</li> <li>What is the purpose of the e2label command?</li> <li>If you added a label of /home to 4 the file system you created in PART DB, then how would you change step 6 of PART B?</li> <li>List the steps needed to perform a file system check on the filesystem you created in PART B.</li>  <li>The file system you created in PART B occupied the entire 1GBpartition. List the steps you would need to do to increase the filesystem size to 2GB.</li> <li>What command would you use to set the maximum mount count of thefile system in PART Bto 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