Create a standard partition in Linux

How to configure a new disk and create a standard partition in Linux

Purpose

  • Create a standard partition in Linux
  • Configure a new disk
  • Add storage when the existing disk is running out of space.
  • Provide additional space for applications, logs, databases, or files.
  • Separate application data from the operating system.

Implementation

Step1 – Identify the new disk

lsblk
  • Example: /dev/nvme1n1 is the newly attached disk.
  • Size: The disk has a capacity of 8 GB.
  • Important: Verify that this is the correct disk before making changes.

Step 2 – Create a Partition

fdisk /dev/nvme1n1

Common interactive commands inside fdisk:

  • n — Create a new partition.
  • p — Display the partition table.
  • w — Write changes and exit.
  • q — Quit without saving changes.

For a typical single-partition setup, create a new primary partition using the available defaults.

Step 3 – Verify the Partition

lsblk
Expected example:
  • The partition is /dev/nvme1n1p1

Step 4 – Create a Filesystem

mkfs.xfs /dev/nvme1n1p1

This formats the partition with the XFS filesystem.

Warning: Formatting destroys existing filesystem data on the target partition. Do not run it on a partition containing data you need.

Step 5 – Create a Mount Point

mkdir -p /docker

A mount point is a directory through which you access a mounted filesystem.

Step 6 – Create a Mount the Partition

mount /dev/nvme1n1p1 /docker

Now, the partition’s storage is accessible through /docker

Step 7 – Verify the Mount

df -h
# or
lsblk

You should see /dev/nvme1n1p1 mounted at /docker.

Step 8 – Make the Mount Permanent

Normally, a manual mount does not persist after reboot. Configure /etc/fstab to mount the filesystem automatically.

  • Get the UUID
    blkid /dev/nvme1n1p1
    Example outputs:
    /dev/nvme1n1p1: UUID="ae9850ef-5864-40a3-ad3c-c156cc8db4ba" TYPE="xfs" PARTUUID="39b4ea54-01"

    Use the actual UUID returned by your system.

  • Edit /etc/fstab
    vi /etc/fstab

    Add a line using your actual UUID

    UUID=ae9850ef-5864-40a3-ad3c-c156cc8db4ba       /docker xfs     defaults        0       0

    Field meanings:

    • UUID=… – Identifies the filesystem
    • /docker – Mount point
    • xfs – Filesystem type
    • default – Standard mount points
    • 0 – Do not legacy filesystem back by fsck at boot; XFS has its own recovery and checking tools

    Best practice: Use the UUID instead of /dev/nvme1n1p1, because device names may change.

  • Test the configuration
    • Before rebooting, run
      df -h
    • After rebooting, run
      df -h

Recommendation to read more

Read Here