O'Reilly logo

Practical Linux by Bill Ball, John Ray, Michael Turner, M. Drew Streib

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Partitioning a Hard Drive with the fdisk Command

Use the fdisk command to prepare a new hard drive with one or more partitions. fdisk is not the most intuitive Linux command but it can be used to quickly prepare a hard drive for use.

Don't overwrite the partition you're running on

If you need to repartition a hard drive that's already in use, be sure to unmount it first. If it is ever necessary to repartition the hard drive you have / mounted on, you should boot into single user mode first.

SEE ALSO

For more information on run levels, see page 355.

  1. Log in as the root operator. Use the fdisk command to prepare and partition a hard drive by specifying the drive's device name on the command line:

    # fdisk /dev/sda
    Command (m for help): m
    
  2. fdisk ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required