Linux kernel module driver for virtual RAM disk
- Linux Kernel 3.10+ (also headers)
- CMake 3.0+
At first you have to build kernel module. Make sure you had installed Linux headers before by (on Debian):
sudo apt-get install linux-headers-[VERSION]
To compile Kernel module:
cd kmod
make
Then, you have to build util library and ramctl, so in main directory:
cmake .
make
To enable compiled kernel module, type in the kmod directory:
sudo insmod ramdrv.ko
mknod /dev/ramdrv c 250 0
To disable module just type sudo rmmod ramdrv
.
In userprog directory type:
sudo ./ramctl create [sectors]
where sectors is your size of ramdrive (1 sector = 512 bytes).
Now you can format and mount your drive:
sudo mkdir /mnt/ramdrv
sudo mkfs -t ext2 /dev/ramdrv0
sudo mount /dev/ramdrv0 /mnt/ramdrv
And that's all, you can use your ramdrive now.
To delete exact ramdrive just type in userprog directory:
sudo ./ramctl delete 0
where 0 is the disk minor identifier (in this case - in ramdrv0)