Git Product home page Git Product logo

ramdisk's Introduction

ramdisk ๐Ÿ

Convenience wrapper for managing RAM disks across different operating systems with a consistent interface.

Usage

Help screen:

$ ramdisk -h
ramdisk 0.1.0 ๐Ÿ

Usage:
  ramdisk [options] create [<mount-path>]
  ramdisk destroy <device-path>

Options:
  -h -help      Show this screen.
  -v            Verbose output.
  -size=<mb>    Size in megabytes [default: 32].

Creating a new ram disk with a specified size:

$ ramdisk -size=512 create
512MB ramdisk created as /dev/disk5, mounted at /tmp/ramdisk-401987900
To later remove do: `ramdisk destroy /dev/disk5`

Installation

  • ๐Ÿ’พ Download a precompiled binary.
  • ๐Ÿบ Homebrew on macOS: brew install mroth/tap/ramdisk
  • ๐Ÿ“ฆ Compile via Go toolchain: go install github.com/mroth/ramdisk/cmd/ramdisk@latest

Platform Support

macOS โœ…

Works great and does not require superuser access.

The basic steps followed are:

  • Create an unmounted but attached device in RAM that consists of the appropriate number of device blocks via hdiutil.
  • Format a new uniquely named HFS+ volume on that device via newfs_hfs.
  • Mounts the volume at a uniquely generated path within the /tmp filesystem, via mount.

This normally requires a sequence of arcane commands on the macOS command line which I can never remember, and thus was the primary reason I created this wrapper.

Linux โœ…

Things are quite simple and work great via tmpfs on Linux! (But note that most Linux implementations unfortunately requires sudo access to mount new volumes.)

If you prefer a sudo-less route, most modern Linux on kernel 2.6+ often _already_ has `/dev/shm` mounted, which is memory backed, so you can also just use that without any initialization at all.

Windows โŒ

This would be great, unfortunately there is no built-in support at the operating system level at current time. The standard solution seems to be to use ImDisk, but I haven't built support for that into this library yet because well, relying on third-party drivers to be installed on an end user system isn't going to work.

ramdisk's People

Contributors

mroth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ramdisk's Issues

[CI] Phantom test errors from `diskutil eject` failure on macOS travis-ci

Occasionally macOS integration tests running on travis-co will fail when attempting diskutil eject <volume> subprocess in final step, with the process exiting with an error code, and Volume failed to eject being sent to STDOUT.*

Appears to happen about 10% of the time. When it happens on a particular travis worker, it will happen consistently on that worker (e.g. both tests will fail).

Right now I just am restarting builds over and over and trying to see a pattern and failing to see anything.

There is a branch in travis I have with some additional manipulations to see if I can provoke this but no dice so far. This is likely an upstream issue with travis-ci itself. ๐Ÿ˜ญ

Sample failing job: https://travis-ci.com/mroth/ramdisk/jobs/169950676

(*: yes, stdout, not stderr. diskutil is not excellent, see our mitigation in 6b03e99 where we rewrap that in our code so at least we log error messages consistently.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.