How To Mount A Local NVMe SSD for Disk Cache

One way to get a fast disk cache is to use a local NVMe SSD. This document describes the steps to mount a local NVMe SSD and set it up as a disk cache for ObjectiveFS. If your server has multiple local NVMe SSDs, see this guide for how to set up multiple local SSDs for disk cache.

  1. Run lsblk to view the block devices attached to your machine.
$ lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
nvme0n1       259:0    0    8G  0 disk 
├─nvme0n1p1   259:2    0    8G  0 part /
├─nvme0n1p127 259:3    0    1M  0 part 
└─nvme0n1p128 259:4    0   10M  0 part /boot/efi
nvme1n1       259:1    0 46.6G  0 disk 

In this example, /dev/nvme1n1 is the local NVMe with the 46.6GiB of storage and is not mounted on any directory.
Note: If your local NVMe is already mounted, you can use it directly by setting DISKCACHE_PATH to a directory on this disk and skip the remaining steps. See the Disk Cache User Guide for configuration details.

2. If the local NVMe SSD is not formatted, you can format it with the following command.

$ mkfs.ext4 -E nodiscard /dev/nvme1n1


3. Create the disk cache directory for ObjectiveFS /var/cache/objectivefs and mount the instance store.

$ mkdir /var/cache/objectivefs
$ mount /dev/nvme1n1 /var/cache/objectivefs


4. Run df to verify the disk cache directory is correctly mounted on the NVMe SSD.

$ df -h /var/cache/objectivefs
Filesystem        Size  Used Avail Use% Mounted on
/dev/nvme1n1       46G   24K   44G   1% /var/cache/objectivefs

Your disk cache directory on the local NVMe is now ready. See the Disk Cache User Guide for configuration details. Please also remember to configure the disk cache to mount on boot in /etc/fstab.

last updated by ObjectiveFS staff, October 7, 2024
ObjectiveFS is a shared file system for macOS and Linux that automatically scales and gives you scalable cloud storage. If you have questions or article idea suggestions, please email us at support@objectivefs.com