~ CHAPTER
8: FILE SYSTEMS ~
Linux is built upon the foundation of file systems. They are the mechanisms by which the disk gets
organized, providing all of the abstraction layers above sectors and cylinders.
By default Linux file system , ext2.
i-Nodes
The most fundamental building block of many UNIX file systems (including Linux’s ext2) is the i-node.
/usr/src/linux/include/linux/ext2_fs.h
Superblocks
The very first piece of information read from a disk is its superblock.
This small data structure reveals several key pieces of information, including the disk’s geometry,
the amount of available space, and most important, the location of the first I-node.
Without a superblock the file system is useless.
Ext3 and ReiserFS (very quick in class)
As of this writing, the ext2 file system is somewhere around seven years old. This means two
things for us as system administrators: First and foremost, ext2 is rock solid.
Mounting and Unmounting Local Disks
Partitions are mounted so that they appear as just another subdirectory.
The file-system management process begins with the root directory.
Keep in mind that a new directory is mounted, the mount process hides all the contents of the
previously mounted directory. So in our /usr, if the root partition did have files in /usr before
mounting /dev/hda3, those /usr files would no longer be visible. (They’re not erased, or course –
once /dev/hda3 is unmounted, the /usr files would become visible once again).
======================================================================
linux8.html PAGE
2 2002/07/17
Using the mount Command
Like many command-line tools, the mount command has a plethora of options, most of which
you won’t be using in daily work.
mount^-a and umount^-a
Using fsck
The fsck tool, short for File System Check, is used to diagnose and repair file systems that may
have become damaged in the course of daily operations.
Usually, the system runs the fsck tool automatically during the boot process (much in the same
way Windows runs Scandisk) if it
detects a partition that was not cleanly unmounted.
NOTE: fsck isn’t the
proper title for the ext2 repair tool; it’s actually just a wrapper. The fsck
wrapper tries to determine what kind of file system needs to be repaired and then runs the
appropriate repair tool, passing any parameters that were passed to fsck. In ext2, the real tool
is called e2fsck. When a system crash occurs, you may need to call e2fsck directly rather than
relying on other applications to call it for you automatically.
Where Disks Exist
Under Linux, each disk is given its own device name. IDE disks start with the name /dev/hdX,
where X can range from a through z, with each letter representing a physical device.
NOTE: It is acceptable to partition a disk so that only one large partition is taking up the entire
disk. But beware: If this is the boot partition, the entire partition must fit within the 1024
cylinder boundary, or you will not be able to boot.
IDE = hd
SCSI = sd
./fdisk/dev/had
(enter hda = primary and you can have a maximum of 4
======================================================================
linux8.html PAGE
3 2002/07/17
Making File Systems
With the partitions created, we need to put file systems on them.
Under Linux, we use two tools for this process: mke2fs to create ext2 file systems, and
mkswap to create swap file systems.
Network File Systems
Network file systems make it possible for you to dedicate systems to serving disks while
letting clients handle the compute-intensive tasks of users.
Mounting NFS Partitions
Mounting NFS partitions works much the same way as mounting local partitions.
Originated from Sun Micro Systems.
In NFS mounts, partitions are referenced by their hostnames and export directories. Thus,
if the server named technics is allowing your host to mount the directory /export/SL1200/MK2
and you want to mount this to /projects/topsecret1, you would use this command:
mount^technics:/export/SL100/MK2^/projects/topsecret1
Automounts are similar to a small peer-to-peer network.
Alternatives to Linux Automounter. AMD for Auto-Mounter Daemon. What made AMD so
popular was that it was the first truly cross-platform Automounter tool.
Quota Management
In any multiuser environment, you’re bound to run across users who either refusing to play fair
or because they’re oblivious to common courtesy, practice the fine art of disk hogging, taking
up more than a reasonable amount of space.
Set up disk quotas.
/etc/fstab file you must edit it.
You must enable Quotas you must have the files quota.user and quota.group.
======================================================================
linux8.html PAGE
4 2002/07/17
Configuring Quota Settings
Soft Limit. This requested limit is placed on a user or group.
Hard Limit. This limit is imposed by the operating system and cannot be overrun.
Grace Period (Time Limit). When a user’s account exceeds the soft limit, a clock starts tracking.
Command-line Options of edquota
When you invoke the edquota command, it brings up the configuration information for the
particular user, group or grace period you want to add or edit. By default, the vi editor is
used to display human-readable information.
Managing Quotas
· quotacheck
· repqutota
· quota
· quota^-v
Summary:
will be executed.