Appendix A. An Introduction to Disk Partitions
A.1. Hard Disk Basic Concepts
Figure A.1. An Unused Disk Drive
A.1.1. It is Not What You Write, it is How You Write It
Figure A.2. Disk Drive with a File System
- A small percentage of the drive's available space is used to store file system-related data and can be considered as overhead.
- A file system splits the remaining space into small, consistently-sized segments. For Linux, these segments are known as blocks. 
Figure A.3. Disk Drive with a Different File System
Figure A.4. Disk Drive with Data Written to It
A.1.2. Partitions: Turning One Drive Into Many
- Logical separation of the operating system data from the user data
- Ability to use different file systems
- Ability to run multiple operating systems on one machine
Figure A.5. Disk Drive with Partition Table
- The points on the disk where the partition starts and ends
- Whether the partition is "active"
- The partition's type
Figure A.6. Disk Drive With Single Partition
Table A.1. Partition Types
|Partition Type||Value||Partition Type||Value|
|Empty||00||Novell Netware 386||65|
|DOS 12-bit FAT||01||PIC/IX||75|
|XENIX root||02||Old MINIX||80|
|DOS 16-bit <=32M||04||Linux swap||82|
|DOS 16-bit >=32||06||Linux extended||85|
|OS/2 Boot Manager||0a||OpenBSD||a6|
|Win95 FAT32 (LBA)||0c||BSDI fs||b7|
|Win95 FAT16 (LBA)||0e||BSDI swap||b8|
|Win95 Extended (LBA)||0f||Syrinx||c7|
|PReP Boot||41||DOS R/O||e3|
|GNU HURD||63||DOS secondary||f2|
|Novell Netware 286||64||BBT||ff|
A.1.3. Partitions Within Partitions — An Overview of Extended Partitions
Figure A.7. Disk Drive With Extended Partition
A.1.4. GUID Partition Table (GPT)
- To preserve backward compatibility with MBR disks, the first sector (LBA 0) of GPT is reserved for MBR data and it is called “protective MBR”.
- The primary GPT header begins on the second logical block (LBA 1) of the device. The header contains the disk GUID, the location of the primary partition table, the location of the secondary GPT header, and CRC32 checksums of itself and the primary partition table. It also specifies the number of partition entries of the table.
- The primary GPT table includes, by default, 128 partition entries, each with an entry size 128 bytes, its partition type GUID and unique partition GUID.
- The secondary GPT table is identical to the primary GPT table. It is used mainly as a backup table for recovery in case the primary partition table is corrupted.
- The secondary GPT header is located on the last logical sector of the disk and it can be used to recover GPT information in case the primary header is corrupted. It contains the disk GUID, the location of the secondary partition table and the primary GPT header, CRC32 checksums of itself and the secondary partition table, and the number of possible partition entries.
A.1.5. Making Room For Red Hat Enterprise Linux
- Unpartitioned free space is available
- An unused partition is available
- Free space in an actively used partition is available
A.1.5.1. Using Unpartitioned Free Space
Figure A.8. Disk Drive with Unpartitioned Free Space
A.1.5.2. Using Space from an Unused Partition
Figure A.9. Disk Drive With an Unused Partition
A.1.5.3. Using Free Space from an Active Partition
- Destructive Repartitioning
- Basically, you delete the single large partition and create several smaller ones. As you might imagine, any data you had in the original partition is destroyed. This means that making a complete backup is necessary. For your own sake, make two backups, use verification (if available in your backup software), and try to read data from your backup before you delete the partition.
WarningIf there was an operating system of some type installed on that partition, it needs to be reinstalled as well. Be aware that some computers sold with pre-installed operating systems may not include the CD-ROM media to reinstall the original operating system. The best time to notice if this applies to your system is before you destroy your original partition and its operating system installation.After creating a smaller partition for your existing operating system, you can reinstall any software, restore your data, and start your Red Hat Enterprise Linux installation. Figure A.10, “Disk Drive Being Destructively Repartitioned” shows this being done.
Figure A.10. Disk Drive Being Destructively RepartitionedIn Figure A.10, “Disk Drive Being Destructively Repartitioned”, 1 represents before and 2 represents after.
WarningAs Figure A.10, “Disk Drive Being Destructively Repartitioned”, shows, any data present in the original partition is lost without proper backup!
- Non-Destructive Repartitioning
- Here, you run a program that does the seemingly impossible: it makes a big partition smaller without losing any of the files stored in that partition. Many people have found this method to be reliable and trouble-free. What software should you use to perform this feat? There are several disk management software products on the market. Do some research to find the one that is best for your situation.While the process of non-destructive repartitioning is rather straightforward, there are a number of steps involved:
- Compress and backup existing data
- Resize the existing partition
- Create new partition(s)
A.184.108.40.206. Compress existing data
Figure A.11. Disk Drive Being Compressed
A.220.127.116.11. Resize the existing partition
Figure A.12. Disk Drive with Partition Resized
A.18.104.22.168. Create new partition(s)
Figure A.13. Disk Drive with Final Partition Configuration
partedutility. This is a freely available program that can resize partitions.
parted, it is important that you be familiar with disk storage and that you perform a backup of your computer data. You should make two copies of all the important data on your computer. These copies should be to removable media (such as tape, CD-ROM, or diskettes), and you should make sure they are readable before proceeding.
parted, be aware that after
partedruns you are left with two partitions: the one you resized, and the one
partedcreated out of the newly freed space. If your goal is to use that space to install Red Hat Enterprise Linux, you should delete the newly created partition, either by using the partitioning utility under your current operating system or while setting up partitions during installation.
A.1.6. Partition Naming Scheme
- Each partition's type is checked to determine if it can be read by DOS/Windows.
- If the partition's type is compatible, it is assigned a "drive letter." The drive letters start with a "C" and move on to the following letters, depending on the number of partitions to be labeled.
- The drive letter can then be used to refer to that partition as well as the file system contained on that partition.
- This is the name of the directory in which all device files reside. Since partitions reside on hard disks, and hard disks are devices, the files representing all possible partitions reside in
- The first two letters of the partition name indicate the type of device on which the partition resides, usually either
hd(for IDE disks) or
sd(for SCSI disks).
- This letter indicates which device the partition is on. For example,
/dev/hda(the first IDE hard disk) or
/dev/sdb(the second SCSI disk).
- The final number denotes the partition. The first four (primary or extended) partitions are numbered
4. Logical partitions start at
5. So, for example,
/dev/hda3is the third primary or extended partition on the first IDE hard disk, and
/dev/sdb6is the second logical partition on the second SCSI hard disk.
A.1.7. Disk Partitions and Other Operating Systems
A.1.8. Disk Partitions and Mount Points
/dev/hda5is mounted on
/usr/, that would mean that all files and directories under
/usr/physically reside on
/dev/hda5. So the file
/usr/share/doc/FAQ/txt/Linux-FAQwould be stored on
/dev/hda5, while the file
/usr/would be mount points for other partitions. For instance, a partition (say,
/dev/hda7) could be mounted on
/usr/local/, meaning that
/usr/local/man/whatiswould then reside on
A.1.9. How Many Partitions?