Happy New Year </ font>
Licenses, disclaimers, and prohibitions regarding technical information written by us
Copy speed comparison when a virtual machine is set up on Ram Disk (Ram Disk, NvMe SSD, SSD, HDD, external HDD) --Qiita https://qiita.com/takoyaki3/items/d1b2623c62aba5231f90
brd: Block device created in memory --Qiita https://qiita.com/satoru_takeuchi/items/6ea57ca74016d5d92425
I wanted to build an on-memory virtual machine with VirtualBox, so I'm sorry.
Host OS: `` `modprobe brd``` possible, VirtualBox installed Linux Guest OS: OS that makes it easy to build a minimal environment such as Slackware Linux
RAM disk block device How Linux kernel 3.x manage ramdisk as block device? - Unix & Linux Stack Exchange https://unix.stackexchange.com/questions/157041/how-linux-kernel-3-x-manage-ramdisk-as-block-device
Using the RAM disk block device with Linux — The Linux Kernel documentation https://www.kernel.org/doc/html/latest/admin-guide/blockdev/ramdisk.html
brd.c was 550 steps of code. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/block/brd.c
VBoxManage internalcommands createrawvmdk
VBoxManage internalcommands createrawvmdk https://www.serverwatch.com/server-tutorials/using-a-physical-hard-drive-with-a-virtualbox-vm.html
Chapter 9. Advanced Topics - Oracle® VM VirtualBox® User Manual
https://www.virtualbox.org/manual/ch09.html#rawdisk
2a) Kernel Command Line Parameters
ramdisk_size=N
Size of the ramdisk.
This parameter tells the RAM disk driver to set up RAM disks of N k size. The default is 4096 (4 MB).
Source: https://www.kernel.org/doc/html/latest/admin-guide/blockdev/ramdisk.html#parameters
I wanted to allocate about 8G, so I set it to `1024 (KiB) x8 × 2 ^ 10 = 8388608 (KiB)`
(the allocation is [~~
m × {(2 ^ 10) × n } ``` ~~
m × (2 ^ 10n)` `` unit system](assuming https://ja.wikipedia.org/wiki/2 prefix)).
The command line on the host OS is as follows
sudo modprobe brd rd_size=8388608
This will bring up / dev / ramX (where X is a number).
Release the ramdisk after umount etc. in / dev / ramX
sudo modprobe --remove brd
I feel good.
The owner of the block device of the host OS, for example
$ ls -l /dev/ram0
brw-rw---- 1 root disk 1,0 January 1 11:08 /dev/ram0
If the current user belongs to the group "disk", the block device can be read and written without being promoted to root. It's a little easier, but be careful not to inadvertently say `` `dd if = / dev / zero of = / dev / sdX```.
The following is an example of a command line that generates a vmdk that reads / writes / dev / ram0 under `$ HOME /'VirtualBox VMs' /`
.
VBoxManage internalcommands createrawvmdk -filename $HOME/'VirtualBox VMs'/ramdisk.vmdk -rawdisk /dev/ram0
If you specify this $ HOME /'VirtualBox VMs' / ramdisk.vmdk
as the HDD of the virtual machine on the VirtualBox side, it is OK.
There was no problem with the normal OS installation procedure. With this method, the capacity that can be allocated to the virtual HDD is small, so I think that a lightweight OS is suitable.
Since / dev / ram0 is regenerated every time the host is restarted, the UUID of the device changes each time. ↓ Each time you need to recreate vmdk and re-register it in the virtual media manager or virtual machine.
It seems that this area should be made into a shell script and automated.
I searched for commands / apps that could be used for the same purpose when hosting an OS other than Linux.
According to the following, the same can be done using the mdconfig
(md probably stands for memory disk) command.
https://www.freebsd.org/doc/handbook/disks-virtual.html
It's a BSD system, and is it included in mdconfig?
mdconfig: command not found
orz
According to the following, `hdid``` and
`hdiutil``` are likely to be used for this purpose.
https://www.cnet.com/news/how-to-make-ram-disks-in-os-x/
~~ [Catarina](https://dic.nicovideo.jp/a/%E3%82%AB%E3%82%BF%E3%83%AA%E3%83%8A%28%E3%82% B0% E3% 83% A9% E3% 83% B3% E3% 83% 96% E3% 83% AB% E3% 83% BC% E3% 83% 95% E3% 82% A1% E3% 83% B3% E3% 82% BF% E3% 82% B8% E3% 83% BC% 29) ~~ OS 10.15 Catalina also had hdid and hdiutil, so it should be okay.
According to the following, ImDisk
seems to be usable for this purpose.
https://en.wikipedia.org/wiki/List_of_RAM_drive_software#Microsoft_Windows