Skip to main content
Crusoe Support Help Center home page
Crusoe

How-To Configure and Mount Ephemeral Disks

Sagar Lulla
Sagar Lulla
Updated

Last Updated: Oct 30, 2025

Introduction

Ephemeral disks are temporary storage devices that are often used for short-term data storage. These disks may not show up in the df -h output even though they appear in lsblk, this can be due to missing configuration that needs to be part of the startup script to automatically detect the number of ephemeral disks and create an ext4 file system mounted at the /nvme path. If multiple ephemeral disks are found, the script will create a RAID0 array of the disks for additional performance benefits, mounted at the /raid0 path.

Symptoms

When performing lsblk command, you observe the following output:

lsblk.png

When performing df -h command, you observe the following output:

df.png

Prerequisites

  • Applicable to instance types that support ephemeral disks e.g. H100s, H200s, B200s, GB200s etc. 
    Note: L40s GPU SKUs do not support ephemeral disks.

Solution

Create a new instance with the below startup script:

#!/bin/bash
set -euo pipefail

echo "info: detecting NVMe drives by-id..."

# Collect all nvme-* symlinks, exclude partitions
all_symlinks=$(ls -1 /dev/disk/by-id/nvme-* 2>/dev/null | grep -vE '(_[0-9]+$|part[0-9]+$)' || true)

# Deduplicate: keep only one symlink per backing device
nvme_devices=""
seen_targets=""
for symlink in $all_symlinks; do
    target=$(readlink -f "$symlink")
    if ! echo "$seen_targets" | grep -q -w "$target"; then
        nvme_devices="$nvme_devices $symlink"
        seen_targets="$seen_targets $target"
    fi
done

nvme_devices=$(echo "$nvme_devices" | xargs) # trim
num_nvme=$(echo "$nvme_devices" | wc -w)

if [ "$num_nvme" -eq 0 ]; then
    echo "error: no NVMe drives were detected under /dev/disk/by-id/. Exiting."
    exit 1
fi

echo "info: found $num_nvme NVMe drive(s)."
echo "info: devices: $nvme_devices"

if [ ! -b /dev/md/ephemeral ]; then
    echo "info: creating md dev"
    sudo mdadm --create /dev/md/ephemeral \
        --force \
        --name=ephemeral \
        --level=0 \
        --raid-devices=$num_nvme \
        --homehost=any \
        $nvme_devices

    if [ $? -ne 0 ]; then
        echo "error: failed to create md dev"
        exit 1
    fi
else
    echo "info: md dev already exists"
fi

sudo udevadm settle

# Check if the RAID device is already formatted
if ! sudo blkid -p -u filesystem /dev/md/ephemeral >/dev/null 2>&1; then
    echo "info: creating xfs fs on md dev"
    sudo mkfs.xfs /dev/md/ephemeral
else
    echo "info: md dev is already formatted with an xfs fs"
fi

# Create mount point
echo "info: creating mount point /raid0"
sudo mkdir -p /raid0

# Mount the filesystem
if ! mountpoint -q /raid0; then
    echo "info: mounting /dev/md/ephemeral to /raid0"
    sudo mount -t xfs /dev/md/ephemeral /raid0
    
    if [ $? -ne 0 ]; then
        echo "error: failed to mount /dev/md/ephemeral to /raid0"
        exit 1
    fi
    echo "info: successfully mounted /dev/md/ephemeral to /raid0"
else
    echo "info: /raid0 is already mounted"
fi

# Add to /etc/fstab for persistence across reboots
if ! grep -q '/dev/md/ephemeral' /etc/fstab; then
    echo "info: adding entry to /etc/fstab for persistence"
    echo '/dev/md/ephemeral /raid0 xfs defaults,nofail 0 2' | sudo tee -a /etc/fstab
    echo "info: /etc/fstab entry added"
else
    echo "info: /etc/fstab entry already exists"
fi

# Verify mount
echo ""
echo "=== Verification ==="
echo "Mount point check:"
df -h | grep -E '(Filesystem|/raid0)' || echo "warning: /raid0 not found in df output"

echo ""
echo "RAID array status:"
sudo mdadm --detail /dev/md/ephemeral | grep -E '(State|Array Size|Raid Devices)'

echo ""
echo "info: NVMe RAID0 setup completed successfully!"

Verify

When a new instance is created, SSH into the VM and perform the below commands to verify disk attachment.

  • Output for command: lsblk

lsblk2.png

  • Output for command: df -h

df-h2.png

This would show the ephemeral disks associated to the VM. If the issue persists, perform the below:

  • Confirm if the /raid0 directory exists and try remounting the file system with

    # sudo mount -t xfs /dev/md/ephemeral /raid0
  • Lastly, try df -h to confirm the change. 

If the issue continues to persist, please contact Crusoe Support at support@crusoecloud.com and we will be happy to assist!

Additional Resources

Related to

Was this article helpful?

0 out of 0 found this helpful

Still need help?

Our support team is ready to assist you with any questions.

Have more questions? Submit a request

Recently Viewed

Comments

0 comments

Article is closed for comments.