Updated: 2014-04-17 00:32 EDT
sdb
file
command – what is that thing?fdisk
mkfs
mount
mkswap
and swapon
root
password)Do not print this assignment on paper!
- On paper, you will miss updates, corrections, and hints added to the online version.
- On paper, you cannot follow any of the hyperlink URLs that lead you to hints and course notes relevant to answering a question.
- On paper, scrolling text boxes will be cut off and not print properly.
23h59 (11:59pm) Thursday April 17, 2014 (end of Week 14)
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.
This assignment is based on your weekly Class Notes.
root
password.)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. You also don’t get any of the later updates to the assignment. Do not print this assignment on paper.
You will create filesystem structure in your CLS home directory containing various directories and files. You will also make changes in your own Linux Virtual Machine running CentOS 6.5. You can use the Checking Program to check your work as you do the tasks. You can check your work with the checking program as often as you like before you submit your final mark. Some task sections below require you to finish the whole section before running the checking program; you may not always be able to run the checking program successfully after every single task step.
When you are finished the tasks, leave the files and directories in place on both the CLS and your own Linux Virtual Machine 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 on the CLS; you must have your term work available on the CLS right until term end.
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.
The current term’s course notes are always available on the Internet here: CST8207 GNU/Linux Operating Systems I.
All the current and previous terms notes files are also stored on the CLS. You can learn about how to read and search these files using the command line on the CLS under the heading Copies of the CST8207 course notes near the bottom of the page Course Linux Server.
All references to the “Source Directory” below are to the CLS directory ~idallen/cst8207/14w/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).
You do not have permission to list the names of all the files in the Source Directory, but you can access any files whose names you already know.
Review course notes on Partitions and File Systems and Booting and GRUB.
Use the on-line help (man
command) for the commands listed below for more information.
df
– show mounted partitions and amount of used/free space (optionally inodes available) on all mounted file systemsdu
– recursively display disk usage in directoriesfdisk
– to display, create, delete, and manage partitions; option -l
is very useful See Partitioning with fdiskfile
– determine what kind of thing a pathname is. Can show disk and partition file system types using option -s
and will follow (dereference) symbolic links using option -L
(upper case)mkfs
– create a file system on a device, usually a hard disk partition.mkswap
– initialize a partition for use as a Linux swap partition.mount
– mount a file system into the main file system tree or display a list of all mounted file systems, including devices, types, and mount pointsswapon
– tell the Linux kernel to use an initialized swap partition.umount
– detach (unmount) a mounted file system (e.g. that was mounted with mount
).uname
– display system information, including kernel release (version) numberrunlevel
– display previous and current system Run LevelMost of the commands in this assignment require root
privilege. You must use the su
command to start a shell with the permissions of another user. The root
user can use su
to become any other user without requiring a password.
If you start a root
subshell, your prompt will tell you if you are the root
user by changing to include a #
character instead of a $
character. You can also use the commands id
or whoami
to show your current userid.
Some answers require you to record command lines. Do not include the shell prompt with your command lines. Give only the part of the command line that you would type yourself.
Make sure you know the difference between a command line (which is what you type into the shell) and command output (which is what the command displays on your screen). Pay attention to whether the question asks you to record the command line or the command output.
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.
If you can’t get an SSH (PuTTY or ssh
) connection working into your Linux VM, see the Network Diagnostics page.
Note that SSH sessions (and whatever you are doing inside them) do not survive across a VMware suspend. Make sure you save your editor files and exit your SSH session before you pause or suspend your virtual machine. (Editor sessions that run inside the VMware console do survive across suspend and resume, since they don’t depend on a network connection.)
Advanced users may look into the various virtual terminal programs such as
tmux
andscreen
that do allow you to suspend and resume your sessions even from a remote login.
answer.txt
IndexWhere 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.
Do a Remote Login to the Course Linux Server (CLS) from any existing computer, using the host name appropriate for whether you are on-campus or off-campus.
Create the CLS directory ~/CST8207-14W/Assignments/assignment13
Create the check
symbolic link needed to run the Checking Program, as described in the section Part II - Check and Submit below.
Run Part II - Check and Submit to verify your work so far.
~/CST8207-14W/Assignments/assignment13
(the same hierarchy as you have already made on the CLS).This CentOS assignmment13
directory is the base directory for all pathnames in this assignment. Store your CentOS files and answers below in this base assignment13
directory.
Run the Fetch and Checking Program to verify your work so far.
sdb
IndexYou will add a second hard disk to your CentOS Virtual Machine, and partition it. The procedure for adding a hard disk to an actual physical computer is different only in the steps that take place while the machine is powered off. Any step carried out while the machine is running would be the same for physical machines as it is for virtual machines. The console of a physical machine is its actual keyboard and monitor, but in the case of a VM, the console is the VMware window of the machine.
Most of the system admin commands in this assignment access the raw disk and will require you to use su
to gain root
permissions (unless you are in single-user mode and therefore running everything as root
). If you get “permission denied” errors, you forgot to use su
.
With your CentOS machine still powered off, use the VMware Settings menu for your CentOS VM to add to your VM a virtual 1GB
hard disk, accepting defaults for everything except the size. See Create VMware Disk. Create the disk exactly 1GB
in size.
After adding the new disk, power on your VM, then login as your system administrator user.
/proc/partitions
file contains the second disk you added.
1048576
.1048576/1024/1024
to confirm the number of gigabytes.sdb1
or sdb2
or other sdb
partitions, this is not a new disk with no partition table. Get help.When the second disk is correct, copy /proc/partitions
to file partitions_before.txt
in your CentOS base directory (6 lines, 20 words). Remember: all files should be placed under your sysadmin base directory on CentOS.
/dev
directory. Put a long (ls -l
) listing of all names under /dev
that start with the first two letters of the new disk name into file sd_all.txt
in your base directory.
file
command – what is that thing?IndexThe Unix/Linux file
command is very useful for identifying things in the file system, such as directories, programs, images, files, and special files that might contain file systems, such as disk partitions:
Run file -s
on (the device name of) 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:
# file -s /dev/sd[ab]
/dev/sda: x86 boot sector; GRand Unified Bootloader, ...
/dev/sdb: data
Save the two lines of file
output in a file_s.txt
file (2 lines, 44 words) in your CentOS base directory.
fdisk
Index1GB
hard drive in VMware and rebooted, as described above. Log in to the machine.Let’s look at the partitions on the first disk (sda
):
Run (always with root
privileges) fdisk -cul /dev/sda
and you will see the two partitions on your first (sda
) disk that holds your main ROOT file system:
# 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: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 3074047 1536000 83 Linux
/dev/sda2 3074048 4194303 560128 82 Linux swap / Solaris
DO NOT OVERWRITE /dev/sda
THAT IS YOUR MAIN CENTOS INSTALLATION DRIVE!
Now let’s look at the second disk (sdb
) that should have no partitions:
Run (always with root
privileges) fdisk -cul /dev/sdb
and make sure you see Disk /dev/sdb: 1073 MB
with no errors and no partitions listed under it.
# fdisk -cul /dev/sdb
Disk /dev/sdb: 1073 MB, 1073741824 bytes
If you don’t see 1073 MB
, then shut down, delete the disk, recreate the disk, and reboot until your 1GB disk install works.
Make sure you only change things on this new
sdb
disk in this section! Thesda
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!
man
page for the fdisk
command, locate and make a note of two option letters:
We are now going to run the fdisk
program in interactive mode.
To learn more on how to use
fdisk
, see your in-class notes or see http://tldp.org/HOWTO/Partition/fdisk_partitioning.html
fdisk
interactively as root
using the command fdisk
devicename
, where devicename
is the absolute path of the device corresponding to the new disk under /dev
.
fdisk
starts, read the upper-case WARNING
about DOS-compatible mode. This is a serious (strongly recommended) warning!fdisk
program. Do not continue.fdisk
command, this time inserting the two option letters you found in the man
page, above. (Keep the same device name.)
WARNING
should be gone when you start fdisk
with those two options. (One other harmless warning about an invalid flag will remain. This is normal, since the new virtual disk is empty and has not been initialized yet. Ignore the one warning.)fdisk
options on CentOS. (Other versions of fdisk
use these options as defaults.)You should avoid this DOS warning message in future by always using the
-cu
command line options tofdisk
(RTFM) when you run it, even non-interactively. You might even consider making a shell alias that always supplies these two options tofdisk
every time you use it:alias fdisk='fdisk -cu'
fdisk
utility should now be running in interactive mode, prompting you for input with a different prompt from your BASH shell prompt: Command (m for help):
fdisk
utility prompt.fdisk
program prompt!m
for a list of helpful fdisk
interactive command letters.Inside interactive fdisk
use the command to display the partition table and verify that the disk you are working on is the 1GB
disk (1073MB) with no partition table and no partitions.
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.
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 Fetch and Checking Program to verify your work so far.
fdisk
IndexTo 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 sometimes 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.
First, make sure the disk you are about to change has no partitions configured. If you see partitions, you are using fdisk
on the wrong disk. Make sure you use fdisk
on the new disk device name!
M
, not MB
, inside fdisk
. Using MB
as a suffix creates partitions using power-of-ten MegaBytes (1,000,000) instead of power-of-two MebiBytes.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.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.End
sector must be 411647
. If it is less, re-read all the words in this question, especially the words in the sentence starting with “Use the suffix…”.Number of blocks
must be 102400
. (If it is less, re-read all the words in the previous question.)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!)
Create these three logical partitions inside the extended partition that you created in the previous step:
If you run out of space creating the logical partitions inside the extended partition, you can delete the extended partition 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). Hint: 610M
is too big; make it smaller.
2097151
W95 FAT32 (LBA)
.Did you remember to set the correct partition types (system id) on each of the seven partitions?
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.
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.
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.)
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).
Look at your new disk (only the new disk) and record these three answers (just the answers) on lines in The Answer File:
Hint: Re-read the word absolute in the above sentences.
fdisk
Indexfdisk
interactively. (Remember the two options to avoid DOS warnings!)
Linux
(System ID 83) partitions left.sdb
.fdisk
without saving any changes.
fdisk
interactively again. (Remember the two options to avoid warnings!)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
.sdb
.fdisk
to exit. You will return to your shell prompt.Run the Fetch and Checking Program to verify your work so far.
Take a VMware back-up snapshot now and name it something like done_fdisk
.
fdisk
interactively to delete all the partitions and then re-create them again, without writing out your changes.
mkfs
IndexAfter partitioning a disk, the next step is making file systems inside the partitions. You must have six partitions available to continue with this section.
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 200M 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.
Linux
(System ID 83). (These should be exactly two of the six partitions.)
file -s
on this empty partition and note the uninteresting output when the partition has no file system in it.ext3
file system on this partition.
file -s
on this same partition name again to show the type of file system in the partition.
ext3 filesystem data
ext4
this time.
W95 FAT
partition:
vfat
this time.
mkfs.vfat: No such file or directory
whereis mkfs.vfat
yum whatprovides '*/mkfs.vfat'
yum
will update some internal files then tell you that the missing package name is dosfstools
(with a version number).dosfstools
package.
which mkfs.vfat
now finds the command./sbin
is in your PATH
.)vfat
this time.
dosfstools
package, everything will work correctly with no errors.HPFS/NTFS
partition:
ntfs
this time.
mkfs.ntfs: No such file or directory
whereis mkfs.ntfs
mkfs.ntfs
file name.
yum
will update some internal files then tell you No Matches found
yum
repositories for software! :-(
Run the Fetch and Checking Program to verify your work so far.
Take a VMware back-up snapshot now and name it something like done_mkfs
.
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!
mount
IndexAfter 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 three new file systems to continue.
mount
command with no arguments.
vmware-vmblock
device mounted.sda1
), unmount the partitions now before continuing.mount
output as a mount_before.txt
file. (6 lines, 36 words or 7 lines, 42 words if you use VMware)/mnt/ext3
, /mnt/ext4
, and /mnt/vfat
to use as mount points for all the file systems you successfully created above.
mount
command will generate error messages such as mount point /mnt/ext3 does not exist
.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.)
mount
can tell. If mount
says you must specify the filesystem type
then almost surely there is no file system created in that partition. Fix it and then try again.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. Ifmount
ever gives the erroryou must specify the filesystem type
, it is because there is no file system created inside that partition. Thefile -s
command can confirm this for you. Create the file system first, then mount it.
mount
Indexmount
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.)
mount
output as a mount_after.txt
file. (9 lines, 54 words or 10 lines, 60 words if you use VMware)Save the output (run as root
) of file -s /dev/sd*
as a file_after.txt
file. (10 lines)
root
) of the command blkid
as a blkid_after.txt
file. (at least 5 lines)
UUID
values that you could use to uniquely identify each partition in the first column of the /etc/fstab
file. (Do not use UUID
mount names in this assignment; use the device partition names when the time comes.)ls -lid / /mnt/ext?
to see the inode numbers of the three Linux directories mounted on your system.
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.)Take a VMware back-up Snapshot now and name it something like done_3mount
.
df
Indexdf
(“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.
df -h
to see the sizes of the file systems.The two new, empty Linux file systems we just mounted show about 5.6MB
of space used. Why is a new file system not empty? (This question may appear on your final exam.)
If you add up the Used
plus Available
disk space on a VFAT
(DOS) file system, it exactly equals the Size
of the file system. If you add up Used
+Available
on a Linux
file system, it is usually about 5% smaller than the Size
of the file system. Why? (This question may appear on your final exam.)
du
IndexThe
du
command walks the file system and recursively shows the disk usage in every directory under a directory.
- With the
-s
option, only thesummary
of the disk usage is shown.- With the
-h
option, the output is given in “human-readable” form (similar to the same option todf
).- With the
-x
option,du
will stay within a file system and not follow directories that are mount points.
du
to show a summary of the human-readable amount of disk space on only the /
(ROOT) file system.
Compare the speed of running the above du
command (which has to walk the entire ROOT directory tree) against the speed of running df
in the previous section. This is why sysadmin prever df
!
mount_before.txt
file. Only seven lines!Run the Fetch and Checking Program to verify your work so far.
mkswap
and swapon
IndexLinux swap
partition on your new 1GB disk.
file -s
on the Linux swap
partition.
swap file
swap.txt
file. (3 lines, 15 words)Run the Fetch and Checking Program to verify your work so far.
Take a VMware back-up snapshot now and name it something like done_swap
.
For practice, repeat this section again, re-typing each of the commands you used to initialize and enable the swap partition. Would you remember how to do this when asked to demonstrate it at a job interview? When installing a new disk? Practice!
Your Linux kernel has a version number, as in “What version of the kernel are you running? I’m running version 2.6.32
”.
Unfortunately, the command that prints system information, including the kernel version number, calls the number a kernel release number, because it uses the option name version to stand for the kernel compile date. When using this system information command you must use the option named release to display the kernel version number.
2
on CentOS.)3
on the CLS – the CLS runs a newer kernel than CentOS.)Run the Fetch and Checking Program to verify your work so far.
root
password)IndexIf you find yourself locked out of a Linux machine, and you have access to the console, booting into single user mode will will often not require a password, and in single-user mode you are given a
root
shell and can change passwords or perform various other repair tasks. (Some systems do password-protect single-user mode, in which case you would need to boot a “live” or “rescue” CD to reset yourroot
password.)
Review Booting and GRUB.
This section depends on a successful CentOS Virtual Machine installation, including a visible (not hidden) GRUB menu. (You made these changes when you configured CentOS in an earlier assignment.)
To change a forgotten root
password or do maintenance on the system that requires it to be quiescent (no users or disk activity), you can boot your system in a restricted single-user mode that does not start many system daemons and goes directly into a root
shell prompt on the system console without requiring a password.
The system should not be left in single-user mode; many service programs are not started. Networking may not be enabled; you may not even be able to log-in remotely in single-user mode.
kernel
line in that file. Note all the options used on the right end of the kernel
line; you will see them again soon.
Record on Line 22 in The Answer File the kernel option keyword used in booting a machine single-user (maintenance mode). (one word)
hiddenmenu
command in GRUB, you will boot directly to the GNU GRUB menu where you should see a one-line list of CentOS systems to boot and at the bottom a 30 second countdown in progress.hiddenmenu
, when the countdown is interrupted your system should display the one-entry GRUB menu.)a
– just the letter key, no [Enter]
key!
a
you will see your cursor on a line that ends with the same kernel
arguments you viewed earlier in the configuration file.[Home]
key to zoom to the left end of the kernel options line, and the [End]
key to zoom to the right.root
shell prompt. (If you get a login
prompt, you didn’t use the right kernel option keyword. Reboot into GRUB and try again.)
root
function at this prompt, including changing passwords (even the root
password).From the single-user shell, place a full list of all processes for all users, BSD format, text user name (not numeric UID), full wide listing (not truncated at all), into a psbsd_single.txt
file. (All assignment answer files must be saved in your sysadmin base directory.) The output should be approximately 52 lines and 4KB. All the processes will be owned by root
. The first two lines should look similar to this:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.5 2900 1380 ? Ss 16:35 0:01 /sbin/init
Remember to fix the owner and group of the file.
Use the command that displays the previous and current Run Level (two words on one line) and record this line of output as Line 23 in The Answer File.
login
prompt should appear on the console.Run the Fetch and Checking Program to verify your work so far.
That is all the tasks you need to do.
Check your work a final time using the Fetch and Checking Program and save the output on the CLS as described below. Submit your mark following the directions below.
Optional: Keeping your main CentOS Virtual Machine snapshot, remove any intermediate snapshots you no longer require, to free up disk space. - Be careful not to remove your current work!
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.
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 the mistakes detected by the Checking Program.
The checking program resides on the Course Linux Server, but your work is on your CentOS Virtual Machine. There is a 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 on your CentOS VM when you make changes on your CentOS Virtual Machine.
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.
Failure to read all the words will lock your account out of the CLS.
root
account (same userid as Blackboard).CST8207-14W/Assignments/assignment13
(use the same directory hierarchy as you already have in your own account on the CLS). This is your base directory for this assignment.curl
to get a copy of the Fetch program from the given URL into a file named do.sh
. Make sure you have a file named do.sh
in your sysadmin base directory. You only need to download this once per assignment.curl
program.$ whoami ; hostname ; pwd
abcd0001 # your userid, not abcd0001
abcd0001 # your userid, not abcd0001
/home/abcd0001/CST8207-14W/Assignments/assignment13
$ url=http://teaching.idallen.com/cst8207/14w/notes/data/assignment13do.sh
$ curl -A mozilla "$url" >do.sh
[... make sure you scroll right to read the full web URL above ...]
[... various download statistics print here ...]
$ fgrep -i 'error' do.sh # make sure no errors (no output)
$ head -n1 do.sh # make sure it's a shell script
#!/bin/sh -u
You must run the do.sh
script you just downloaded. You must run the script as the root
user with the USER
environment variable set to your own CLS account userid. (Do not use abcd0001
; use your own.) Failure to set the USER=
variable as shown below will cause your account to be locked out of the CLS.
Use su
to run the do.sh
script:
$ echo "$USER" ; pwd
abcd0001 # your userid, not abcd0001
/home/abcd0001/CST8207-14W/Assignments/assignment13 # your userid, not abcd0001
$ su -c "USER=$USER sh do.sh" # must be double quotes, not single
This do.sh
script runs a Fetch program that will connect from your CentOS machine to the CLS using your account name in the USER
variable. It will copy selected files from your CentOS machine 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, as shown below:
---------------------------------------------------------------------------
abcd0001: FETCH version 3. 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 9 run by abcd0001.
Please wait; collecting info from abcd0001 Virtual Machine
---------------------------------------------------------------------------
VM files collected into CST8207-14W/Assignments/assignment13/abcd0001.tar.bz on CLS.
Now running checking program for abcd0001 on CLS:
[... checking program output appears here ...]
tar
archive in your account under assignment13
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 existing files saved under assignment13
on the CLS..bashrc
file or world-writable files on the CLS). These errors are on the CLS, not on your CentOS machine.When you are done with your assignment, you need to run the checking program one last time on the CLS (not from CentOS) and submit the output file, as follows:
Do all this on the Course Linux Server when you are ready to submit:
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.
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 task 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.
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.
YOUR MARK for
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.
YOUR MARK for
Upload the assignment13.txt
file under the correct Assignment area on Blackboard (with the exact correct 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 need to comment on any assignment submission, send me email.
You can upload the file more than once; I only look at the most recent. You must upload the file with the correct name; you cannot correct the name as you upload it to Blackboard.
You will also see the Review Submission History page any time you already have an assignment attempt uploaded and you click on the underlined assignment13 link.
You cannot delete an assignment attempt, but you can always upload a new version. I only mark the latest version.
Your instructor may also mark files in your 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!
I do not accept any assignment submissions by email. Use only the Blackboard Attach File. No word processor documents. Plain Text only.
Use the exact file name given above. Upload only one single file of Linux-format plain text, not HTML, not RTF, not MSWord. No fonts, no word-processing. Linux plain text only.
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 16-character, lower-case 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!