Skip to content

Instantly share code, notes, and snippets.

@mohakshah
Last active October 24, 2021 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohakshah/e0b8401b656b211796cf6faf41442fab to your computer and use it in GitHub Desktop.
Save mohakshah/e0b8401b656b211796cf6faf41442fab to your computer and use it in GitHub Desktop.
pre-run and post-run bash scripts for duplicati that manage a ramdisk based tempdir
#!/bin/bash
# remove the ramdisk to free up the ram
diskutil eject $DUPLICATI__tempdir
#!/bin/bash
# Origianl script from https://superuser.com/a/457376
# set the size of ramdisk here
ramfs_size_mb=1024
mount_point=$(mktemp -d -t duplicati-ramdisk)
ramfs_size_sectors=$(( ${ramfs_size_mb} * 1024 * 1024 / 512 ))
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
newfs_hfs -v 'duplicati tmpfs' ${ramdisk_dev} || exit $?
mkdir -p ${mount_point}
# remove "nobrowse" from options if you want to see the mounted ramdisk in the Finder sidebar
mount -o noatime,nobrowse -t hfs ${ramdisk_dev} ${mount_point} || exit $?
echo "--tempdir=${mount_point}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment