Disk Partitioning By: Stefano Polo Overview Creating divisions on a Hard Disk Directories and files are then grouped by categories • Data types • Usage Partitions contains file systems • Space Management • Access Permissions • Directory Searching Overview cont. A file system can decide how many separate categories of data are needed and the size of each. • Seperating operating system from user files Examples Partition for Swapping • Keeps frequently used programs and data near each other Keeping browser cache files in separate partitions keeps them away from each other Seperating email from audio and photos Benefits The Use of Multi-booting setups • Having more than 1 operating system Sharing swap partitions between multiple linux distributions • Allows the need for less memory Protecting and isolating files • Easy to recover corrupted file systems and operating systems installed Increase Computer performance • Smaller file systems are more efficient Higher level of data organization • Keeping videos, photos, audios, emails, etc…seperated PC Bios Partition Types Used in MS-Dos, Windows, & Linux Can contain up to 4 Primary or 1-3 primary and 1 extended Each partition have 16-byte entries in the partition table located in the Master Boot Record A primary partition contains one file system Primary (Logical) 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). (wikipedia) NTFS All file data are stored as metadata • Simply just data about data • May describe individual datum, content item, or a collection of data Allows any sequence of 16-bit values for name encoding uses B+ trees to index file system data Master File Table (MFT) contains metadata about every file, directory, and metafile on an NTFS volume File Allocation Table (FAT) Used mostly today in floppies and solid-state memory cards (flash memory) Gives convenience towards sharing data between operating systems on one machine Uses a table which contains information on which areas that belong to files are free or unusable Table also gives information on where the data is actually stored To limit the size of the table, disk space is allocated in hardware sectors called clusters Maximum numbers of clusters have increased over time the number of bits required to identify a cluster is used to name the successive major versions of the format • Fat12 • Fat16 • Fat32 Drawbacks of FAT When files are deleted and new files are created, directory fragments tend to get scattered over the entire disk • This causes slow read/write processes Defragmentation can solve this issue • Can be a lengthy process • Would need to be performed reguraly Solid-State should not be defragmented since they tend to wear down eventually Extended Secondary to primary partitions Hard disk may contain 1 extended partition • Can be sub-divided into logical drives • Each are assigned additonal letter drives Examples • Primary partition would be C: • Extended partition would be E:, G: etc Compressed Disks Compressed to create additional space Creating one large file in a partition • Storing the disk’s data in this file At startup, device drivers open this file and assign it to a separate letter To avoid confusion, the original partition and the compressed drive had their letters swapped • Compressed disk would be C: • Uncompressed disk were given higher names Partitioning Schemes Microsoft • create a single active primary partition, the C: drive • Where all 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. Partitioning Schemes cont. Unix • creation of separate partitions for /boot, /home, /tmp, /usr, /var, /opt, swap and all remaining files under the "/" (root directory) Advantages • if one file system gets corrupted, the rest of the data (the other file systems) stay intact, minimizing data loss • 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 Partitioning Schemes cont. Disadvantages of Unix scheme partition • user could run out of hard drive space in his or her /home partition • good implementation requires the user to predict how much space each partition will need, which may be a difficult task • Logical Volume Management, often used in servers, increases flexibility by allowing data in volumes to expand into separate physical disks • Another option is to resize existing partitions when necessary. Partition Recovery When a partition is deleted, generally only the table entry is removed The data is still on the hard disk but maybe un-accessible Specialized recovery tools can access the data and recreate the table entry Some disk utilities may also overwrite a number of beginning sectors of a partition they delete In this case it may be possible to restore a FAT32 or NTFS partition if a backup boot sector is available