These exercises give you practice using
parted. Specifically, you'll practice:
- Learning available commands in interactive mode
- Creating partitions
- Toggling a bootable flag
- Finding information about existing partitions
- Changing the unit of partition size display
To get the most from practice exercises in this series, you should have a basic knowledge of Linux and a working Linux system on which you can practice the exercises covered in this article. In addition, you should have a spare hard disk or an available flash drive for practice.
Important: To prevent possible loss of data, use an already formatted or otherwise empty hard disk. Alternatively, you could use an empty flash drive to complete these exercises.
Assume that you are working as a Linux consultant for a new organization and have been hired to design the hard disk layout for the company's first Linux file server. Once you have mounted the drive, perform these steps:
- List the available commands.
- Find the partition types
For this exercise, assume a 4GB hard disk; you can adjust partition sizes accordingly if you are using a larger or smaller hard disk.
fdisk to design the hard disk with the
- Partition 1: 100MB (to be used as /boot )
- Partition 2: 2GB
- Partition 3: 1GB
- Partition 4: 500MB
- Change the partition 4 file system type to
The master boot record (MBR) should understand which partition in the table it will use to boot.
fdisk to perform these tasks:
- Set the bootable flag to
- Use the command to save the changes and exit interactive mode.
Say you are working as a Linux consultant for a large organization and you
have been hired to design the hard disk layout for the company's complex,
multi-terabyte hard disks. Although considered a bit more complex to use,
parted has the ability to copy hard disks and
re-size the partitions, if needed.
parted to perform these tasks:
partedinteractive mode using your practice hard disk's device location.
- List the available commands.
- Print the partition table.
Depending upon the size of your hard disk, instructing
parted to display partition sizes in a unit
other than the default megabytes could provide for easier reading.
parted to perform the following tasks:
- List available units.
- Change the unit to terabytes.
Follow these solution steps to check your work.
- The developerWorks article "Learn Linux,101: Hard disk layout" (developerWorks, February
2010) describes the commands required to complete these exercises.
- At the LPIC
Program site, find detailed objectives, task lists, and sample
questions for the three levels of the LPI's Linux systems administration
certification. In particular, look at the LPI-101 detailed objectives and the sample questions.
- Review the entire LPI exam
prep series on developerWorks to learn Linux fundamentals and
prepare for systems administrator certification based on LPI exam
objectives prior to April 2009.
Exam Preparation Resources for Revised LPIC Exams provides a list
of other certification training resources that LPI maintains.
Tracy Bost is a seasoned software developer and systems engineer. He is also a lecturer and trainer for the Linux operating system. Tracy has been certified as both a Red Hat Certified Engineer (RHCE) and a Microsoft Certified Systems Engineer (MCSE), along with being an active member of the Linux Foundation. He has worked in several industries, including mortgage, real estate, and the nonprofit sector.