Formatting NVME Partition on CentOS 7

Step 1: Create a partition:

# sudo fdisk /dev/nvme0n1
Choose “n” to create a new partition
Then "p" and "1" for new partition
Using default paratmeter, "w" to write data to disk

Step 2: Create a file system on it:

# sudo mkfs -t ext4 /dev/nvme0n1p1

Step 3: Create a mount point somewhere convenient:

# sudo mkdir /media/nvme

Step 4: Mount the new partition on that mount point:

# sudo mount /dev/nvme0n1p1 /media/nvme

Step 5: Permanently Mount the Device
Step 5a. To find the UUID first

# sudo blkid

Step 5b: To get it to mount every time, add a line to /etc/fstab:

UUID=nvme_UUID /media/nvme ext4 defaults 0 0

(where nvme_UUID is the value taken from “sudo blkid”)

Step 6 (Optional): At this point, the whole thing belongs to ‘root’

To change the ownership to a specific user (with the partition mounted):

# sudo chown -R user:usergroup /media/nvme

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.