Equnix Metal
On This Page
Loading...

Configuring NVMe Flash Drives

COMMAND LINE

Copy to clipboard

Configuring NVME Flash Drives

Equinix Metal™ offers server configurations that include NVMe drives, which are PCI-e attached flash cards. With NVMe drives, the common Linux disk utility, fdisk can not recognize or partition them. You can, however, use GNU parted to partition NVMe drives.

Currently, the m3.large.x86, s3.xlarge.x86, n2.xlarge.x86, m2.xlarge.x86, and x2.xlarge.x86 servers all come with NVMe drives.

This documentation provides an example for partitioning, formatting, and mounting an NVMe drive on an m3.large.x86 running Ubuntu 20.04 to help get you started using NVMe drives.

Checking the Drives

First, run lsblk to list all the block storage devices.

lsblk

You should see a response that lists the block storage devices in a tree. The NVME drives should show up as nvme0n1 and nvme1n1.

NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda       8:0    0 223.6G  0 disk
├─sda1    8:1    0     2M  0 part
├─sda2    8:2    0   1.9G  0 part [SWAP]
└─sda3    8:3    0 221.7G  0 part /
sdb       8:16   0 223.6G  0 disk
nvme0n1 259:0    0   3.5T  0 disk
nvme1n1 259:1    0   3.5T  0 disk

Installing parted

If it is not already installed, you will need to get GNU parted.

sudo apt update
sudo apt install parted

Creating the Partition Table

Use parted to create a new GUID partition table (GPT) on nvme0n1.

parted -a optimal /dev/nvme0n1 mklabel gpt

The option -a optimal sets the alignment-type for the new partition to optimal, and the mklabel gpt is what creates the GPT partition.

Creating the ext4 Partition

To create the EXT4 partition, use parted <drive> mkpart primary ext4. This example command creates a single, large EXT4 partition.

parted -a optimal /dev/nvme0n1 mkpart primary ext4 0% 100%

You can then use (parted) print in interactive mode to check that the partitioning was successful.

parted /dev/nvme0n1
>
GNU Parted 2.3
Using /dev/nvme0n1
Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print

The response should look something like:

Model: Micron_9300_MTFDHAL3T8TDP (nvme)
Disk /dev/nvme0n1: 3841GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  3841GB  3841GB               primary

(parted)

Entering (parted) quit will exit interactive mode.

Creating a EXT4 Filesystem

Then, create an EXT4 filesystem with mkfs.ext4.

mkfs.ext4 /dev/nvme0n1p1

Mounting the Drive

Once partitioning and filesystem formatting is complete, you can mount the drive.

mkdir /mnt/drive
mount /dev/nvme0n1p1 /mnt/drive -t ext4

Persisting the Configuration

In order to make the new volume persistent you will need to update /etc/fstab with the drives UUID.

First, the blkid command can be used to get a list of UUIDs for your devices.

blkid
>
/dev/sda2: UUID="b82f7e7d-b0c2-4c70-b7b7-c8627d95f8c3" TYPE="swap" PARTLABEL="SWAP" PARTUUID="727a1e48-958c-4a14-9833-4a2bd234ce0a"
/dev/sda3: LABEL="ROOT" UUID="ca604de1-d7d3-48fd-9a98-ee49ae890871" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="ROOT" PARTUUID="9606a493-e18b-4322-8665-25fd5d980ca5"
/dev/nvme0n1p1: UUID="ed876ef8-0726-43d5-9c06-db7ad33b3d79" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="primary" PARTUUID="1dbfc394-61ad-4e77-ad7f-286fc1c491c8"
/dev/sda1: PARTLABEL="BIOS" PARTUUID="796a0e77-35e8-44dc-a77c-2086babeebe1"

Once you have the correct UUID for the NVMe drive, add it to your fstab file. For example, add the line:

UUID=ed876ef8-0726-43d5-9c06-db7ad33b3d79   /mnt/drive  ext4    defaults    0   0

Your drive should be mounted on subsequent reboots.

Frequently
asked questions

Slack

Still stuck?

Join us on Slack

Get support from our team and community members.

Frequently asked questions

What 3rd party Managed Services?

Neutra trust fund narwhal, palo santo bicycle rights live-edge stumptown health goth portland selfies kinfolk woke. ssss Echo park irony artisan vaporware typewriter. Next level pinterest drinking vinegar lyft mumblecore af small batch heirloom VHS. Fixie banh mi asymmetrical trust fund.

What 3rd party Managed Services?

Neutra trust fund narwhal, palo santo bicycle rights live-edge stumptown health goth portland selfies kinfolk woke. ssss Echo park irony artisan vaporware typewriter. Next level pinterest drinking vinegar lyft mumblecore af small batch heirloom VHS. Fixie banh mi asymmetrical trust fund.

What 3rd party Managed Services?

Neutra trust fund narwhal, palo santo bicycle rights live-edge stumptown health goth portland selfies kinfolk woke. ssss Echo park irony artisan vaporware typewriter. Next level pinterest drinking vinegar lyft mumblecore af small batch heirloom VHS. Fixie banh mi asymmetrical trust fund.

Copied code to clipboard