Linux+: Linux Install 04 – Partitioning Part 2

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

  1. Jarret W. Buse

    Jarret W. Buse Well-Known Member Staff Writer

    Jul 3, 2013
    Likes Received:
    Linux+: Linux Install 04 – Partitioning Part 2

    As mentioned in the previous article, Linux Install 04 – Partitioning Part 1, Parted and GParted have not been covered on the Linux+ certification exam, but they may be in the future. Because GParted is such a simple program to use and uses an easy Graphical User Interface (GUI), it is easier to to see the changes being made. If needed, you can use fdisk or cfdisk to make changes to a partition and then view the changes in GParted to verify everything worked as desired.


    Parted is a command-line utility to create, delete, modify, resize and move partitions.

    There are options which can be used when starting the parted utility:
    • -a – sets alignment type as follows:
      • none – minimum alignment type for drive

      • cylinder – align to cylinders

      • minimal – alignment set by disk topology to physical blocks

      • optimal – alignment set by disk topology to physical block size
    • -h – displays a help screen

    • -l – lists partitions on block devices

    • -m – displays machine layout for parsing

    • -s – script is used so not to ask for user intervention

    • -v – displays version information

    • device – the block device used as the default when Parted is loaded. The default is the first partition found. The device can be followed by options which will be performed on the specified device. If no option is given, then a prompt will be shown to allow a user to enter the necessary options. The options are as follows:
    • check – used to check the file system for errors. Specific utilities for a specific file system should be used. For example, with a Reiser file system you would use the utility which comes with it. An example of the command in a Terminal is “sudo parted /dev/sdc check” If more than one partition exists, you will be prompted for a partition number.

    • cp source-device source destination – copies a partition's filesystem to the destination partition

    • help command – displays help information on the specified command or general help if no command is specified

    • mkfs partition filesystem-type – uses partition to make the specified file-system. Filesystem-type can be one of the following:

      • fat16

        • fat32
      • ext2

      • linux-swap

      • reiserfs
    • mklabel labeltype – creates a new Partition Table of the following types:

      • bsd

      • dvh

      • gpt

      • loop

      • mac

      • msdos (this is MBR)

      • pc98

      • sun
    • mkpart partition-type filesystem-type start end – makes an MBR partition of type:

      • primary

      • logical

      • extended
    with a filesystem (optional) of one of the following:

      • fat16

      • fat32

      • ext2

      • HFS

      • linux-swap

      • NTFS

      • reiserfs

      • ufs
    with start and end specifying the size in megabytes and position.

    • makepartfs – similar to makepart, but is discouraged to use

    • move partition start end – moves a partition on the disk so it starts and ends where specified

    • name partition name – sets label on the partition using the name specified

    • print – shows Partition Table

    • quit – exits Parted

    • rescue start end – recovers a lost partition between the start and ending locations

    • resize partition start end – resizes the partition specified from the starting point to the ending point

    • rm partition – removes the specified partition

    • select device – sets the default device for use with the options given in the prompt

    • set partition flag state – changes the flag state of the specified partition. The flag states are as follows:

      • boot

      • root

      • swap

      • hidden

      • raid

      • lvm

      • lba

      • legacy_boot

      • palo
    State is either on or off.

    • Unit unit – sets the units for display and use for the current device and units can be one of the following:

      • s – sectors

      • b – bytes

      • kb - kilobytes

      • mb – megabytes

      • gb – gigabytes

      • tb – terabytes

      • % - percentage of device size

      • cyl – cylinders

      • chs – cylinders, heads sectors

      • compact – megabytes for input and a friendly form for output
    • version – shows the version and copyright information for Parted
    NOTE: You should be very careful using the Parted utility since it is command-line driven and can be very tricky. It is best to use the graphical version of Parted called Gparted.


    Gparted is a Graphical Partition Editor or a graphical version of Parted and is very useful as well as a popular utility.

    Once the application is started, you can select the device you want to make changes to by selecting it. Then, right-clicking on the partition or unused space you wish to edit you can make your needed changes. Once options are changed, a box at the bottom will appear showing all the changes set. Once finished, you can right-click the box and select “Apply all operations”. Once selected, all operations are performed. If GParted is closed, you will be notified that operations are still pending. You may quit at this point, but the operations will not be performed. Once closed, any pending operations are lost.


    It is best to “experiment” with these utilities and become familiar with them. Parted and GParted may not be covered on the Linux+ exam, but may appear in the future because of their popularity (especially GParted).

    Attached Files:

    ZHANG/ZHIKUN and DevynCJohnson like this.
  2. bashcommando

    bashcommando Active Member

    Jan 28, 2014
    Likes Received:
    Good article. I'll have to keep that in mind.
  3. Polyatomic

    Polyatomic New Member

    Aug 23, 2014
    Likes Received:
    Exellent. Is there a guide about partitioning an SSD. I have been reading that partitions need to start and end on a block boundary, to reduce or minimise read or write access. Im confused and cannot get my head around file system blocks, physical sectors, erase block size and Nand page size . I just end up using GNU parted and hope the tool does the alignment automatically.
  4. Jarret W. Buse

    Jarret W. Buse Well-Known Member Staff Writer

    Jul 3, 2013
    Likes Received:
    I will have to look into this. I may be able to get an article out on this soon. Let me do some checking.

    ZHANG/ZHIKUN New Member

    Aug 22, 2014
    Likes Received:
    parted seems more complicated. I will do an exeriment with it. thank you.

Share This Page