Created
November 25, 2020 00:01
-
-
Save brianlechthaler/d903cabdd1e4445188407927d276e821 to your computer and use it in GitHub Desktop.
Easily create a ramdisk on any Linux system. Example: ./mkramdisk.sh 1g /mnt/ramdisk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export invokingUser=$(whoami) | |
echo "Usage: ./mkramdisk.sh <disk_size_bytes> <ramdisk_mountpoint>" | |
echo "Example: ./mkramdisk.sh 1G /mnt/ramdisk" | |
sudo mkdir -p $2 | |
sudo chown -R $invokingUser:$invokingUser $2 | |
sudo mount -t tmpfs -o size=$1 tmpfs $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment