Cis 191 Lab 7
Cis 191 Lab 7
The purpose of this lab is to explore the structure of the EXT filesystem used throughout
most Linux Distributions. We will run commands that allow you to create file systems
configure the superblock, modify inode information, perform file system checks, and
implement disk quotas.
The objective of this lab is to move the home directories of users from the root file system
to a separate file system where we can implement disk quotas.
Supplies
• VMWare Server 1.05 or higher
• Benji VM or CentOS 5 ISO
Preconfiguration
Forum
If you get stuck on one of the steps below don’t beat your head against the wall.
Use the forum to ask for assistance or post any valuable tips and hints once you
have finished. Forum is at: http://simms-teach.com/forum/viewforum.php?f=13
Background
File systems are storage structures that allow the computer system to maintain the integrity
and whereabouts of large numbers of different files in a quick and secure manner.
Regardless of the type of file system, UNIX/Linux file systems treat files as having three
distinct components:
Typically, file systems are used to format partitions of a hard disk, floppy or CD-ROM. In
this section, we are going to add and format a logical partition on the hard disk.
1. Log on as root and use the fdisk command to add a new 200 MB logical partition
(/dev/sda7) to your hard drive.
2. Use the fdisk –l command to verify that the new /dev/sda7 partition has been
created. If you made a partition that is larger than 200MB, delete it and make it
again.
3. Format this partition with an ext3 file system that contains 800 inodes:
mkfs -t ext3 -N 800 /dev/sda7
4. Before we mount the file system, lets look at the superblock structure:
dumpe2fs /dev/sda7 | more
Note the following fields:
o Filesystem volume name
o Filesystem state
o Inode count
o Block count
o Block size
o Maximum mount count
5. Let's configure some of these fields with some file system commands:
e2label /dev/sda7 /home # adds a volume name
tune2fs -c 24 /dev/sda7 # changes maximum mount count
6. Check your modifications using the dumpe2fs command.
File systems are controlled by device drivers, and therefore are treated as devices.
To make the files within a file system available to users, the file system device must be
mounted to a directory of an already-mounted file system (usually root).
1. As root, mount your new file system to the /home mount point with the following
command:
mount -o usrquota /dev/sda7 /home
What would you do if you wanted this file system mounted like this every time you
booted the system?
2. Change directory to /home and verify that all your user directories are there.
3. Analyze this file system for current disk usage:
quotacheck -cuv /dev/sda7
Notice the datafile that gets created for holding this quota information. What is its
name?
4. Now turn on user quotas on with the command:
quotaon -uv /dev/sda7
5. On another screen, log in as gimli and issue the quota command.
What does it say?
6. Go back to your root login and setup a quota for this user using the following
command:
edquota gimli
Notice the beautiful user interface! You are in vi, and you can edit the soft and hard
fields in this file. Note they are currently 0. Notice that you can set quotas on disk
space (blocks) or on number of files (inodes). Set Gimli’s soft quota to be 2MB and
his hard quota to be 2.5 MB:
7. Once you've setup the quota for gimli, test it out by logging in as gimli on another
terminal or Putty session and start using up his diskspace. Either copying files into
gimli’s home directory or use a script like the following. You should reach the limits.
8. To make this quota persistent across reboots, you will have to add the usrquota
keyword to the options column of the appropriate entry in /etc/fstab. Do that now.
To Turn in
Review you work in lab07 before submitting to make sure you have covered each
area of the grading rubric. Then submit your work using: