Skip to content

Instantly share code, notes, and snippets.

@letmein
Created September 17, 2013 13:20
Show Gist options
  • Save letmein/6594207 to your computer and use it in GitHub Desktop.
Save letmein/6594207 to your computer and use it in GitHub Desktop.
Postgresql ramdisk script
#!/bin/bash
/etc/init.d/postgresql stop
TMPDIR=/tmp/tmpfs; # the actual mount point for the tmpfs
MOUNTPOINT=/var/lib/postgresql/
umount $MOUNTPOINT
umount $TMPDIR
/etc/init.d/postgresql start
#!/bin/bash
/etc/init.d/postgresql stop
TMPDIR=/tmp/tmpfs; # the actual mount point for the tmpfs
MOUNTPOINT=/var/lib/postgresql/
[ -d $TMPDIR ] || mkdir $TMPDIR
mount -t tmpfs -o size=1G,nr_inodes=20k,mode=0777 tmpfs $TMPDIR
rsync --archive $MOUNTPOINT/ $TMPDIR/
mount -o bind $TMPDIR $MOUNTPOINT
/etc/init.d/postgresql start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment