Question 2 (marks 25)
One of your users has purchased an 8.0TB OWC Mercury Elite Pro ex-
ternal drive. The OWC drive contains 4×2.0TB Toshiba disks and has
hardware RAID 1, 5, or 10. The plan is to use it as a RAID 5 backup
storage. The RAID array will be connected to the work machine using
a USB3 cable.
Instead of using the normal backup levels the user would prefer to have
a current snapshot of his home directory while retaining differences
between snapshots. So when a backup is performed the user would like
the following to occur:
a. The snapshot on the backup disk be updated to exactly reflect
the current home directory. The backup disk will then contain a
current mirror of the home directory.
b. Before any of the files on the RAID array’s backup snapshot of
the home directory are deleted or overwritten, the files are copied
sideways (preserving the directory tree) into a backup directory
on the RAID array.
c. The backup directory should be converted to a single timestamped
file using TAR/GZIP. The filename should be of the form YYYYM-
MDDmmmm.tgz . This means the files can be easily sorted from
oldest to newest using the filename.
d. Only 30 days of TAR/GZIPed backup files should be kept.
The user expects to run the script at the end of each working day to
perform the current day’s snapshot as the user only wants to powerup
the RAID array while snapshots are performed. This will help protect
the data on the array from power failures (unless one occures during a
The user wants to run just one script which will be stored on the RAID
array. The procedure at the end of the day will be:
a. Powerup the RAID array.
b. Mount the RAID array.
c. Run the script stored on the array.
d. Check for error messages.
e. Un-mount and power down the array.
Your task is to write the script to perform the backup scenario outlined
The only tools you will be using are:
Used to create the TAR/GZIPed filename and check if files are
older than 30 days.
Used to archive all the files that would have been deleted or changed
when the current snapshot is made.
Used to create the current snapshot and copy deleted or changed
files sideways before the snapshot is created.
For the assignment, the following tasks need to be done:
a. (4 marks) Explain and demonstrate how date is to be used to
create the filename. Any options used must be explained. Exam-
ple runs must be presented to show that date works as expected
for the task.
b. (4 marks) Explain how from the list of backup filenames those
that are older than 30 days can be extracted.
c. (6 marks) Explain and demonstrate how rsync is to be used
to create the snapshot and backup. Any options used must be
explained. Example runs must be presented to show that rsync
works as expected for the task.
d. (11 marks) Put all of the above together into a script, with appro-
priate comments and error checking.
a. The scenario layed out above is exactly what I required when I
purchased the OWC external drive. The tools I used for the script
are exactly the ones listed above.
b. The reason filenames of the form YYYYMMDDmmmm is they natu-
raly sort from oldest to youngest!
c. The utility rsync can sync directories across a network or on the
same machine. It has many options and subtle responses depend-
ing on how the directory path is completed. These will have to be
experimented with from the command line before deciding which
are appropriate for this problem.
d. When placing commands in a script, you must always check to
see if they have worked correctly. On the command-line you
know if a command has failed, but in a script you must check—
because it may be run as a CRON job!
All processes when they exit—exit with a status code. Check the
process status code in the script — the shell special variable ?
(yes, that is a question-mark) contains the return value of the last
if [ $? -ne 0 ]
echo “failed to create backup directory”
Remember an exit value of zero means success, anything else is
Question 3 (marks 25)
a. (12 marks) In about a page explain in your own words what a
Logical Volume Manager is, its purpose and why it is useful.
b. (7 marks) Illustrate your explanation by using the Linux Logical
Volume Manager to combine the two spare 200MB disks available
on the Virtual Debian distribution. Combine the disks into one
logical volume of 400MB. Format the new logical disk and modify
the /etc/fstab file to mount the new disk at boot.
c. (6 marks) Document and explain in your own words the purpose
of every command you use (plus any command line options) and
any configuration files or scripts you modify or create.
a. Be certain to explain the meaning of any tehnical terms you may
use—for example, “physical volume”, “volume group”, &c.
b. Make use of the utilities pvdisplay , vgdisplay , &c. to show
the results of commands and that they have worked.
c. You must use the supplied virtual machine to answer this ques-
Question 4 (marks 25)
A user comes to you and explains that she needs some form of encrypted
file system to store sensitive information on a Flash drive. The Flash
drive will be used to transport the sensitive data between work and
home and she is worried about losing the drive and having the data
stolen. Both machines, the one at home and the one at work, use the
same Linux OS.
She has the following requirements:
• She does not want to encrypt individual files as she has to deal
with a large number of small text files.
• She wants it to be as transparent as possible.
• She thinks she will only need about 1GB at most.
• She wants to also use the flash disk for transporting unencrypted
files. Files that can be read on machines apart from her work and
A 1GB file that contains an encrypted file system, stored on the Flash
drive would appear to be ideal—
7a. (8 marks) Create a 1GB encrypted file system in a file on a Flash
drive so that it can be used with the cryptmount command.
Document and explain in your own words every command you
use (plus any command line options) and any configuration files
you modify or create. Your descriptions of each operation need
to show you understand the purpose of the operation.
b. Things you must also address and explain:
• (4 marks) how to ensure that the Flash drive has exactly the
same mount point each time it is used on different machines.
If it does not have the same mount point then how do you
configure the hardwired cryptmount paths?
Hint: Experiment with “labelled” file-systems or UUIDs
in conjunction with the file /etc/fstab
• (5 marks) how to securely manage the file-system encryp-
c. (8 marks) Write an instruction sheet for the user so that she can
make the modifications to her home machine and be able to access
the file on the flash drive containing the encrypted file system that
you have given her. You have to setup her work machine and then
instruct her how to setup her home machine.
Also explain how she would use the filesystem in her day-to-day
You may assume that she has root access to be able to configure
her home machine but does not have root access to her work ma-
a. This must be done on the Virtual machine supplied. This is as-
sumed to be the work machine you must setup.
b. Do not use the tool cryptmount-setup or the tool installed
by the package cryptsetup .
c. Manually create files and configuration files.
d. Follow the steps outlined in the cryptmount man page— ex-
plaining the purpose of every step!
e. You have root access to her work machine, so you will be setting-
up her work machine and the flash drive. The instructions are
for her to setup her home machine only based on how you have
configured the work machine.
f. List all resources used in answering the question.
8g. Do not explain how you installed the cryptmount package—it
should already be installed on the Virtual Debian.
Question 2 (marks 25)