1

Is there a way to map disk as ram for a QEMU VM?

I do not have enough ram for a VM, so I thought if mapping an NVME partition as ram instead.

I guess, it is the opposite of a ramdisk.

3
  • 1
    The VM won't be very useful if it's running off of a disk as RAM, since it will be very, very slow (if you get it to work). What do you need this for?
    – Esther
    Commented Jun 26, 2022 at 20:15
  • "I cannot use swap for this case. " - Why? Edit your question to indicate the reason
    – Ramhound
    Commented Jun 26, 2022 at 21:32
  • @peterh- 2 year old comment. Why exactly did you ping me? Please avoid pinging me, especially if I am asking for clarification from the author of a question, and never after a year and a half.
    – Ramhound
    Commented Jan 16 at 12:00

1 Answer 1

0

Yes, you can do with

-mem-path FILE  provide backing storage for guest RAM

You can make things yet more quick if that FILE is actually a block device. You can further extend the flexibility and wonderfulness of your system, if that block device is actually an LVM volume.

Contrary the common belief, it won't be unavoidable slow, because there is a block cache in all modern OSes. It depends on, how the processes in your VM will want to use the RAM. If you have luck, your system can follow their memory access intentions by loading - unloading their required pages with minimal loss.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .