![if !IE]> <![endif]>
The Linux disk partitioning
The Linux operating system uses partitions to allow it to co-exist with MS-DOS files and disks as used on IBM PCs. Any IBM PC disk can be partitioned using the MS-DOS FDISK command to create separate partitions. These partitions can then be assigned to Linux and thus support both MS-DOS (and Windows) as well as Linux. The partition naming follows a simple syntax as shown below. In addition, Linux can also directly read and write to MS-DOS disks.
This ability allows MS-DOS disks and thus files to co-exist within a Linux system without the need for special utilities to mount MS-DOS hard and floppy disks and then transfer files from MS-DOS and Linux and vice versa.
/dev/fd0 The first floppy disk drive (A:).
/dev/fd1 The second floppy disk drive (B:).
/dev/hda The whole first disk drive (IDE or BIOS compatible disk drive, e.g. ESDI, ST506 and so on).
/dev/hda1 The first primary partition on the first drive.
/dev/hda2 The second primary partition on the first drive.
/dev/hda3 The third primary partition on the first drive.
/dev/hda4 The fourth primary partition on the first drive.
/dev/hdb The whole second disk drive.
/dev/hdb1 The first primary partition on the second drive.
/dev/hdb2 The second primary partition on the second drive.
/dev/hdb3 The third primary partition on the second drive.
/dev/hdb4 The fourth primary partition on the second drive.
/dev/hdc The whole third disk drive.
/dev/hdc1 The first primary partition on the third drive.
/dev/hdc2 The second primary partition on the third drive.
/dev/hdc3 The third primary partition on the third drive.
/dev/hdc4 The fourth primary partition on the third drive.
/dev/hdd The whole fourth disk drive.
/dev/hdd1 The first primary partition on the fourth drive.
/dev/hdd2 The second primary partition on the fourth drive.
/dev/hdd3 The third primary partition on the fourth drive.
/dev/hdd4 The fourth primary partition on the fourth drive.
/dev/sda The whole first disk drive (LUN 0) on the first SCSI controller.
/dev/sda1 The first primary partition on the first drive.
The /proc file system
Linux has an additional special file system called /proc. This is not a file system in the true sense of the term but a simple method of getting information about the system using the normal tools and utilities. As will be shown, this is not always the case and there is at least one special utility commonly used with this file system. It is useful in making sure that all the drivers and other system components you expected to be installed are actually there. To access the /proc file system, it must be built into the kernel. Most, if not all, standard Linux kernels do this to provide debugging information at the very least.
One method of increasing the speed of disk access is to keep copies of the most recently used data in memory so it can be fetched without having to keep accessing the slower electro-mechanical disk. The first time the data is needed, it is read from disk and is copied into the cache memory. The next time this data is required, it comes directly from cache memory — without using the disk. This access can be up to 1,000 times faster — which greatly improves system performance. The amount of improvement de-pends on the amount of cache memory present and the quantity of data needed from disk. If cache memory exceeds the required amount of data, the maximum performance improvement is gained
— all the data is read once and can be completely stored in cache memory. If the amount of data is larger than the amount of cache memory, that the actual disk has been updated. The system frequently caches the new data — so the only copy is in cache memory. As this memory is volatile, if the machine is switched off the data is lost. If this information also includes superblock and inode changes, the file system will have been corrupted and, at best, parts of it will have been destroyed. At worst, the whole file system can be lost by switching the power off without executing a power down sequence. Most times, an accidental loss of power will not cause any real damage — but it is playing Russian roulette with the system.
The user can force the system to update the disk by execut-ing the sync command as required. This is a well recommended practice.
Most operating systems used on PCs today, such as MS-DOS, can only execute one application at a time. This means that only one user can use the computer at any time, with the further limitation that only one application can run at a time. While a spreadsheet is executing, the PC can only wait for commands and data from the keyboard. This is a great waste of computer power because the PC could be executing other programs or applications or, alternately, allow other users to run their software on it. The ability to support multiple users running multiple applications is called multi-user multi-tasking. This is a feature of Linux — and is one of the reasons for its rapid adoption. The multi-tasking techniques are where standard Linux falls down in that they use a time slice mechanism (as explained earlier in this chapter) and this is not real-time. As a result, the initial use of Linux into the embedded market has been restricted because of this and the amount of resources such as memory that it needs to function. This has prompted the development of embedded Linux (eLinux) that will be explained later in this chapter.
Given a multi-tasking operating system, it is easy to create a multi-user environment, where several users can share the same computer. This is done by taking the special interface program that provides the command line and prompts, and running mul-tiple copies of it as separate processes. When a user logs into the computer, a copy of the program is automatically started. In the UNIX environment, this is called the shell, and there are several different versions available. The advantages of multi-user sys-tems are obvious — powerful computer systems can be shared between several users, rather than each having a separate system. With a shared system, it can also be easier to control access and data, which may be important for large work groups.
With any multi-user system, it is important to prevent users from corrupting eachothers work, or gaining access to sensitive data. To facilitate this, Linux allocates each user a password protected login name, which uniquely identifies him. Each user is normally allocated his own directory within the file system and can configure his part of the system as needed. Users can be organised into groups and every file within the system is given access permissions controlling which user or group can read, write or execute it. When a file is accessed, the requesting user’s identity (or ID) is checked against that of the file. If it matches, the associated permissions are checked against the request. The file may be defined as read only, in which case a request to modify it would not be allowed — even if the request came from the user who created it in the first place. If the user ID does not match, the group IDs are checked. If these match, the group permissions are used to judge the validity of the request. If neither IDs match, a third set of permissions, known as others, are checked as the final part of this process.
These permissions can be changed as required by the sys-tem administrator, who must set up the Linux system and control how much or how little access each user has to the system and its facilities. This special user (or superuser) has unlimited access by being able to assume any user and/or group identity. This allows an organised structure to be easily implemented and controlled.
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.