# user(s) | 112 |
# project(s) | 53 |
# build(s) | 309 |
Avg build time | 19.5s |
Queue len | 0 (0.0) |
Status | idle |
A LING instance, as any other Xen instance, can be configured to use a block device.
Add the following line to your Xen domain configuration file to map /root/images/disk1.img as a block device:
disk = [ "tap:aio:/root/images/disk1.img,xvda,w" ]
Upon startup the LING instance will report parameters of the attached block device. Look for lines beginning with vbd:.
Erlang on Xen exposes a simple low-level interface to the block device:
Function | Description |
---|---|
erlang:disk_info() -> [{Key,Value}] | undefined |
Retrieves a property list describing the attached block device or "undefined;" if the block device is absent. |
disk:read(Start, NumSect) -> {ok,Data} | {error,_} |
Reads NumSect consecutive sectors starting at Start and returns the result as a binary. |
disk:write(State, Data) -> ok | {error,_} |
Write a binary starting at Start. The binary must occupy a whole number of sectors. |
disk:barrier() -> ok | {error,_} |
Any subsequent writes will wait for earlier writes to complete. The operation may not be supported. See "features;" returned by erlang:disk_info(). |
disk:flush() -> ok | {error,_} |
Flushes the disk buffer cache. The operation may not be supported. See "features" returned by erlang:disk_info(). |
Currently, only a single block device can be attached to a LING instance.
It is also possible to set up a simple filesystem on the block device. To enable this, add “-goofs mount-at” to the command line arguments, when launching the instance. The block device will be automatically formatted upon its first use and mounted locally at the specified location.
The filesystem is flat and simple, yet capable enough to serve as a data store for mnesia/dets. The filesystem – called GooFS – is specifically designed for databases. More information about GooFS can be found here.