Chapter 6 Solutions
Review Questions
-
Which of the following directories should you back up regularly? (Choose all that apply.)
a. /etc
b. /home
-
An employee named Andrea wants to back up an entire home directory in a file. Which of the following commands should be used?
a. tar -cvf home.tar /home/andrea
-
Which of the following commands should you use to list all members in the project.tar archive?
d. tar -tvf project.tar
-
An employee complains that her home directory has disappeared. Which of the following commands should you use to extract the backup archive of her home directory?
b. tar -xvf home.tar
-
Which of the following options is used with the tar utility to add members to an archive?
b. -r
-
Explain the purpose of a snapshot file.
A snapshot file is used with the --listed-incremental option for the tar utility. This option specifies which files have been added to the archive. The tar utility checks the snapshot file, and if it contains files that aren’t members of the archive or the files have changed, the tar utility archives these files.
-
Explain the difference between full and incremental backups.
Full backups are backups of the entire file system. A full backup is also considered a backup of all files in a specific directory. An incremental backup contains all files that have changed since the last backup.
-
Which of the following cpio modes is used when creating an archive?
b. copy-out
-
Which of the following cpio modes is used when copying files from one directory tree to another without creating an archive?
c. copy-pass
-
Your company has a tight budget, and you have been asked to create tar archives to save space on the backup medium. Which of the following commands enables you to archive home directories and compress them at the same time?
a. tar -czf home.tar.gz /home
-
Describe the first five fields of the cron table.
Field
|
Allowed values
|
1: Minute
|
0–59
|
2: Hour
|
0–23
|
3: Day of the month
|
1–31
|
4: Month
|
1–12
|
5: Day of the week
|
0–6; 0 is Sunday and 6 is Saturday
| -
What’s the difference between a user cron table and a system cron table?
The main difference is the sixth field. In a user cron table, it’s the task to be performed; in a system cron table, it’s the name of the user who’s performing the task. Another difference is permissions. Only the root user has permission to edit a system cron table.
Activities
Activity 6-1
Step 4: Students should see the tar file; it should be 10240.
Step 5: Yes.
Step 7: Yes, the three files should be back, and the tar file should still be there because the tar utility doesn’t overwrite files. Instead, it makes a copy of the file and uses the copy as a member in the archive.
Activity 6-2
Step 7: Yes, the member stars is added to the archive because of the command in Step 6.
Step 9: The sun member was changed because content was added to the file in Step 8.
Step 15: The flower and moon members have been deleted from the archive.
Activity 6-3
Step 5: Students’ answers should be similar to the following:
-rw-r--r-- username/users 0 2012-04-26 19:07 blue
-rw-r--r-- username/users 0 2012-04-26 19:07 red
-rw-r--r-- username/users 0 2012-04-26 19:07 white
Step 7: They’re different because the --mode=777 option was used in Step 6. The members in file2.tar have rwx permissions for each category.
Activity 6-4
Step 8: The members are english, math, and history.
Step 13: Yes, they should all be restored.
Activity 6-5
Step 5: The ls -l command displays the following:
-rw-r--r-- 1 username users 512 2012-05-10 18:54 act6.5.cpio
-rw-r--r-- 1 username users 0 2012-05-10 18:53 strong
-rw-r--r-- 1 username users 0 2012-05-10 18:53 stronger
-rw-r--r-- 1 username users 0 2012-05-10 18:53 strongest
Step 7: The tilde (~) symbol represents the absolute path to the user's home directory.
Step 9: After all files are passed from the dir1 directory to the dir2 directory, the ls -l command displays the following:
-rw-r--r-- 1 username users 0 2012-05-10 18:57 act6.5.cpio
drwxr-xr-x 2 username users 4096 2012-05-10 18:57 dir2
-rw-r--r-- 1 username users 0 2012-05-10 18:57 strong
-rw-r--r-- 1 username users 0 2012-05-10 18:57 stronger
-rw-r--r-- 1 username users 0 2012-05-10 18:57 strongest
Activity 6-6
Step 3: The ls -l command displays the following:
-rw-r--r-- 1 username users 18202 2012-04-25 18:40 gzip.man
-rw-r--r-- 1 username users 15438 2012-04-25 18:40 tar.man
Step 5: Compression ratio is 67.8%. The size of tar.man.gz is 5012.
Step 7: For tar.man, it’s 67.7%; for gzip.man, it’s 65.2%.
Activity 6-7
Step 3: The ls -l command displays the following:
-rw-r--r-- 1 username users 18202 2012-04-25 18:40 gzip.man
-rw-r--r-- 1 username users 15438 2012-04-25 18:40 tar.man
Step 4: Students should get the following result:
The size of the gzip.man.bz2 file is 5885
Step 6: Students should get the following result:
gzip.man: 3.093:1, 2.587 bits/byte, 67.67% saved, 18202 in, 5885 out
bzip2.man: 2.938:1, 2.723 bits/byte, 65.96% saved, 18668 in, 6354 out
Activity 6-8
Step 2: An empty cron table should be displayed, unless the student has created a user crontab table on the machine as that user.
Step 6: The new cron table should be displayed.
Case Projects
Case Project 6-1
The command should look like the following:
tar -cvf home.tar -V "Backup of home directory" ~
Share with your friends: |