In this chapter, we have covered the types of partitions you will create. A primary partition is necessary for an operating system to boot. An extended partition is a container for logical drives that are then used to store data. Linux also has a special type of partition called a swap partition, which are used as virtual memory.
The fdisk utility is used to create these partitions. When creating a new partition, you must designate the beginning and ending cylinders. After the partitions are created, you must create a filesystem by using the format command.
The fsck command is used to examine the filesystem for errors and can be used to repair any errors found. Other utilities you can use to monitor your disk's health are the df and du commands, which are used to determine partition size and usage.
QUESTIONS AND ANSWERS
1. After installing a new hard disk, what is your first step?
A. You first will need to partition the hard disk. You can create up to four partitions on a single hard disk.
2. Before installing Linux on your computer, what should you do to prepare the hard disk?
A. After partitions have been created, you must associate each one with the appropriate filesystem and format the partitions so you will be able to save files to it.
3. Although you have 2GB of free space on your hard disk, when you use fdsk to create the partition, you receive an error and the action fails. Why?
A. One of two things might be the problem. First, if you already have four partitions on the hard disk, you will not be able to create any more partitions no matter how much free space you have. The second possibility is that you are trying to create an extended partition and one already exists. You can have only one extended partition at a time.
4. What can you do if you want to install Linux on a computer that is running Windows 95 and does not have any free space?
A. You can shrink the partition by using the fips program, provided that not all the partition is occupied by files. This will work as long as the partition is formatted with FAT16.
5. What do the terms hda1 and sdc3 mean?
A. These are both names of partitions. The first example, hda1, refers to the first partition on the first IDE drive. The second example, sdc3, is the name of the third partition on the third SCSI disk.
6. After creating a new partition, what might keep you from installing a new application on it?
A. One potential problem would be if there were not enough unoccupied space on the partition to house the application. Also, you must format a partition before you can save files to it.
7. Your system will not boot and you suspect that you have a corrupted filesystem. What should you do?
A. The most common problem is that the superblock is corrupted. First, you will need to boot your system from a floppy. Then, use the e2fsck command and one of the copies of the superblock to repair the damaged superblock.
8. How can you determine whether or not the system you administer has an adequate amount of disk space?
A. You can use the du command with the -s option to determine how much space is being used and then subtract that number from the size of each partition. A better solution, however, is to use the df command, which provides you with the total size of each partition, amount of space being used, and amount of free space available.
On a system with 8MB of RAM, what is the minimum and maximum recommended sizes of the swap partition?
When using the fdisk command, how do you indicate what size to make the partition?
You have three partitions on your hard disk and 2GB of free space. You need to install an application that needs two partitions, a 50MB and a 300MB partition. What should you do?
After creating your swap partition, what do you need to do to make it available to use for swapping by the operating system?
Which of the following pieces of information is not necessary to pass to the mkfs command?
The inode structure contains all of the following, except
You want to run fsck on your root partition. Which of the following will not enable you to do this?
You need to prepare a report for your supervisor with the total space used by each user. What command would help you prepare this report?
You need to prepare a report that will be the basis of planning for needed hard disk space expansion. What command could you use to help prepare it?
The partition containing users' home directories is full. Which of the following solutions would not work?
a. 8MB minimum, 16MB maximum
b. 8MB minimum, 128MB maximum
c. 16MB minimum, 16MB maximum
d. 16MB minimum, 128MB maximum
Answer a is incorrect; the swap partition should be equal to twice the amount of RAM and can be up to 128MB. Answer b is incorrect; the swap partition should be twice the amount of RAM. Answer c is incorrect; although the minimum size is correct, the maximum allowable size is 128MB. Answer d is correct; the minimum should be twice the amount of RAM (or 2x8MB) and the maximum allowable size is 128MB.
a. Indicate the starting and ending cylinders, which can be located anywhere on the hard disk.
b. Pass the size of the partition as +nM to the fdisk command from the command line.
c. Enter the starting cylinder, which should immediately follow the last partition and the ending cylinder or size.
d. After selecting n to indicate a new partition, indicate its size as +nM.
Answer a is incorrect; the starting cylinder must be the next one after the ending cylinder of the prior partition. Answer b is incorrect; fdisk takes only the name of the partition to divide as an argument. Answer c is correct; you must enter the starting cylinder, which has to be the next one after the ending cylinder of the last partition. You can then enter either the ending cylinder or the desired partition size, such as +80M, to create an 80MB partition. Answer d is incorrect; you must first specify the starting cylinder before the size of the partition.
a. Create two new partitions in the free space.
b. Create a new primary partition of 350MB and then use mkfs to divide it.
c. Create a new extended partition of 2GB in size and then create two logical drives, one 50MB and one 350MB in size.
d. Back up one of your partitions, delete it, and then re-create it, making it 350MB bigger.
Answer a is incorrect; you can have only a total of four partitions. Answer b is incorrect; the mkfs command is used to create a filesystem on the new partition. Answer c is correct; because you can have only a total of four partitions, you must create an extended partition that can be divided into logical drives. Answer d is incorrect; although you could do this, it would not create the separate partitions you need.
a. Format the partition with the mkfs command.
b. Change the type of partition to type 82 using the fdisk command.
c. Format the partition with the mkfs.swap command.
d. Pass the name of the partition to the kernel at boot.
Answer a is incorrect; the swap partition does not need to be formatted. Answer b is correct; the swap partition needs to be designated as such by changing its type. Answer c is incorrect; there is no mkfs.swap command. Answer d is incorrect; you must change the type of a partition to make it a swap partition, not designate it as such on boot.
a. Filesystem type
b. Size of partition in bytes
c. Partition name
d. Size of partition in blocks
Answer a is incorrect; you must tell mkfs the type of the filesystem to apply to the partition. Answer b is correct; the mkfs command does not need to know the number of bytes on the partition. Answer c is incorrect; you must tell mkfs which partition to format. Answer d is incorrect; you must tell mkfs how many blocks are present on the partition you are formatting.
b. Access permissions
c. The file's owner
d. Date and time the file was last accessed
Answer a is correct; the filename is stored in the directory, not the inode structure. Answer b is incorrect; the permission block is stored in the inode. Answer c is incorrect; both the owner and group names are stored in the inode. Answer d is incorrect; the times the file was last accessed and last modified are stored in the inode.
a. Boot with a floppy and then run fsck on root.
b. Start in single-user mode and then run fsck.
c. Use fsck with the -f option to force the check.
d. Configure fsck to run at boot.
Answer a is incorrect; if you boot from a floppy, you will be able to run fsck. Answer b is incorrect; booting into read-only, single-user mode will enable you to run fsck on root. Answer c is correct; there is no -f option to force fsck to run on a mounted filesystem. Answer d is incorrect; the most common time to run fsck on root is during boot.
c. ls -l
Answer a is correct; the du command displays the amount of disk space being used. Answer b is incorrect; the df command shows the amount of space used on an entire partition. Answer c is incorrect; this displays a list of all the files and their attributes. Answer d is incorrect; the wc command counts the words, characters, and lines in a file.
c. ls -l
Answer a is incorrect; the du command displays the amount of disk space being used. Answer b is correct; the df command shows the amount of space used on each partition. Answer c is incorrect; this displays a list of all the files and their attributes. Answer d is incorrect; the wc command counts the words, characters, and lines in a file.
a. Create a new partition and move some users' home directories to the new partition.
b. Back up the data, delete and re-create the partition with a bigger size, and then restore the data.
c. Delete or move unused files.
d. Instruct users to save files in another partition.
Answer a is incorrect; by creating a new partition and moving some users' home directories you will solve your space problem. Answer b is incorrect; this is the only method available to enlarge a partition. Answer c is incorrect; this would be a good stopgap measure, but your space problem will likely recur. Answer d is correct; by instructing users to save files to a different partition, your organization scheme becomes chaotic, making files harder to find.