Thursday, March 6, 2008

Disk partitioning

Disk partitioning is the creation of divisions of a hard disk. Once a disk is divided into several partitions, directories and files can be grouped by categories such as data type and usage. Space management, access permissions and directory searching are based on the file system installed on a partition. First decide how many separate categories of data are needed and the size of each. More categories provide more control but too many become a nuisance. One scheme is to separate the operating system files from user files. Having a partition for swapping, separate from system utilities, keeps frequently used programs and data near each other. Having browser cache files in a separate partition keeps them away from other files. The frequency of update and access is an important consideration for categorizing files. Separating email from audio or photos is a good idea. Files that can be retrieved from other sources can be grouped together. Careful consideration of the size of the partition is necessary as the ability to change the size depends of the file system installed in the partition..


Now decide what file system to install in the partition. Choosing different file systems is a reason to partition the disk because each file system has different characteristics related to performance and access restrictions.
(This article gets increasingly technical at this point)
Other benefits include:
The use of multi-booting setups, which allow users to have more than one operating system on a single computer. For example, one could install Linux, Mac OS X, Microsoft Windows or others on different partitions of the same hard disk and have a choice of booting into any operating system (supported by the hardware) at power-up.
Sharing swap partitions between multiple Linux distributions, so such partitions use less hard drive space.
Protecting or isolating files, to make it easier to recover a corrupted file system or operating system installation.
Raising overall computer performance because smaller filesystems are more efficient. For instance, large hard drives with only one NTFS filesystem typically have a very large Master File Table (MFT) and it generally takes more time to read this MFT than the smaller MFTs of smaller partitions.
Higher levels of data organization, raising the user efficiency of the system, for example separate partitions dedicated to digital movie processing, photos, email mailboxes or browser cache.
Partitions may be customized to different requirements, for example, allowing for read-only partitions to protect data: if one partition is damaged, none of the other file systems are affected, and the drive's data may still be salvageable.
PC BIOS partition types
This section describes partitions as used in MS-DOS, Microsoft Windows and Linux on PC compatible computer systems; for examples of partitioning schemes used in other operating systems, see Slice (disk) and BSD disklabel.
A PC hard disk can contain either as many as four primary partitions, or 1-3 primaries and a single extended partition. Each of these partitions are described by a 16-byte entry in the Partition Table which is located in the Master Boot Record.
The "type" of a partition is identified by a 1-byte code found in its partition table entry. Some of these codes (such as 0x05 and 0x0F) may be used to indicate the presence of an extended partition, but most are used by operating systems that examine partition tables to decide if a partition contains a file system they can mount/access for reading or writing data.
Once a specific partition's type has been identified, additional information about its purpose and probable contents may be found (see: List of partition identifiers for PCs as one such resource). For example, some type codes are used to hide a partition's contents from various operating systems. However, if an OS or some partitioning tool has been programmed to also examine the boot sectors of any partition, then its file system may no longer remain hidden. (Note: There are no officially assigned partition types; thus, more than one kind of file system may lay claim to the same code value.)
Primary (or Logical)
A primary (or logical) partition contains one file system. In MS-DOS and earlier versions of Microsoft Windows systems, the first partition (C:) must be a "primary partition". Other operating systems may not share this limitation; however, this can depend on other factors, such as a PC's BIOS.
The "partition type" code for a primary or logical partition can either correspond to a file system contained within (e.g. 0x07 means either an NTFS or an OS/2 HPFS file system) or indicate the partition has a special use (e.g. code 0xBC may mean an Acronis Secure Zone and code 0x82 usually indicates a Linux swap partition). The FAT16 and FAT32 file systems have made use of quite a number of partition type codes over time due to the limits of various DOS and Windows OS versions. Though a Linux operating system may recognize a number of different file systems (ext2, ext3, reiserfs, etc.), they have all consistently used the same partition type code: 0x83 (Linux native).
[Extended
An extended partition is secondary to the primary partition(s). A hard disk may contain only one extended partition; which can then be sub-divided into logical drives, each of which is (under DOS and Windows) assigned additional drive letters.
For example, under either DOS or Windows, a hard disk with one primary partition and one extended partition, the latter containing two logical drives, would typically be assigned the three drive letters: C:, D: and E: (in that order).
See Extended Boot Record for information on the structure of an extended partition.
Compressed disks
Hard disks are sometimes compressed to create additional space. Under MS-DOS and early Windows, programs such as STACKER (DR-DOS except 6), SuperStor (DR-DOS 6), DoubleSpace, or DriveSpace (Windows 95) were used. This compression was done by creating a very large file on the partition, then storing the disk's data in this file. At startup, device drivers opened this file and assigned it a separate letter. Frequently, to avoid confusion, the original partition and the compressed drive had their letters swapped, so that the compressed disk is C:, and the uncompressed area (often containing system files) is given a higher name. (SuperStor required a separate device driver to be loaded, DEVSWAP.COM).
Versions of Windows using the NT kernel, including the most recent versions, XP and Vista, contain intrinsic disk compression capability. The use of separate compression utilities has declined sharply.
Partitioning schemes
Microsoft Windows
With Microsoft Windows, the standard partitioning scheme is to create a single active primary partition, the C: drive, where the operating system, user data, applications, and page file all reside. Some users, however, prefer to create multiple partitions so that the operating system can be stored separately from other kinds of data. Proponents of multiple partitions generally point to the benefit of being able to erase a single partition (typically the operating system itself) while retaining the other data. When used in conjunction with third-party partition management programs such as Acronis True Image, Norton Partition Magic, Norton Ghost, or specialized recovery programs that come with computers manufactured by most major manufacturers, the use of multiple partitions allows computer users to quickly recover from viruses, rootkits, and trojan horses or an otherwise damaged, corrupt or compromised operating system. Windows Vista includes an inbuilt 'Disk Management' program which allows for the creation, deletion and movement of partitions.
Unix
For Unix-based and Unix-like operating systems such as Linux and Mac OS X, the creation of separate partitions for /boot, /home, /tmp, /usr, /var, /opt, swap and all remaining files under the "/" (root directory) is possible. (The same is true for Sun operating systems, except their partitions are called slices.) Such a scheme has a number of potential advantages: if one file system gets corrupted, the rest of the data (the other file systems) stay intact, minimizing data loss; partitions can be accessed read-only and the execution of setuid files disabled thus enhancing security; performance may be enhanced due to less disk head travel. This method has the disadvantage of subdividing the drive into fixed-size partitions, so a user could run out of hard drive space in his or her /home partition, even though other partitions still have plenty of usable space. A good implementation requires the user to predict how much space each partition will need, which may be a difficult task; especially for new users. Logical Volume Management, often used in servers, increases flexibility by allowing data in volumes to expand into separate physical disks (which can be added when needed); another option is to resize existing partitions when necessary. Typical desktop systems are often comprised of a single "/" (root directory) containing the entire filesystem plus a much smaller swap partition. By default, Mac OS X systems use a single "/" (root directory) containing the entire filesystem (including the swap file) as a point of simplicity (but other setup options do exist).
Partition recovery
When a partition is deleted, in general, only its partition table entry is removed from a table; and although the data is no longer accessible, it still remains on the disk until being overwritten. Specialized recovery utilities, (such as TestDisk and gpart), can locate lost file systems and recreate a partition table which includes entries for these recovered file systems. However, some disk utilities may also overwrite a number of beginning sectors of a partition they delete. For example, if Windows Disk Management (Windows 2000/XP, etc.) is used to delete a partition, it will overwrite the first sector (relative sector 0) of the partition before removing it. It may be possible to restore a FAT32 or NTFS partition if a backup boot sector is available.

Artikel yang Berkaitan

0 komentar:

Post a Comment