reset-ramdisk

By Hal Canary, 2004-03-28 00:50:48 (link)
#computers-code

The issue: as far as I know, no editor shreds old versions of files upon writing new versions. How do you keep data off of a hard drive? Use the ramdisk.

#!/bin/sh
## /usr/local/bin/reset-ramdisk ##
if `df | grep -q ramdisk` ;then
    umount /dev/ramdisk
fi
shred -n 2 /dev/ramdisk
/sbin/mke2fs -q /dev/ramdisk
mkdir -p /mnt/ramdisk
mount /dev/ramdisk /mnt/ramdisk
chmod 777 /mnt/ramdisk

Run that code before and after you are done with your work.
(Assumes a single-user system.) Don't forget to turn off swap!

$ sudo /sbin/swapoff -a

(back)