3

I have a quick question. I have a 64bit Ubuntu 10.04 server with 24GB of RAM and is used as a VMWare Workstation 7.1 host. I would like to use an in-memory drive for the VM Memory location, which I setup as the following:

tmpfs /mnt/vmware tmpfs defaults,size=100% 0 0

That all works. Next I want to allocate 16GB of RAM to the VM, I know its a lot but we do a lot of processing that needs a lot of RAM.

After the VM is started and I run df -h, I get the following for that drive:

Filesystem             Size  Used  Avail Use% Mounted On
tmpfs                  24G   11G   14G  44% /mnt/vmware

Why is it that the Available (14GB) size does not equal the Size (24GB) of the drive? And why wouldn't the whole 16GB get allocated to the memory space, which is what i set in the vmware guest .vmx file? Is there a limit to the space that can be allocated to a tmpfs file system?

Thanks for your time.

2
  • I don't understand the first question: available + used = size; I don't see any discrepancies here.
    – arrange
    Jul 20, 2011 at 16:45
  • Hey arrange, let me clarify. When I do df -h and for shm (shared-memory) it displays: Size = 18GB, Avail = 18GB; so why for my tmpfs does it say Size = 24GB & Avail = 14GB. Shouldn't Avail be 24GB? Or at least 16GB, which is how much memory I am allocating to the VM? How do I get it so 24GB is available in the tmpfs? Jul 20, 2011 at 17:59

2 Answers 2

1

Available space does not have to equal size. What you're seeing in the case of /dev/shm is the fact that the system uses very little or zero space for this filesystem (Used = 0), so in this case available = size.

I'm not sure why df doesn't show 16G of used space, but, generally speaking, when a process asks the kernel for allocation of space, the request might be granted, but the kernel can in fact allocate smaller space and later (in case more memory is needed) expand it.

1
  • Thanks arrange, that makes perfect sense. I guess I had my head in the clouds :) Jul 20, 2011 at 21:32
0

If the VM image is allocated as a sparse file, then it is possible for the apparent size to be larger than the file system in question.

In effect, if regions of a file have not been written to then there is no need to allocate any pages to store the parts that are just full of zeroes. So presumably 5GB of the guest image file you created is empty. If that space is used by the VM, the additional pages will be allocated to store it (assuming the resources are available at that time).

2
  • Hey James, thank for your answer but it doesn't really answer my question. What I am asking about is why when running 'df -h' the Availble space of an in-memory (tmpfs) mount does not match that of the Size of the mount? For example, on the shared memory mount (shm) they are equal: /dev/shm Size = 18GB and Avail = 18GB Jul 20, 2011 at 15:49
  • Oh. That would just be because you've actually allocated some space in the file system. You'd only expect the available space to be close to the total size of a file system if it was mostly empty. Jul 21, 2011 at 2:39

You must log in to answer this question.

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