Results 1 to 4 of 4

Thread: Virtual Memory

  1. #1
    Alexwijn NNTP User

    Default Virtual Memory


    I'm using OpenSUSE, i would like to use some virtual memory of the hard drive, so i can use more memory for my applications. I cant add an new memory block in the computer, bcoz its an virtual computer.

    So is there any command i can use to use a part of the hard drive as virtual memory?


  2. #2
    Join Date
    Jul 2008

    Default Re: Virtual Memory

    GNU/Linux can use swap files as well as swap partitions. It shouldn't be difficult to find the exact procedure with uncle Google (it involves creating the file with dd, using mkswap and putting it in your fstab). In addition, if your virtual partition is filling up, you could perhaps add another virtual drive to your guest OS and place the swap file there.
    Even if free software were ****, it should still get our preference over the non-free **** secreted by IT corporations.
    A free rephrasing of RMS

  3. #3
    Join Date
    Jun 2008
    San Diego, Ca, USA
    Blog Entries

    Default Re: Virtual Memory

    If this is a Virtual Machine (you said virtual computer) running on another machine, then

    1. The virtual machine application(eg vmware, xen, virtualbox, etc) manages the physical resources on the Host machine used by the Guests

    2. There is little purpose to trying to manage memory usage in the Guest VMs themselves. You might partition for other purposes but don't waste energy specially modifying swap files/partitions for the purpose of memory management.

  4. #4
    Join Date
    Aug 2008

    Default Re: Virtual Memory

    How much RAM the host has? And how much is allocated to the VM?
    The best way is to increase the VM allocated memory. You may have to add more RAM to the host.
    In openSUSE 11, my experience is that it is best to leave at least 300 MB to the host, else it starts swapping too much. So if you have, say, 1 GB RAM, you may allocate up to 700 MB to the VM, assuming you are running only one. Of course, YMMV.

    Besides that, in linux (doesn't matter if it is real or a VM) you can create a temporary swap file, similar to that mess that windows does. You are not limited to swap partitions, but they do work much better.

    To create a 128 MB swap file in /swap, for example, type as root:

    # dd if=/dev/zero of=/swap bs=1024 count=131072
    # mkswap /swap
    # swapon /swap

    Change the number 131072 (128 x 1024) to the size you want. It doesn't have to be a multiple of 1024, you can use 250000 for example, to make a ~244 MB file.

    The /swap file is temporary, should deactivate after rebooting. You can remove it at any time with:

    # swapoff /swap
    # rmdir /swap

    See the respective man pages for more info.
    Last edited by brunomcl; 13-Dec-2008 at 10:32. Reason: improve info, typos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts