Updated: 4 November 2026 · Applies to: GNU parted 3.5 and 3.6 on AlmaLinux and Rocky Linux 9 and 10, RHEL 9 and 10, Ubuntu 24.04 and 26.04, Debian 13

This guide takes a new, empty disk (for example a second disk added to a dedicated server or VPS) from nothing to a mounted folder that survives reboots: partition it with parted, create a file system, and add it to /etc/fstab. For more parted commands, such as resizing and recovering partitions, see 8 Linux parted commands.

Before you start

  • Every step below erases the disk you name. Make sure it is the new, empty disk.
  • Install parted if it is missing: dnf install parted or apt install parted.

Steps

  1. Find the new disk. It has no partitions and no mount point:
    lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
    In this example it is /dev/sdb. On a VPS it may be /dev/vdb, on NVMe servers /dev/nvme1n1.
  2. Create a GPT partition table and one partition over the whole disk:
    parted -s /dev/sdb mklabel gpt mkpart data 1MiB 100%
    GPT works for disks of any size (MBR stops at 2 TB). Starting at 1 MiB keeps the partition aligned.
  3. Check the result: parted /dev/sdb print. The partition is /dev/sdb1 (on NVMe: /dev/nvme1n1p1).
  4. Create a file system. XFS is the default on AlmaLinux, Rocky Linux and RHEL, ext4 on Ubuntu and Debian; both are good choices:
    mkfs.xfs /dev/sdb1       # or: mkfs.ext4 /dev/sdb1
  5. Create the folder and mount it:
    mkdir -p /data
    mount /dev/sdb1 /data
    df -h /data
  6. Get the file system's UUID, which stays the same even if disk names change:
    blkid /dev/sdb1
  7. Add a line to /etc/fstab with that UUID:
    UUID=0a1b2c3d-1111-2222-3333-444455556666  /data  xfs  defaults,nofail  0 0
    Use ext4 instead of xfs if you chose ext4. nofail lets the server boot even if this disk is missing.
  8. Check the fstab line before you reboot:
    umount /data
    systemctl daemon-reload
    mount -a
    findmnt --verify
    mount -a must mount /data again without errors. A broken fstab line can stop a server from booting, so never skip this check.

Common problems

  • "Partition(s) ... have been written, but we have been unable to inform the kernel": run partprobe /dev/sdb, or reboot, before creating the file system.
  • Wrong disk chosen: stop at once. Data can sometimes be recovered with parted rescue or TestDisk if nothing more was written.
  • Want to use it with LVM instead: skip the file system step and run pvcreate /dev/sdb1, then add it to a volume group.

Official documentation: GNU parted manual and fstab manual page.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $131.99 a month.

Was this answer helpful?

Still stuck? Open a ticket