Skip to content
Log In Sign Up info@muvcloud.com

Read This First

  • Formatting erases everything: all files on the device are gone, and there is no undo.
  • Identify the device before anything else: run lsblk -f and match the size and name to the disk you added.
  • Never format a device that shows a mount point: a mount point means it is in use, possibly as the system disk.
  • Back up first: if the disk might hold anything of value, copy it off or take a snapshot.

Step 1: Identify the Disk

lsblk -f

The output looks similar to this:

NAME    FSTYPE FSVER LABEL UUID     FSAVAIL FSUSE% MOUNTPOINTS
vda
└─vda1  ext4   1.0         4f2c...    21.4G    22% /
vdb

Here vda is the system disk, with its partition mounted on /. vdb has no file system and no mount point, so it is the new disk. On virtual servers disks are often named vda, vdb, or sda, sdb; NVMe disks are named nvme0n1, nvme1n1, with partitions such as nvme1n1p1. Confirm the size with sudo fdisk -l /dev/vdb.

Step 2: Check for Old Signatures

Without options, wipefs only lists what it finds:

sudo wipefs /dev/vdb

If it shows an old partition table or file system on a disk you have confirmed is unused, sudo wipefs -a /dev/vdb removes those signatures. This step is destructive.

Step 3: Create a Partition

sudo parted /dev/vdb --script mklabel gpt mkpart data ext4 0% 100%
lsblk /dev/vdb

This writes a GPT partition table and one partition across the whole disk, named vdb1. A file system can also go straight onto the whole disk, but a partition makes the layout clear to every tool.

Step 4: Create the File System

File systemCommand
ext4sudo mkfs.ext4 -L data /dev/vdb1
XFSsudo mkfs.xfs -L data /dev/vdb1
  • ext4: the default on Debian and Ubuntu; can be grown and shrunk.
  • XFS: the default on AlmaLinux and Rocky Linux; handles large files well and can be grown but not shrunk. On Debian and Ubuntu, install xfsprogs first.

-L sets a label (up to 16 bytes for ext4, 12 characters for XFS). mkfs.ext4 refuses a device that is mounted or in use unless forced, and mkfs.xfs will not write over a device that already holds a file system unless you add -f. If either tool stops with such a warning, do not force it: check lsblk -f again.

Step 5: Mount It and Add It to fstab

sudo mkdir -p /mnt/data
sudo mount /dev/vdb1 /mnt/data
sudo blkid /dev/vdb1

Copy the UUID that blkid prints and add a line to /etc/fstab. Use the UUID, not /dev/vdb1, because device names can change between boots. nofail lets the server boot even if this data disk is missing:

UUID=your-uuid  /mnt/data  ext4  defaults,nofail  0  2

For XFS, write xfs and end the line with 0 0. Test the file before you reboot:

sudo findmnt --verify
sudo systemctl daemon-reload
sudo mount -a

No errors means the line is valid. Mount options and ownership are covered in how to mount a drive in Linux. Check the new space with df -h, as in how to check disk space in Linux.

Check a File System

Run a check only on an unmounted file system; checking a mounted one can damage it. For ext4:

sudo umount /mnt/data
sudo fsck -f /dev/vdb1

For XFS, the tool is sudo xfs_repair -n /dev/vdb1, where -n only reports.

Several Disks Together

To combine disks for redundancy before formatting, build a RAID array first and format the array device; see RAID levels explained. Formatting is not a backup strategy either: keep copies elsewhere, as described in snapshot vs backup.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations