|
|
Working with the Filesystem Table
Linux Tips by Burleson Consulting |
When adding a disk or changing disk layout it is
necessary to modify the file system table. The table is found in a file called
/etc/fstab. The following listing contains the contents of fstab on the test
server at this point:
$ cat /etc/fstab
LABEL=/ / ext3
defaults 1 1
LABEL=/boot /boot ext3
defaults 1 2
none /dev/pts devpts
gid=5,mode=620 0 0
none /dev/shm tmpfs
defaults 0 0
none /proc proc
defaults 0 0
none /sys sysfs
defaults 0 0
/dev/hdf2 swap swap
defaults 0 0
/dev/cdrom /mnt/cdrom
udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/cdrom1 /mnt/cdrom1
udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/hdc4 /mnt/zip auto
noauto,owner,kudzu 0 0
/dev/fd0 /mnt/floppy auto
noauto,owner,kudzu 0 0
Each line in the fstab file consists of six fields
separated by spaces or tabs.
The contents of the fields are described in Table 3.2,
as follows:
Field |
Description |
1 |
The physical device or remote file
system being described |
2 |
The mount point where the file system
will be mounted |
3 |
The type of file system on this
device |
4 |
A list of options which mount uses
when mounting the file system. |
5 |
This field is used by the dump backup
utility to determine if a file system should be backed up. If this field is
zero, the dump will ignore that file system. |
6 |
This field is used by the fsck file
system check utility to determine the order in which file systems should be
checked. If the field is zero, fsck will not check this file system. |
Table 3.2: fstab file fields
The /etc/fstab file can be modified to change what
devices will be mounted where or, in our case, to make a new device mount at
boot. Using a text editor (like vi which covered in chapter 5) we can carefully
add the following line to the /etc/fstab file to make new1 mount at boot:
/dev/hdb1 /new1 ext3 defaults 1 1
Our /new1 partition will now be available every time we
reboot the system! Be careful to double and triple check any changes to the
/etc/fstab file before rebooting the system.
LVM: The Logical Volume
Manager
While the management of hard disk volumes is an advanced
topic and will not be presented in detail in this guide, the Logical Volume
Manager (LVM) subsystem provided in Linux for Systems Administrators is worthy
of mention. It can be used to create and manage disk volume groups from
physical disk volumes. By allowing physically separate disks to be combined
into a single logical disk, LVM simplifies many aspects of disk management.
When working from a simple Linux workstation with one or two internal disk
drives, there will likely be no need to use LVM; however when administrating
Linux servers that have arrays of disks attached LVM can be invaluable.
The user must have root access in order to use the LVM
subsystem. LVM is a parameter driven subsystem controlled by specifications
found in the text file located at /etc/lvm/lvm.conf. The configuration file
contains several comments which describe each section. The LVM subsystem has
over 40 commands for the creation and management of volume groups. Though this
book does not cover LVM, table 3.3 below contains a partial list of available
LVM subcommands to give you a taste of what LVM is capable of:
Subcommand |
Function |
lvchange |
Change attributes of a logical volume |
lvcreate |
Create a logical volume in an
existing volume group |
lvdisplay |
Display attributes of a logical
volume |
lvextend |
Add space to a logical volume |
lvmdiskscan |
List devices that may be used as
physical volumes |
lvreduce |
Reduce the size of a logical volume |
lvresize |
Resize a logical volume |
vgcreate |
Create a volume group |
vgdisplay |
Display volume group information |
vgextend |
Add physical volumes to a volume
group |
Table 3.3: LVM subcommands and their functions
It is clear that LVM is a rather sophisticated
subsystem, and users definitely need to know what they are doing and be very
careful when using it; otherwise, it would be easy to clobber the disk
configuration and render the system unusable.
This is an excerpt from "Easy
Linux Commands" by Linux guru Jon Emmons. You can purchase it for only
$19.95 (30%-off) at
this link.