Skip to content

Instantly share code, notes, and snippets.

@nefftd
Created July 3, 2015 00:00
Show Gist options
  • Save nefftd/de986f32d5e556d11219 to your computer and use it in GitHub Desktop.
Save nefftd/de986f32d5e556d11219 to your computer and use it in GitHub Desktop.
#!/bin/sh
truncate -s 6G /swap;
chmod 0600 /swap;
SWFILE=$(mdconfig -a -t vnode -f /swap);
if [ $? -eq 0 ] && [ -n $SWFILE ] && [ -e "/dev/$SWFILE" ]; then
geli onetime -e AES-XTS -l 256 -d "/dev/$SWFILE" &&
swapon "/dev/$SWFILE.eli"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment