1

I've got a Centos 7 dedicated server with a SSD + a nvme ssd with 400gb. I followed a tutorial to mount + format (as xfs filesystem) the nvme disk so that I could setup my NoSQL databases on that drive. However every time I reboot my server the disk disappears and the mounted folder is empty again.

What commands I ran to mount the disk:

fdisk -l

Returned:

Disk /dev/nvme0n1: 400.1 GB, 400088457216 bytes, 781422768 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 275.1 GB, 275064201216 bytes, 537234768 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000b09ac

Device Boot Start End Blocks Id System /dev/sda1 * 2048 2050047 1024000 83 Linux /dev/sda2 2050048 528844799 263397376 83 Linux /dev/sda3 528844800 537233407 4194304 82 Linux swap / Solaris

mkfs.xfs /dev/nvme0n1 -f (-f was required after the first time)
mkdir /database
mount /dev/nvme0n1 /database

Afterwards it lists the drive when I run df -h, but once I restart it also disappears from that list. What am I doing wrong?

2

Try adding this to /etc/fstab:

/dev/nvme0n1 /database xfs defaults 0 0

That should do the trick.

  • Can you explain why that's needed? I don't understand what the command does – kentor Sep 20 '17 at 23:00
  • 1
    When you mount a device on the command line, it is only persistent for that session, the nature of it is not stored anywhere. By placing the entry in /etc/fstab, this file is read at boot time, and ensures your device(s) are mounted on system start-up. For this reason, be VERY careful when editing this file, don't touch any of the existing content. – Soruk Sep 20 '17 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.