Objectives: At the end of this module, you would have gained fair knowledge on: •Concept of Device Files •Administering Disk Drives •Concept of RAID

Basic Concepts of Devices
Devices are either block devices or character devices. A character device is one from which you can read a sequence of characters – for example, the sequence of keys typed at keyboard or the sequence of bytes sent over a serial line. Character devices are also referred as sequentially accessed devices. A block device is one that stores data and offers access to all parts equally; diskettes and hard disk are block devices. Block devices are also referred as random access devices.

The general device names used for disk drives are given below

dev/hda- IDE Hard disk – Primary Master. dev/hdb dev/hdc dev/hdd – IDE Hard Disk – Primary Slave. – IDE Hard Disk – Secondary Master – IDE Hard Disk – Secondary Slave.

dev/sda- First SCSI Hard Disk dev/sdb – Second SCSI Hard Disk

dev/fd0 – Floppy Disk Drive. dev/cdrom device file – Cdrom Drive – Linked to corresponding Hard Disk

The Mount Command
For accessing a block device you have to mount it in the file system. The location you are mounting the device is called the mounting point. A mounting point is subdirectory which can be created any where in your file system. After mounting a device to the mounting point, what ever you are writing to or read from the mounting point subdirectory will reflect on the corresponding device. The subdirectory used to mount a device may not contain any file. If it contains some files that can not be accessed after the mounting.

he general format of the mount command is given below:

mount –t type mount-point




option is used to specify the type of the file system. Linux will support a variety of file systems. Some of the file systems supported by Linux is given below. Ext2 - Native linux file system

option is used to specify the mount options. Some of the mount options are given below. o w xec – Mount the file system read only – Mount the file system read/write – Allows the execution of programs in the file system

oexec – Not allows the execution of the programs in the file system. ser ouser uid – Allows ordinary users to mount the file system. – Not allows the ordinary user to mount the file system. – Allows the SUID and SGID bits to take effect

The umount command
umount command is used to unmount a mounted file systems. # umount /mnt/cdrom # umount /dev/fd0 Both the above commands will unmount a mounted flopyy disk.

The /etc/mtab file
The /etc/mtab file contains the information about the currently mounted file systems. This file will automatically updated when you are mounting or unmounting partitions. Do not try to edit this file manually. The mount command without any arguments will display the currently mounted file systems by referring the /etc/mtab file.

The /etc/fstab file
The /etc/fstab is a text file which contain the information of the file system. This file reads during the system startup and the file systems specified in it will get mounted automatically. Given below is a sample /etc/fstab file:
/dev/hda1 / ext2 defaults /dev/hda5 /home ext2 defaults,rw /dev/hda3 /usr ext2 11 /dev/hdc /mnt/cdrom iso9660 user,noauto,ro 0 0 1 1 1 2 1 defaults

The file systems with noauto options will not be mounted automatically at the time of booting. For example cd-roms and floppy disk drives. With the help of /etc/fstab file you can mount a floppy or cd-rom drive by simply specifying the mount point or the device name. The remaining options will be taken from the /etc/fstab file. # mount /mnt/cdrom # mount /dev/hdc Both the above commands will mount the cdrom automatically under mnt/cdrom. # mount /mnt/floppy # mount /dev/fd0 Both the above commands will mount the floppy under /mnt/floppy subdirectory.

Creating New File systems
After formatting a block device like floppy you have to make file system on that floppy. Linux uses mkfs command to create a new file system. The general format of the mkfs command is given below # mkfs –t fstype device name   # mkfs –t ext2 /dev/fd0 The above command will create a ext2 file system on a floppy disk. After creating the file system you can mount the floppy in any one of the following ways. # mount –t ext2 /dev/fd0 /mnt/floppy # mount /dev/fd0 /mnt/floppy (default file system is ext2) # mount /mnt/floppy (remaining options will be taken from /etc/fstab) # mount /dev/fd0 (remaining options will be taken from /etc/fstab)

Creating New Partitions in the Hard Disk Drive
After the installation you can manually create new partitions if you are having free space in your hard disk using fdisk program. If you are adding a new hard disk in your Linux server also need to create partitions using fdisk. To launch the fdisk utility, issue the fdisk command and specify the hard disk in which you want to create/modify partitions as an argument.

# fdisk /dev/hda command (m for help): m Important fdisk commands a d l n o p q t u v w - Toggles the active partition flag. - Delete a partition - Lists known partition types. - Add a new partition. - Create a new empty partition table. - Prints (displays) the partition table. - Quit without saving changes. - Sets the partition type - Toggle display unit form cylinders to sectors or the reverse. - Verifies the partition table - Writes the partition table to disk and exits.

Creating a new partition
In a hard disk drive you can create four main partitions. The main partitions will either be a primary partition or an extended partition. If you are creating four primary partitions in the hard disk you cannot create any more partitions in that hard disk drive. So that if you want to create more than four partitions in a hard disk, the fourth partitions should be an extended partition. An extended partition can be further divided in to number of partitions that are called logical partitions.

command (m for help) : p Disk /dev/hda: 255 heads, 63 sectors, 2489 cylinders Units = Cylinders of 16065 * 512 bytes Device Boot Star End Blocks /dev/hda1 FAT16 /dev/hda2 Extended /dev/hda5 Linux /dev/hda6 Linux /dev/hda7 Linux command (m for help) : w The “w” command will write the modified partition table to the disk and quit the fdisk program. * 1 128 128 133 388 127 2489 132 387 2489 1020096 18972765 40131 2048256 16884156


System 6 5 83 83 83

After creating a new partition you have to restart the Linux server. After restarting the server you have to create a new file system in the newly created partition. # mkfs /dev/hda7 # mkdir /soft # mount /dev/hda7 /soft The above commands will first create a ext2 file system on the newly created partition and mount the partition under /soft subdirectory (mount point). You can make necessary changes in the /etc/fstab file in order to mount the partition automatically at the time of booting.

Mtools Package
Red Hat Linux distribution has a inbuilt package called mtools which provides a set of commands to interact with a DOS/Windows formatted floppy disks. The given below is a listing of the important commands from mtools package.
Command mdir Usage Just like dos dir command. To list the content of a dos/windows formatted disk To copy files in/out of a dos formatted disk To see the attributes of the files stored in a dos diskette To see the content of a file stored in a dos diskette To delete a file form the floppy Mdir a: Format


mcopy mattrib mcat mdel

Mcopy a:<file name> location] Mattrib a: mcat a:<file name> mdel a:< file name>


Mtools Package
mdeltree mdu mformat mlabel mmd mrd mmove mren To delete a directory structure from the floppy To display the disk usage of a floppy To format a floppy in dos FAT Given a volume label for a floppy To create a directory in a dos floppy Remove a directory form a dos floppy Move a file stored in a dos floppy Renaming a file mdeltree name> mdu a: mformat a: mlabel a: mmd a:<directory name> mrd a: <directory name> mmove a:<file name> <new file name> mren a:<file name> <new name> <directory

Redundant Array of Independent Disks (RAID)
What is RAID?
The basic idea behind RAID is to combine multiple small, inexpensive disk drives into an array to accomplish performance or redundancy goals not attainable with one large and expensive drive. This array of drives will appear to the computer as a single logical storage unit or drive. RAID is a method in which information is spread across several disks, using techniques such as disk striping (RAID Level 0), disk mirroring (RAID level 1), and disk striping with parity (RAID Level 5) to achieve redundancy, lower latency and/or increase bandwidth for reading or writing to disks, and maximize the ability to recover from hard disk crashes.

Who Should Use RAID?
nyone who needs to data on hand (such administrator) would technology. Primary include: Enhanced speed Increased storage capacity using a single virtual disk keep large quantities of as an average system benefit by using RAID reasons to use RAID

Hardware RAID versus Software RAID

Hardware RAID The hardware-based system manages the RAID subsystem independently from the host and presents to the host only a single disk per RAID array.

RAID controllers also come in the form of cards that act like a SCSI controller to the operating system but handle all of the actual drive communications themselves. In these cases, you plug the drives into the RAID controller just like you would a SCSI controller, but then you add them to the RAID controller's configuration, and the operating system never knows the difference.

Software RAID
Software RAID implements the various RAID levels in the kernel disk (block device) code. It offers the cheapest possible solution, as expensive disk controller cards or hot-swap chassis are not required. Software RAID also works with cheaper IDE disks as well as SCSI disks . The MD driver in the Linux kernel is an example of a RAID solution that is completely hardware independent

Important features:

Threaded rebuild process Fully kernel-based configuration Portability of arrays between Linux machines without reconstruction

RAID Levels and Linear Support
RAID supports various configurations, including levels 0, 1, 4, 5, and linear. These RAID types are defined as follows: Level 0 — RAID level 0, often called "striping," is a performanceoriented striped data mapping technique Level 1 — RAID level 1, or "mirroring," has been used longer than any other form of RAID Level 4 — Level 4 uses parity concentrated on a single disk drive to protect data. Level 5 — This is the most common type of RAID. By distributing parity across some or all of an array's member disk drives, RAID level 5 eliminates the write bottleneck inherent in level 4 . Linear RAID — Linear RAID is a simple grouping of drives to create a larger virtual drive

Software RAID Configuration
Software RAID can be configured during the graphical installation of Red Hat Linux or during a kickstart installation. You can use fdisk or Disk Druid to create your RAID configuration, but these instructions will focus mainly on using Disk Druid to complete this task. Before you can create a RAID device, you must first create RAID partitions, using the following stepby-step instructions. • Create a partition. In Disk Druid, choose New to create a new partition

Software RAID

Creating a New RAID Partition
Choose software RAID from the File system Type pull-down menu. You will not be able to enter a mount point (you will be able to do that once you have created your RAID device). For Allowable Drives, select the drive on which RAID will be created. If you have multiple drives, all drives will be selected here and you must deselect those drives which will not have the RAID array on them.

Enter the size that you want the partition to be.

Select Fill to maximum allowable size if you want the partition to grow to fill all available space on the hard disk. If you make more than one partition growable, the partitions will share the available free space on the disk.

Once you have all of your partitions created as software RAID partitions, select the Make RAID button on the Disk Druid main partitioning screen Next, will appear, where you can make a RAID device.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.