----------------------- Exercise #7 for NET2003 due March 1, 2005 ----------------------- -Ian! D. Allen - idallen@idallen.ca Remember - knowing how to find out an answer is more important than memorizing the answer. Learn to fish! RTFM! (Read The Fine Manual) Global weight: 1% of your total mark this term Due date: 23h00 Tuesday March 1, 2005. The deliverables for this exercise are to be submitted online on the Course Linux Server using the "datsubmit" method described in the exercise description, below. No paper; no email; no FTP. Late-submission date: I will accept without penalty exercises that are submitted late but before 23h00 on Thursday, March 3. After that late-submission date, the exercise is worth zero marks. Exercises submitted by the *due date* will be marked online and your marks will be sent to you by email after the late-submission date. This exercise is due 23h00 Monday March 1, 2005. Exercise Synopsis: Marks: 1% Examining your hard drive - partitions and start-up scripts. Where to work: Do your Unix command line work on your Knoppix CD with your hard drive caddy installed. Save your answers by copying them to the Course Linux Server using scp. (Make sure you can do the scp correctly before you start!) Exercise Preparation: See notes and readings in: week06notes.txt, week07notes.txt, script_style.txt ----------------------------------------- Exercise Details (on your Knoppix System) ----------------------------------------- Have you done all the preparation steps? If not, go back and do them. Finish your Notes Readings (see the weekly Notes files). Any questions? See me in a lab or post questions to the Discussion news group (on the top left of the Course Home Page). Most of the work under Knoppix will require that you become the root user using the "su" command. Your prompt will change to include a "#" character, warning you that you have elevated privilege. Scripts must follow the NET2003 script writing style and guidelines: script_style.txt You must copy all your files to the Course Linux server for submission before you shut down Knoppix; otherwise, you will lose them. ---------------------- Part I - partitions.sh ---------------------- Using VI/VIM, create in your Knoppix account an executable script named partitions.sh. Save this script off-machine before you shut down Knoppix! Linux IDE-style disk drives are given names such as /dev/hda, /dev/hdb, etc. The sfdisk command can generate a list of partitions on a disk: # sfdisk -l /dev/hda Disk /dev/hda: 24321 cylinders, 255 heads, 63 sectors/track Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/hda1 * 0+ 2 3- 24066 83 Linux /dev/hda2 3 64 62 498015 82 Linux swap /dev/hda3 65 24320 24256 194836320 83 Linux /dev/hda4 0 - 0 0 0 Empty Write a script that takes exactly one mandatory argument (just the last letter part of an IDE disk name) and generates a list of disk partitions and their "System" types for that disk: # ./partitions.sh a /dev/hda1 Linux /dev/hda2 Linux swap /dev/hda3 Linux /dev/hda4 Empty Issue an error message if the wrong number of arguments is given, or if the pathname /dev/hdX does not exist (where X is the argument letter). HINTS: Pathnames /dev/hd* are not files and are not directories. Both "test -f" and "test -d" fail on these devices. You may find it helpful to translate away the Boot flag on a line so that it doesn't make column counting and field selection difficult. Putting a "^" at the start of a grep pattern makes the pattern match only at the beginning of a line. Your scripts must meet the standards for NET2003 scripts, as described in the Notes file script_style.txt . Scripts without added comment lines will not be marked. ------- Part II - week7answers.txt ------- Prepare a text file week7answers.txt with your assignment label in it. Under the label answer these questions about your Knoppix Linux system: 0. Please number each answer clearly! 1. List the absolute pathnames of all the numeric "rc" run level directories defined in your Knoppix Linux system. 2. What is the number of the "halt" run level? 3. What run scripts will be stopped in run level 4? Give the run-level name (the symbolic link name) and the real name (the name linked to under the init.d directory). 4. What run scripts will be started in run level 6? Give the run-level name (the symbolic link name) and the real name (the name linked to under the init.d directory). 5. What is the purpose of the rcS.d directory? (Hint: The inittab file mentions a script named rcS that uses this directory.) 6. What directory is also processed by the rcS script, for compatibility with other versions of Unix/Linux? 7. With reference to the previous question, how many start-up scripts are in this compatiblilty directory? 8. Knoppix starts very few services at boot time; but, many services are available to be started. How many master start-up scripts are potentially available to be started up on Knoppix? 9. Which master start-up script contains the name "pool.ntp.org"? 10. With reference to the previous question, when you attempt to start up that server using its master start-up script and the single argument of "start", nothing happens. No server is actually run. The script exits without doing anything. Why? How could you fix the Knoppix system to run the server, using the defined argument "pool.ntp.org"? Fix the problem and start the server. (You will know you succeed when you see a message about synchronizing the clock.) ---------- Submission ---------- Remember to copy your work off your Knoppix system before you shut it down! Submit the files for marking: $ datsubmit 07 partitions.sh week7answers.txt Always submit all files for marking at the same time.