Linux+: Linux Install 03 – Partitioning Part 1

Discussion in 'Installation' started by Jarret W. Buse, Apr 22, 2014.

  1. Jarret W. Buse

    Jarret W. Buse Active Member Staff Writer

    Messages:
    139
    Likes Received:
    169
    Trophy Points:
    43
    Linux+: Linux Install 03 – Partitioning Part 1

    As with any Operating System (OS), a Hard disk Drive (HDD) needs to be set up to be used for the installation of the OS. This is a crucial step in the installation phase and needs to be understood.

    When an OS is installed on a system it needs to set up the HDD for use. Depending on the File System being used, there can be limitations on the size. For example, when using the File Allocation Table 16-bit (FAT16) maximum disk size is 4 GB. If you have a hard disk which is larger than the 4 GB, you have to limit the disk size to 4 GB. To do this, the disk is partitioned into sections. The sections, or partitions, can each contain a File System and be separate from the others as well as being of various sizes.

    The Linux OS requires one partition for the OS to be installed. The main installation is the root. A second partition may be required for a swap partition if the distro does not support swap files. Be aware that swap files did exist on older distros, but now swap partitions are used.

    NOTE: The swap is a partition or file which is used to copy information to and from the memory. In this manner, programs not being used can be moved from the Random Access Memory (RAM) to the hard disk. By swapping out the application, more memory is available for other applications to use. When a program is needed that is in swap, the information is moved back to RAM from the swap system. If needed, other applications need to be moved into swap to make room for the returning application.

    There are a few programs that can be used to partition a hard disk:
    • fdisk (covered in this article)
    • cfdisk (covered in this article)
    • parted (covered in part 2 of this article)
    • gparted (covered in part 2 of this article)
    • and many others
    fdisk

    The Fixed-Disk (FDisk) utility is available for Linux systems to partition hard drives as well as view the existing partitions.

    There are a few parameters which can be used when starting the fdisk command:
    • -b sectorsize – allows you to specify the size of the sectors for the partition. Valid options are: 512, 1024, 2048 or 4096.
    • -C cylinders – Specifies the number of cylinders for the disk.
    • -c=mode – The two modes are dos or nondos. The default is nondos.
    • -H heads – Specifies the number of disk heads.
    • -S sectors – Specifies number of sectors per track.
    • -h – Prints a help screen and then exits.
    • -l – Lists all partition tables
    • -l /dev/drive – Lists specific partition
    • -u=unit – The two unit options are sectors and cylinders. The default is sectors. Lists partition table sizes in the specified unit type
    • -v – Prints version information and then exits.
    Once fdisk is started with some or none of the mentioned parameters, the specified information is displayed for any parameters and you are then in command mode. In command mode there are sixteen commands which can be entered as follows:
    1. a – changes the boot partition
    2. b – edits the BSD disk label
    3. c – sets the DOS compatibility mode
    4. d – deletes a partition
    5. l – list partition types
    6. m – prints menu of commands
    7. n – creates a new partition
    8. o – creates a new DOS Partition Table
    9. p – prints the Partition Table
    10. q – quits FDisk without saving
    11. s – creates a new empty Sun disk label
    12. t – changes a partition system ID
    13. u - changes entry/display units
    14. v – verifies the Partition Table
    15. w – writes any updates to the disk and exits
    16. x – advanced functions
    It is important to note that the fdisk utility uses the Master Boot Record (MBR) method of partitioning.


    NOTE: An MBR Partition Table is used to store partition information for the OS for the specific HDD on which it is located. The MBR allows for a maximum of four partitions on a disk. One of these partitions can be made an Extended Partition. The Extended Partition can contain Logical Partitions and most sources say an unlimited number of them (limited only by drive space).

    cfdisk

    The Cursor Fixed Disk (CFDisk) utility is similar to FDisk, but uses a Graphical User Interface (GUI).

    There are a number of options available to enter on the command in the Terminal as follows:
    • -a – uses an arrow as a cursor for cfdisk
    • -g – guess geometry from Partition Table information
    • -v – displays cfdisk version and copyright information
    • -z – specifies that cfdisk should not use existing Partiion Table on Hard Disk
    • -c cylinders – specifies the number of cylinders used to override information from BIOS
    • -h heads - specifies the number of heads used to override information from BIOS
    • -s sectors - specifies the number of sectors used to override information from BIOS
    • -P option – prints Partition Table in the optional format
    • r – raw format as it is on the disk
    • s – sector order format
    • t – raw format that is ordered by partition number
    • [device] – the specific drive to be used in cfdisk
    Once cfdisk is running, there are key strokes which can be used to perform certain tasks as follows:

    • b – makes selected partition bootable
    • d – deletes current partition
    • g – changes disk geometry
    • h – displays help screen
    • m – maximizes disk space. Extra space is recovered but makes the disk incompatible with DOS, OS/2 and other OS
    • n – creates a new partition from unused space
    • p – prints Partition Table to a file using one of the following formats:
      • r – raw format as it is on the disk
      • s – sector order format
      • t – raw format that is ordered by partition number
    • q – quits without writing any changes
    • t – changes file system type for the partition
    • u – changes displayed units between megabytes, sectors and cylinders
    • W – writes changes to the Partition Table (must be uppercase)
    • CTRL-L – refreshes the screen
    • ? - displays the help screen
    As with fdisk, cfdisk also uses the MBR method of partitioning.

    Conclusion

    It is best to “experiment” with these utilities and become familiar with them.

    Attached Files:

    DevynCJohnson likes this.

Share This Page