> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Mount a New Disk on Linux and Add It to fstab

> Mount a new disk on Linux: find it with lsblk, partition with parted, format with mkfs, mount it, then add its UUID to /etc/fstab with nofail so it mounts at boot.

To mount a new disk on Linux, find it with `lsblk`, create a partition with `parted`, format it with `mkfs.ext4` (or `mkfs.xfs`), and mount it with `sudo mount /dev/vdb1 /mnt/data`. To mount it at every boot, add a line with its UUID to `/etc/fstab`, for example `UUID=… /mnt/data ext4 defaults,nofail 0 2`, and test with `sudo mount -a`.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Intermediate | 15 minutes | Ubuntu, Debian, AlmaLinux, Rocky Linux, Fedora and other distributions | sudo, a new empty disk attached to the server |

## Before you start

* [Connect with SSH](https://help.freakhosting.com/portals/other/how-to-connect-to-a-linux-server-with-ssh.md). Commands use `sudo`; root users can leave it out.
* **Back up first.** Choosing the wrong disk in the steps below erases it. Make sure you have a current backup of any disk that holds data. See [back up a Linux server](https://help.freakhosting.com/portals/other/how-to-back-up-a-linux-server.md) and, on a VPS, [VPS Panel backups](https://help.freakhosting.com/portals/vps-panel/how-to-schedule-and-restore-backups.md).
* On a VPS, see which disks are attached on the [Storage page](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md). On a dedicated server, [open a ticket](https://freakhosting.com/clientarea/submitticket.php) if a disk you expect is missing.
* Install the tools if needed: `sudo apt install parted xfsprogs` (Ubuntu / Debian) or `sudo dnf install parted xfsprogs` (AlmaLinux / Rocky).

> [!WARNING]
>
> Partitioning and formatting **permanently delete** everything on the disk you choose. Double-check the device name at every step. Never run these commands on the disk that holds `/` (your system disk).

## How to find the new disk

```bash theme={null}
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
```

```text theme={null}
NAME    SIZE TYPE FSTYPE MOUNTPOINTS
vda      80G disk
├─vda1   79G part ext4   /
└─vda15 106M part vfat   /boot/efi
vdb     200G disk
```

Here `vdb` is the new disk: it has no partitions, no file system and no mount point. Names depend on the hardware:

| Server type | Typical names | First partition |
| - | - | - |
| VPS (virtio) | `/dev/vda`, `/dev/vdb` | `/dev/vdb1` |
| SATA/SAS disks | `/dev/sda`, `/dev/sdb` | `/dev/sdb1` |
| NVMe disks | `/dev/nvme0n1`, `/dev/nvme1n1` | `/dev/nvme1n1p1` |

Confirm the disk is empty. This command only reads:

```bash theme={null}
sudo wipefs -n /dev/vdb
```

No output means no partition table or file system was found. If it lists anything, the disk is not empty: stop and check you have the right one.

## How to partition and format the disk

**1. Create a GPT partition table and one partition**

```bash theme={null}
sudo parted -s /dev/vdb mklabel gpt mkpart data 1MiB 100%
```

GPT works for any size of disk. `1MiB 100%` uses the whole disk with correct alignment.

**2. Check the partition**

```bash theme={null}
lsblk /dev/vdb
```

You see `vdb1` under `vdb`.

**3. Format it**

> [tab] ext4 (Ubuntu / Debian default)
>
> ```bash theme={null}
> sudo mkfs.ext4 -L data /dev/vdb1
> ```

> [tab] XFS (AlmaLinux / Rocky default)
>
> ```bash theme={null}
> sudo mkfs.xfs -L data /dev/vdb1
> ```

XFS can grow but cannot shrink. ext4 can do both (shrinking only while unmounted).

## How to mount the disk

```bash theme={null}
sudo mkdir -p /mnt/data
sudo mount /dev/vdb1 /mnt/data
df -hT /mnt/data
```

```text theme={null}
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/vdb1      ext4  196G   28K  186G   1% /mnt/data
```

This mount lasts until the next reboot.

## How to mount the disk automatically with fstab

Device names like `/dev/vdb1` can change between boots. Use the file system's **UUID** (a unique ID) in `/etc/fstab` instead.

**1. Get the UUID**

```bash theme={null}
sudo blkid /dev/vdb1
```

```text theme={null}
/dev/vdb1: LABEL="data" UUID="fa505791-62ab-4926-b6c0-9dc06484a2b7" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="data" PARTUUID="685c62aa-cf70-423c-b541-cb05941bfbd2"
```

Use the `UUID=` value, not `PARTUUID=`.

**2. Back up fstab**

```bash theme={null}
sudo cp /etc/fstab /etc/fstab.bak
```

**3. Add the line**

Open `/etc/fstab` with `sudo nano /etc/fstab` and add one line at the end (use `xfs` instead of `ext4` for XFS):

```ini theme={null}
UUID=fa505791-62ab-4926-b6c0-9dc06484a2b7  /mnt/data  ext4  defaults,nofail  0  2
```

`nofail` lets the server finish booting even if this disk is missing. The last number `2` means "check this file system at boot, after the root file system".

**4. Check the file and test it**

```bash theme={null}
sudo findmnt --verify
sudo umount /mnt/data
sudo systemctl daemon-reload
sudo mount -a
df -hT /mnt/data
```

`findmnt --verify` should end with `Success, no errors or warnings detected`. `mount -a` mounts everything in fstab; if it prints an error, fix the line before you reboot.

> [!WARNING]
>
> A wrong line in `/etc/fstab` can drop the server into emergency mode at the next boot. Always run `findmnt --verify` and `mount -a` first, and keep `nofail` on extra disks. If the server does not boot, on a VPS use the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md) or [rescue mode](https://help.freakhosting.com/portals/vps-panel/how-to-use-rescue-mode.md) to restore `/etc/fstab.bak`. On a dedicated server, use your KVM/IPMI console or [open a ticket](https://freakhosting.com/clientarea/submitticket.php).

## How to let a normal user write to the disk

A new file system belongs to root. To let user `alex` write to it:

```bash theme={null}
sudo chown alex:alex /mnt/data
```

See [file permissions explained](https://help.freakhosting.com/portals/other/linux-file-permissions-explained-chmod-and-chown.md).

## Frequently asked questions

### Why can I not see my new disk in lsblk?

The disk may not be attached yet or may need a reboot to appear. On a VPS, check it is enabled on the [Storage page](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md). On a dedicated server, [open a ticket](https://freakhosting.com/clientarea/submitticket.php).

### Should I use ext4 or XFS?

Both are solid. Use the default of your distribution: ext4 on Ubuntu and Debian, XFS on AlmaLinux and Rocky. Choose ext4 if you might ever need to shrink the file system.

### Do I need a partition, or can I format the whole disk?

You can format `/dev/vdb` directly, but a partition table makes the disk's purpose clear to other tools and people, so it is the safer habit.

### How do I mount the disk somewhere else, such as /var/www?

Use that folder as the mount point. Move existing files out first: anything already in the folder is hidden while the disk is mounted on top of it.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Resize a partition after a disk upgrade](https://help.freakhosting.com/portals/other/how-to-resize-a-partition-after-a-disk-upgrade.md)
>
> Use new space on an existing disk.

> [card] [Use LVM on Linux](https://help.freakhosting.com/portals/other/how-to-use-lvm-on-linux.md)
>
> Combine and grow disks flexibly.

> [card] [Check disk space](https://help.freakhosting.com/portals/other/how-to-check-disk-space-on-linux.md)
>
> See free space with df.

> [card] [VPS storage](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md)
>
> Your disks in the VPS Panel.

***

> [!NOTE]
>
> **Checked against the official [Red Hat Enterprise Linux 9 file systems documentation](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/managing_file_systems/increasing-the-size-of-an-xfs-file-system_managing-file-systems) and the util-linux `findmnt`, `blkid` and `wipefs` manual pages** on 4 November 2026; `parted`, `mkfs.ext4`, `mkfs.xfs`, `blkid`, `wipefs -n`, a UUID fstab entry with `nofail`, `findmnt --verify` and `mount -a` tested on Ubuntu 24.04 LTS using a loop device. Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.