Updated: 2013-11-28 06:53 EST

1 Due Date and DeliverablesIndexup to index

You must have your own CentOS virtual machine (with root permissions) running to do this lab. You cannot do the lab on the Course Linux Server because you do not have root permissions on that machine.

WARNING: Some inattentive students upload Assignment #13 into the Assignment #12 upload area. Don’t make that mistake! Be exact.

2 Purpose of this AssignmentIndexup to index

  1. Practice managing Partitions and File Systems in your own virtual machine.

3 Introduction and OverviewIndexup to index

This is an overview of how you are expected to complete this assignment. Read all the words before you start working.

Do not print this assignment on paper. On paper, you cannot follow any of the hyperlink URLs that lead you to hints and course notes relevant to answering a question.

  1. Complete the readings in your weekly Class Notes.
  2. Do the Tasks listed below, in order.
    • READ ALL THE WORDS to work effectively and not waste time.
  3. Verify your own work before running the Checking Program.
  4. Run the Checking Program to help you find errors.
  5. Submit the output of the Checking Program to Blackboard before the due date.

Since I also do manual marking of student assignments, your final mark may not be the same as the mark submitted using the current version of the Checking Program. I do not guarantee that any version of the Checking Program will find all the errors in your work. Complete your assignments according to the specifications, not according to the incomplete set of mistakes detected by the Checking Program.

When you are finished the tasks, leave the files and directories in place as part of your deliverables. Do not delete any assignment work until after the term is over! Assignments may be re-marked at any time; you must have your term work available right until term end.

3.1 The CLS Source DirectoryIndexup to index

All references to the “Source Directory” below are to the CLS directory ~idallen/cst8207/13f/assignment13/ and that name starts with a tilde character ~ followed by a userid with no intervening slash. The leading tilde indicates to the shell that the pathname starts with the HOME directory of the account idallen (seven letters).

3.2 Commands, topics, and features coveredIndexup to index

Review course notes Partitions and File Systems.

Use the on-line help (man command) for the commands listed below for more information.

3.3 Correct user, command lines, and command outputIndexup to index

3.4 Backup and RecoveryIndexup to index

  1. Take a snapshot of your virtual machine before you begin each section of this lab so that you can recover back to the snapshot if needed. You can delete the unused snapshots if everything works well.

  2. Are you keeping an external backup copy of all your coursework (including your virtual machines) somewhere? You should be!

3.5 Use a remote login, not the VMware consoleIndexup to index

I recommend that once you have booted your CentOS VM, you connect to it and work using a remote login session (e.g. ssh or PuTTY) where copy-and-paste works and where you can have multiple simultaneous connections into the VM. The VMware console is not friendly.

3.6 The Answer File answer.txtIndexup to index

Where you are required to record or save a command line or its output into The Answer File, do the command and then copy and record the command line or its output as a separate line into an answer.txt file in your CentOS assignment13 directory. You will be told how many lines to save in the file.

If you can’t answer a question, leave a blank line in this answer file. (The vim option :set number may be useful to you as you edit.)

You can use either nl or cat -n to show the contents of a file with line numbers, to make sure each answer is on its correct line number.

4 TasksIndexup to index

4.1 Set UpIndexup to index

  1. Create your assignment13 directory on the CLS in the usual place.

  2. Create your sysadmin account assignment13 directory on your CentOS VM in the usual place (not in the root account!).

    This CentOS directory is the base directory for all pathnames in this assignment. Store your files and answers here on CentOS.

  3. Before you begin this assignment, create a snapshot of your CentOS Virtual Machine, as mentioned above.
    • Enter a comment explaining where and when you took this snapshot.
    • You can restore back to this snapshot if anything goes wrong.

Run the Checking Program to verify your work so far.

4.2 Creating a second VMware virtual hard disk; sdbIndexup to index

  1. Shut down your CentOS machine so it is powered off and not just suspended.

  2. With your CentOS machine still powered off, use the VM | Settings menu to add to your VM a VMware virtual 1GB hard drive as shown in Create VMware Disk. Create the disk exactly 1GB in size.

  3. Reboot (power on) your CentOS virtual machine. The new disk should appear as device /dev/sdb in your CentOS VM. Save a copy of the system partitions file /proc/partitions into a partitions-before.txt file (6 lines, 20 words). Remember: all files should be placed under your sysadmin assignment13 directory on CentOS.

Make sure you only change things on this new sdb disk in this assignment! The sda disk is your Linux ROOT disk; if you damage it you will need to recover back to your snapshot. Make sure you have a snapshot to go back to!

4.3 Viewing Existing Partitions: fdiskIndexup to index

  1. First, you must have added a new 1GB hard drive in VMware and rebooted, as described above.

  2. In /proc/partitions verify that you have an sdb partition of 1GB (approx 1048576 blocks) and that you do not have any sdb1 or sdb2 partitions.

    If you have any sdb1 or sdb2 or other sdb partitions, this is not a new disk with no partition table. Get help.

  3. Run (always with root privileges) fdisk -cul /dev/sdb and make sure you see Disk /dev/sdb: 1073 MB.

    $ sudo fdisk -cul /dev/sdb
    Disk /dev/sdb: 1073 MB, 1073741824 bytes
    255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    If you don’t see 1073 MB, shut down and delete and redo your 1 GB disk install until it works.

  4. Run fdisk -cul /dev/sda and you will see the partitions on your first (sda) disk that holds your ROOT file system.

    $ sudo fdisk -cul /dev/sda
    Disk /dev/sda: 2147 MB, 2147483648 bytes
    255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000eae06
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048     3074047     1536000   83  Linux
    /dev/sda2         3074048     4194303      560128   82  Linux swap / Solaris

    This assignment uses /dev/sdb. DO NOT OVERWRITE /dev/sda WHICH IS YOUR MAIN CENTOS INSTALLATION DRIVE!

4.4 The useful file command – what is that thing?Indexup to index

The Unix/Linux file command is very useful for identifying things in the file system, such as directories, programs, images, files, and special files such as disk partitions.

  1. Run file -s on each of your two disks. Note that your new empty disk says simply data while your ROOT disk has a very long line full of information about the boot sector and partitions:

    $ sudo file -s /dev/sd[ab]
    /dev/sda: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0x11cb38, GRUB version 0.94; partition 1: ID=0x83, active, starthead 32, startsector 2048, 3072000 sectors; partition 2: ID=0x82, starthead 89, startsector 3074048, 1120256 sectors, code offset 0x48
    /dev/sdb: data

    Save the two lines of output in a file-s.txt file (2 lines, 44 words).

4.5 Using fdisk interactivelyIndexup to index

To learn more on how to use fdisk, see your in-class notes or see http://tldp.org/HOWTO/Partition/fdisk_partitioning.html

  1. As root run the interactive command fdisk /dev/sdb that will prompt you with its own Command (m for help): prompt.
    • Make sure you use the sdb disk, not your ROOT disk!
    • You will get several warning messages about a new DOS disklabel and an invalid flag. This is normal, since the new virtual disk is empty and has not been initialized yet.
    • Do not type Linux commands into the fdisk program prompt!
  2. Read the WARNING message printed by fdisk and do the two one-letter commands that it says you should do.

    WARNING: DOS-compatible mode is deprecated. It's strongly
        recommended to switch off the mode (command 'c') and change
        display units to sectors (command 'u').

    You should avoid this warning message in future by using the -cu command line options to fdisk (RTFM) when you run it, even non-interactively. You might even consider making a shell alias that always supplies these two options to fdisk every time you use it: alias fdisk='fdisk -cu'

  3. The fdisk utility is now prompting you for input with a different prompt: Command (m for help): This prompt is the fdisk utility prompt.

    As it says, type the command letter m for a list of menu options for fdisk.

  4. Read the list of Command action commands. Copy the lines below into a file fdisk-info.txt and replace each underscore character with the (one-character) fdisk command letter that does the listed function:

    1. _ save/write partition table to disk (and exit)
    2. _ change a partition's type (system id)
    3. _ exit/quit fdisk without saving changes
    4. _ display/list/print the table of all partitions
    5. _ create/add a new partition
    6. _ show/display/list partition types (system ids)
    7. _ remove/delete a partition

    You will need to use every one of these command letters in this assignment. Make sure you get them right.

  5. Use the fdisk command letter that lists all the two-hex-digit partition types. (Partition types are also called “system identifiers”.) Use that list to answer this:

    Add the lines below to the end of the same fdisk-info.txt file and replace the underscore on each line with the hex type number (system id) of the following partition types, making sure you read the numbers correctly from the screen:

    8. _ Linux
    9. _ Linux swap / So
    10. _ HPFS/NTFS
    11. _ W95 FAT32 (LBA)

    The swap line, above, is short for Linux swap / Solaris. You will need all these partition ID numbers later in the assignment.

    Your completed fdisk-info.txt file should be 11 lines 67 words.

Run the Checking Program to verify your work so far.

4.5.1 Creating Partitions using fdiskIndexup to index

To learn more on how to use fdisk, see your in-class notes or see http://tldp.org/HOWTO/Partition/fdisk_partitioning.html

Below, we will use the correct commands in the fdisk utility to create the following seven new partitions on your sdb disk.

  • Always accept the default proposed by fdisk for the starting sector of a new partition. Push [Enter]; do not type any numbers. You only need to set the end sector (size) of the new partition using the +size{K,M,G} syntax shown by fdisk.

  • fdisk will adjust the size of each partition slightly to fit the DOS partition table disk geometry and sector size. Don’t be alarmed that the size that fdisk creates and displays to you isn’t exactly the size you asked for.

  • Use the fdisk command letter to display the partition table after each change to confirm that you created the correct partition with the correct size.

  • No changes will be saved to disk unless you explicitly use the fdisk command letter to save them. You can always quit fdisk before saving any changes.

  1. Create a primary first partition of 200MB. The type (system id) will default to type Linux. Don’t change the type. Use the fdisk command letter to display the partition table to confirm the values and make sure that the size (in blocks) looks correct for the size you requested.
    • The Start sector of this first partition should be 2048. If it isn’t, you probably forgot to use the option that turns off DOS compatibility. Quit and restart with the correct two options.
  2. Create a primary second partition of 100MB. Leave the type (Linux) as default. Confirm the change.

  3. Create an extended third partition large enough to host the following three logical partitions inside it. You must make the extended partition large enough to hold all three logical partitions described in the next step. Read all the words, first:

    NOTE: As mentioned in class, you cannot create an extended partition exactly the sum of the sizes of the logical partitions inside it. You need to make the extended a bit larger to accommodate the overhead of the logical partition information. Experiment to see how much “a bit larger” means. The end of the extended partition must be less than sector 2097151 that is the last sector in the disk. (i.e. Don’t use up the whole disk for the extended partition!)

  4. Create these three logical partitions inside the extended partition that you created in the previous step:

    1. The size of the first logical partition is 200MB. Leave the partition type set as “Linux”.
    2. The size of the second logical partition is 100MB. Change the partition type to “Linux swap”.
    3. The size of the third logical partition is 300MB. Change the partition type to “HPFS/NTFS”.

    If you run out of space creating the logical partitions inside the extended partition, you can delete the partitions and start over as many times as needed. (You can also start over by exiting fdisk without saving/writing any of your partition changes.)

    Make the extended partition just big enough to contain the logical partitions, no bigger. Try not to have much wasted space between the end of the third logical partition (its end sector) and the end of the extended partition (its end sector).

  5. Create a primary fourth partition that uses up the rest of the space after the end of the extended partition. (To do this, accept the defaults for both the start and the end of the partition. The last end sector of this last partition will be the end sector of the disk: 2097151.) Set the partition type to W95 FAT32 (LBA).

  6. Did you remember to set the correct partition types (system id) on each of the seven partitions?

  7. When all seven partitions are created, with the correct types and sizes, save your changes (seven partitions) to disk, which will cause fdisk to exit. You will return to your shell prompt.

4.5.2 Verify the partitionsIndexup to index

  1. Verify the creation of seven new sdb partitions using ls -l /dev/sd* and by looking at the new contents of the system partitions file, as you did before. You should have exactly seven partitions on this second disk.

  2. Again, copy the system partitions file into a partitions-after.txt file. (13 lines, 48 words. You might look and see how it differs from the previous values you copied in partitions-before.txt. You should see seven new partitions on the new disk.)

  3. From the command line, use fdisk (non-interactive) to show the partition table for the new disk, always using the above-mentioned two options to give sector (not cylinder) output and avoid the DOS compatibility warnings. Part of the output will look similar to this:

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048      411647      204800   83  Linux
    /dev/sdb2          411648      616447      102400   83  Linux
    /dev/sdb3          616448     1853439      618496    5  Extended
    /dev/sdb4         1853440     2097151      121856    c  W95 FAT32 (LBA)
    /dev/sdb5          618496     1028095      204800   83  Linux
    /dev/sdb6         1030144     1234943      102400   82  Linux swap / Solaris
    /dev/sdb7         1236992     1851391      307200    7  HPFS/NTFS

    The exact numbers for end and blocks of sdb3 and the start and blocks of sdb4 may differ slightly from the numbers above. All the other numbers should match exactly.

    Save the output for your disk into an fdisk-sdb.txt file (16 lines, 98 words).

  4. Record these three answers (just the answers) on lines in The Answer File:

    Line 1: Full device names of all primary (not extended) partitions. Line 2: Full device names of all extended partitions. Line 3: Full device names of all logical partitions.

4.5.3 Deleting a logical partition using fdiskIndexup to index

  1. You have seven partitions on your second hard disk. (Make sure this is true before continuing!) Your partition table should look quite similar to the table shown in the previous section. (Read the comments at the bottom of the table to know the allowed differences.)
    • Create a VMware backup snapshot of this virtual machine, so you can return here if things go wrong.
  2. Start fdisk interactively. (Remember the two options to avoid DOS warnings!)
    1. Show the partition table. You should have seven partitions.
    2. Delete the first primary partition that has size 100MB.
      • Display the new partition table. You should still have two Linux (ID 83) partitions left.
      • Note how when you delete a primary partition, none of the other partitions change names.
      • You now have six remaining partitions on sdb.
    3. Quit fdisk without saving any changes.
      • Do not save the changes. You still have seven partitions.
    4. Start fdisk interactively again. (Remember the two options to avoid warnings!)
    5. Show the partition table. You should still have seven partitions.
      • You have seven because you did not save any changes, right?
    6. Delete the first logical (not primary) partition that has size 200MB.
      • Display the new partition table. You now have six partitions.
      • Note how when you delete a logical partition sdb5 the other logical partitions above it all renumber themselves downward to keep the first logical partition numbered sdb5. Logical partitions always number consecutively from 5.
      • You now have six remaining partitions on sdb.
    7. Now save (write) the new partition table (six partitions) to disk, which will cause fdisk to exit. You will return to your shell prompt.
  3. Record the full device names of all remaining logical partitions on Line 4 in The Answer File (two names only).

Run the Checking Program to verify your work so far.

4.6 Use your 1GB disk and six partitions from the previous stepsIndexup to index

To continue with the next sections of this lab, you must have successfully created these six (remaining) partitions on the 1GB disk. Verify that they have exactly the same Device numbers, exactly the same Id and System, approximately the same Start and End, and approximately the same number of Blocks.

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048      411647      204800   83  Linux
    /dev/sdb2          411648      616447      102400   83  Linux
    /dev/sdb3          616448     1853439      618496    5  Extended
    /dev/sdb4         1853440     2097151      121856    c  W95 FAT32 (LBA)
    /dev/sdb5         1030144     1234943      102400   82  Linux swap / Solaris
    /dev/sdb6         1236992     1851391      307200    7  HPFS/NTFS

Do not proceed until you have the above six partitions created.
The sizes may vary slightly. The System ID must match. The end of the Extended partition must be less than the end sector of the disk. There is a large gap between the start of the extended partition and the start of the first logical partition; this gap corresponds to the space left by the deleted 200MB logical partition.

All file system commands in the next part of this lab that refer to a hard disk will use one of the above partitions. Do not continue until you have the above partitions created correctly.

  1. Take a VMware back-up snapshot now and name it something like “done_fdisk”.

  2. For practice, use fdisk interactively to delete all the partitions and then re-create them again, without writing out your changes. Recreate the above six partitions, but don’t save your work. Would you remember how to do this when asked to demonstrate it at a job interview? When installing a new disk? Practice!

4.7 Creating file systems using mkfsIndexup to index

After partitioning a disk, next comes making file systems in the partitions. You must have six partitions available to continue.

  1. Find the device names of the two partitions that have partition type of Linux (System ID 83). (These should be exactly two of the six partitions.)
    1. On the first Linux partition:
      1. Run file -s on this empty partition and note the uninteresting output.
      2. Use a command to create a Linux type ext3 file system on this partition.
        • Many lines will print on your screen, telling you the characteristics of the file system you just created. Make sure there are no error messages!
        • Record the exact command line you used as Line 5 in The Answer File.
      3. Run file -s on this same partition name again.
        • You should see this in the output line: ext3 filesystem data
        • Repeat and record the above one line of output as Line 6 in The Answer File.
    2. On the second Linux partition:
      1. Repeat the above steps for creating a file system, but use a file system type of ext4 this time.
        • Record your command line and output line on Lines 7 and 8 in The Answer File.
  2. On the only W95 FAT partition:
    1. Repeat the above steps for creating a file system, but use a file system type of vfat this time.
      • The command will fail with: mkfs.vfat: No such file or directory
      • The commands for creating DOS file systems are not installed!
      • Confirm the missing command by running: whereis mkfs.vfat
      • We can try to fix this by finding and installing the right package.
    2. To locate the missing package run: yum whatprovides '*/mkfs.vfat'
      • yum will update some internal files then tell you that the missing package name is dosfstools (with a version number).
    3. Install the missing dosfstools package.
      • Verify that which mkfs.vfat now finds the command.
      • (If it doesn’t find it, make sure /sbin is in your PATH.)
    4. Again: Repeat the above steps for creating a file system, but use a file system type of vfat this time.
      • This time, it works.
      • Record your command line and output line on Lines 9 and 10 in The Answer File.
  3. On the only HPFS/NTFS partition:
    1. Repeat the above steps for creating a file system, but use a file system type of ntfs this time.
      • The command will fail with: mkfs.ntfs: No such file or directory
      • The commands for creating NTFS file systems are not installed!
      • Confirm the missing command by running: whereis mkfs.ntfs
      • We can try to fix this by finding and installing the right package.
    2. As you did before, try to locate the missing package based on the missing mkfs.ntfs file name.
      • yum will update some internal files then tell you No Matches found
      • This version of CentOS does not support NTFS file systems using the standard yum repositories for software! :-(
      • We could install an experimental NTFS software package, but we don’t want any experimental software on our server machine.
    3. Give up without making any NTFS file system here.
    4. Send an angry note to Microsoft for using undocumented file system formats that have to be experimentally reverse-engineered.
  4. Take a VMware back-up snapshot now and name it something like “done_mkfs”.

  5. For practice, repeat this section again, re-typing each of the commands you used to create the file systems. Would you remember how to do this when asked to demonstrate it at a job interview? When installing a new disk? Practice!

Run the Checking Program to verify your work so far.

4.8 Mounting & Unmounting a Linux File system using mountIndexup to index

After partitioning a disk and creating file systems, next comes mounting the new file systems onto existing directories in the system. You must have created six partitions with four new file systems to continue.

  1. List all the currently mounted file systems using the mount command with no arguments.
    • You should see seven lines.
    • None of the above new file systems should be visible in the output. If you have any disk partitions mounted other than the ROOT partition (sda1), unmount the partitions now before continuing.
    • Save the mount output as a mount-before.txt file. (7 lines, 42 words)
  2. Use a command to create (empty) directories named /mnt/ext3, /mnt/ext4, and /mnt/vfat to use as mount points for all the file systems you successfully created above.
    • If you don’t remember to create the empty directory first, the mount command will generate error messages such as mount point /mnt/ext3 does not exist.
  3. Use mount commands to mount all three file systems you created previously, each mounted on its own self-named directory. (Recall that each file system was created with a particular type. Match the partition file system type with the directory name.)
    • Record as Lines 11-13 in The Answer File the three mount commands you used to mount these three partitions. (Remember: The directories must already exist!)
    • Reminder: You almost never need the -t option when mounting a file system, since Linux knows the type by looking inside the partition. If mount ever gives the error you must specify the filesystem type, it is because there is no file system created inside that partition. The file -s command can confirm this for you.

4.8.1 Show mounted: mountIndexup to index

  1. Use mount without any arguments to verify that you have three new mounted file systems. Each file system type should match the directory name on which it is mounted. Each file system should be mounted only once. (If you have duplicate entries, unmount them using the umount command.)
    • Save the mount output as a mount-after.txt file. (10 lines, 60 words)
  2. Save the output (run as root) of file -s /dev/sd* as a file-after.txt file. (10 lines)

  3. Save the output (run as root) of the command blkid as a blkid-after.txt file. (at least 5 lines)
    • This command shows you the UUID values that you could use to uniquely identify each partition in the first column of the /etc/fstab file.
  4. Use the command ls -lid / /mnt/ext? to see the inode numbers of the three Linux directories mounted on your system.
    • Notes that all three directories have the same inode number 2. Aren’t inode numbers supposed to be unique? (Review Links and Inodes.) Know why these three directories have the same inode number. (This question may appear on your final exam.)
  5. Take a VMware back-up Snapshot now and name it something like “done_3mount”.

4.8.2 Show mounted: dfIndexup to index

  1. The df (“disk free”) command shows information about mounted file systems, including the amount of disk space used and disk space still available. A useful option is -h that shows output in “human-readable” form.
    • Use the command df -h to see the sizes of the file systems.
    • Compare the time it takes to run the similar command sudo du -xsh /
  2. Unmount all three file systems that you just mounted.
    • Make sure that the system is back to the state you recorded in the mount-before.txt file. Only seven lines!

Run the Checking Program to verify your work so far.

4.9 Preparing a Swap Partition using mkswap and swaponIndexup to index

  1. Use one command to initialize the Linux swap partition on your new 1GB disk.
    1. Record the command line you used as Line 14 in The Answer File.
    2. Record as Line 15 in The Answer File the output of using file -s on the Linux swap partition.
      • The output should include the words swap file
  2. Use one command to tell the kernel to use the new swap device.
  3. Display the list of active swap partitions.
    • Save the output of this command in a swap.txt file. (3 lines, 15 words)
  4. Take a VMware back-up Snapshot now and name it something like “done_swap”.

  5. Disconnect the swap area you just connected.
    • Only one swap partition should remain, on your first disk.

Run the Checking Program to verify your work so far.

4.10 When you are doneIndexup to index

That is all the tasks you need to do.

Check your work a final time using the Checking Program and save the output as described below. Submit your mark following the directions below.

5 Practice these commandsIndexup to index

Go back to your earlier snapshots and REPEAT these exercises as often as necessary, until you can do this without looking at the lab instructions. Without looking at the instructions, can you do the following:

Can you do all the above operations without reference to any help files? Practice! A job interview may ask you to partition a disk and install Linux. Try to look like you know what you are doing!

6 Checking, Marking, and Submitting your WorkIndexup to index

Summary: Do some tasks, then run the Fetch and checking program to verify your work as you go. You can run the Fetch and checking program as often as you want. When you have the best mark, upload the marks file to Blackboard.

The checking program resides on the Course Linux Server, but your work is on your CentOS Virtual Machine. There is a new Fetch program that you must download and use on your CentOS Virtual Machine to copy information from your CentOS Virtual Machine to your account on the CLS so that the checking program can check it on the CLS.

Once the Fetch program has fetched these files from your Virtual Machine to the CLS, you can run the checking program on the CLS to check what is saved in the files. When you make changes on your CentOS Virtual Machine, you need to run the Fetch program again on CentOS to update the saved files on the CLS.

Simply running the checking program on the CLS will not update the saved files on the CLS. You must run the Fetch program below on your CentOS VM when you make changes on your CentOS Virtual Machine.

6.1 Part I - Fetch and CheckIndexup to index

Do all the following steps on your CentOS Virtual Machine. Read through the whole list before you start typing anything. An example of what to type is given below the descriptions that follow.

  1. Log in to CentOS using your system administrator (non-root) account.

  2. Change to your existing CentOS assignment13 directory containing all your answer files for this assignment.

  3. As shown below, use curl to get a copy of the Fetch program from the given URL into a file named do.sh.
    • Make sure you end up with a file named do.sh in your assignment13 directory.
    • Make sure the downloaded file is not a file of HTML and errors. It should start with #!/bin/sh and contain a few shell comments and commands, including another curl command.
    • You only need to download this Fetch program once per assignment.
  4. As shown below, use sudo to run the do.sh script you just downloaded to CentOS, with the USER environment variable set to your own College/Blackboard/CLS account userid (do not use abcd0001).

  5. This Fetch program will connect from CentOS to the CLS using your account name. It will copy files from CentOS to your assignment13 directory on the CLS. It will then run the checking program on the CLS to check your work. You will need to answer one question about your IP address, and then wait and type in your CLS password.

It will look something like this (use your userid, not abcd0001):

CentOS$ hostname
abcd0001

CentOS$ pwd
/home/abcd0001/CST8207-13F/Assignments/assignment13

CentOS$ echo "$USER"
abcd0001

CentOS$ curl -A mozilla http://teaching.idallen.com/cst8207/13f/notes/data/assignment13do.sh >do.sh
[... various download statistics print here ...]

CentOS$ sudo USER=$USER sh do.sh
---------------------------------------------------------------------------
abcd0001: FETCH version 2.  Connecting to CLS as USER='abcd0001' using ssh
---------------------------------------------------------------------------
abcd0001: Use local Algonquin IP cst8207-alg.idallen.ca [y/N]? n
abcd0001: Please wait; using ssh to connect to user 'abcd0001' on cst8207.idallen.ca ...
*** COURSE LINUX SERVER ***
abcd0001@cst8207.idallen.ca's password:         # enter your CLS password
---------------------------------------------------------------------------
idallen-ubuntu assignment13fetch_server.sh version 4 run by abcd0001.
Please wait; collecting info from abcd0001 Virtual Machine
---------------------------------------------------------------------------
VM files collected into CST8207-13F/Assignments/assignment13/abcd0001.tar.bz on CLS.
Now running checking program for abcd0001 on CLS:
[... checking program output appears here ...]

6.1.1 Notes on the Fetch programIndexup to index

  • This Fetch program updates your saved files on the CLS and then runs the checking program on the CLS. If you only run the checking program on the CLS, it won’t update the files from your CentOS VM and it will just check the exiting files saved under assignment13 on the CLS.
  • The checking program is running on the CLS, not on your CentOS VM. At the start, the checking program will issue messages relevant to your account on the CLS (e.g. errors in your CLS .bashrc file or world-writable files on the CLS). These errors are on the CLS, not on your CentOS machine.

6.2 Part II - Check and SubmitIndexup to index

When you are done with your assignment, you need to run the checking program one last time on the CLS and submit the output file, as follows:

Do all this one last time on the Course Linux Server (not on CentOS):

  1. There is a Checking Program named assignment13check in the Source Directory on the CLS. Create a Symbolic Link to this program named check under your new assignment13 directory on the CLS so that you can easily run the program to check your work and assign your work a mark on the CLS. Note: You can create a symbolic link to this executable program but you do not have permission to read or copy the program file.

  2. Execute the above “check” program on the CLS using its symbolic link. (Review the Search Path notes if you forget how to run a program by pathname from the command line.) This program will check your fetched CentOS work, assign you a mark, and display the output on your screen. (You may want to paginate the long output so you can read all of it.)

    Remember: The checking program does not fetch new files to the CLS from your CentOS VM. You must run the Fetch program on your CentOS VM to update the fetched files on the CLS so that the checking program can mark them on the CLS.

    You may run the “check” program as many times as you wish, to correct mistakes and get the best mark. Some tasks sections require you to finish the whole section before running the checking program at the end; you may not always be able to run the checking program successfully after every single task step.

  3. When you are done with checking this assignment, and you like what you see on your screen, redirect the output of the Checking Program into the text file assignment13.txt under your assignment13 directory on the CLS. Use the exact name assignment13.txt in your assignment13 directory. Case (upper/lower case letters) matters. Be absolutely accurate, as if your marks depended on it. Do not edit the file. Make sure the file actually contains the output of the checking program!

  4. Transfer the above assignment13.txt file from the CLS to your local computer and verify that the file still contains all the output from the checking program. Do not edit this file! No empty files, please! Edited or damaged files will not be marked. You may want to refer to your File Transfer notes.

  5. Submit the assignment13.txt file under the correct Assignment area on Blackboard (with the exact name) before the due date. Upload the file via the assignment13 “Upload Assignment” facility in Blackboard: click on the underlined assignment13 link in Blackboard. Use “Attach File” and “Submit” to upload your plain text file.

    No word-processor documents. Do not send email. Use only “Attach File”. Do not enter any text into the Submission or Comments boxes on Blackboard; I do not read them. Use only the “Attach File” section followed by the Submit button. (If you want to send me comments about your assignment, use email.)

  6. Your instructor may also mark the assignment13 directory in your CLS account after the due date. Leave everything there on the CLS. Do not delete any assignment work from the CLS until after the term is over!

  7. Your instructor may also mark the files on your CentOS VM after the due date. Leave everything there on your CentOS VM. Do not delete any assignment work from the CentOS VM until after the term is over!

Use the exact file name given above. Upload only one single file of plain text, not HTML, not MSWord. No fonts, no word-processing. Plain text only.

Did I mention that the format is plain text (suitable for VIM/Nano/Pico/Gedit or Notepad)?

NO EMAIL, WORD PROCESSOR, PDF, RTF, or HTML DOCUMENTS ACCEPTED.

No marks are awarded for submitting under the wrong assignment number or for using the wrong file name. Use the exact name given above.

WARNING: Some inattentive students don’t read all these words. Don’t make that mistake! Be exact.

READ ALL THE WORDS. OH PLEASE, PLEASE, PLEASE READ ALL THE WORDS!

Author: 
| Ian! D. Allen  -  idallen@idallen.ca  -  Ottawa, Ontario, Canada
| Home Page: http://idallen.com/   Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom:  http://eff.org/  and have fun:  http://fools.ca/

Plain Text - plain text version of this page in Pandoc Markdown format

Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen