Skip to content

Instantly share code, notes, and snippets.

@adeubank
Created May 28, 2021 18:51
Show Gist options
  • Save adeubank/9bc2017f52979315532d5bd9da4a9838 to your computer and use it in GitHub Desktop.
Save adeubank/9bc2017f52979315532d5bd9da4a9838 to your computer and use it in GitHub Desktop.
This script will make a filesystem and mount a nvme1n1 device and modify the /etc/fstab for remounts on reboot -
# This script will make a filesystem and mount the device and modify the /etc/fstab for remounts on reboot -
#!/bin/bash
if ( lsblk | fgrep -q nvme1n1 ); then
mkfs.ext4 /dev/nvme1n1
mkdir -p /ephemeral1
mount /dev/nvme1n1 /ephemeral1
devid=$(lsblk --noheadings --output UUID /dev/nvme1n1)
echo "UUID=$devid /ephemeral1 ext4 defaults,noatime 1 1" >> /etc/fstab
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment