2

I'm using ubuntu as a hypervisor with my production OSes running in VMware.

Since I installed everything onto an SSD, I placed the swap file off on a data HDD during install. Once I got everything setup, I needed to move the swapfile to a different section of a different physical HDD.

Being honest, I know enough about linux to get it to boot. I'm a windows power user who is completely flummexed trying to get this to work. I had no problems getting my virtual XP & 8 machines to use pagefiles I setup on HDDs even though their virtual machine files are stored on the SSD.

How do I get the swap space to turn on at boot. I have 14gb's of RAM, but VMware wants a swap file anyways. With terabytes of HDD space, I have no problem allocating a partition for this use, and without any other ideas, I used teh standard windows practice of as much swap space as you have ram.

Sorry for the long winded question.

2

Add the following line to your /etc/fstab to activate the swap partition at boot.

/dev/sdx  none    swap    sw     0       0
2
  • Two things, the partition I created, and turn on manually every time I want to run VMware is at /dev/sdc2. That would replace sdx in your above line? And how do I edit that file? I'm afraid I only know how to edit files in Windows, sorry. – J.D. Oct 31 '14 at 15:46
  • Yes /dev/sdc2 replaces /dev/sdx. From commandline use nano /etc/fstab to edit the file. – Pabi Oct 31 '14 at 16:33
0

You can use swapfile or swap partition - your choice. If not much use - I think swapfile will be enough.

Anyway - you have to create one of whatever size you need. Say - 1GB, just for example:

  1. create the empty file of 1GB size:

dd if=/dev/zero of=/swapfile bs=1024 count=1048576

  1. The best change permissions to allow only root to use it:

chown root:root /swapfile chmdo 600 /swapfile

  1. make it swap mkswap /swapfile

  2. also add it to /etc/fstab if you want it mounted automatically: /swapfile none swap defaults 0 0

  3. enable swap on that file swapon /swapfile

Of course you can locate it somewhere else, not necessarily in the root filesystem, and reflect it in the commands above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.