Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I bought a new Lenovo B50-80 laptop with 4GB RAM, 500 GB HDD preinstalled with Windows 7 Professional. I would like to install Ubuntu alongside the existing Windows 7. For that when I tried to create a new partition using the Disk Management, it is not allowing me to do it. I'm getting an error message that I cannot create more than 4 partitions. I was able to shrink the C: volume and create unallocated space. But the unallocated space is showing as unusable in Ubuntu installation.

I tried to do the following:

  1. Copy / take back up of the Lenovo D: which has the Lenovo applications and Drivers. And delete the D:

  2. Now, we have a new One unused partition of 25 gb unallocated space for installing the Ubuntu.

I tried to install Ubuntu in the unallocated space of 25gb. Since it is a single partition, Ubuntu is asking me to create another partition allocating 4gb for the swap area. When I try to do that, the remaining 21gb space is becoming unusable (Since, the Windows partition does not allow more than 4 partitions).

My question is can we install Ubuntu in the unallocated space of 25gb in a single partition? Is Swap area partition necessary? Can we install Ubuntu without a Swap area? Can Swap area be allocated as file space instead of a separate partition? What will happen if I install without a swap area?

share|improve this question

marked as duplicate by Parto, Braiam, Serg, Eric Carvalho, cipricus Feb 16 at 23:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
Technically one doesn't need, but it's strongly recommended - one's system could run out of RAM. So what's gonna happen then ? Likely crash. I've an SSD drive, and 6GB RAM with 512Mb swap file, and when using virtual box sometimes would run out of memory, and the system would just freeze. Once I increased it to 1 GB - everything stopped crashing. So I'd say technically one always should have some swap – Serg Feb 11 at 18:15
    
I personally don't have a swap partition on my Fedora box but I have 16GB RAM. My wife has only 2GB on hers so I put a 4GB swap partition in. It depends on how likely you are to run out of resources. – Dan White Feb 11 at 22:00

No, you don't need a swap partition, as long as you never run out of RAM your system will work fine without it, but it can come in handy if you have less than 8GB of RAM and it is necessary for hibernation. For more information see this question: Do we still need swap partitions on desktop?

However, you can get around the 4 partition limit by creating an extended partition, and then creating a swap partition and a default partition (these "sub" partitions appear under the extended partition and are called "logical" partitions). This will be an option when you create your partitions in the installer. Check out this related question: My disk already has 4 primary partitions, how can I install Ubuntu?

share|improve this answer
7  
I think it's incomplete to say "your system will work fine without it". From the answer you referenced: "If you have no swap space and happen to be out of RAM, the kernel will pick one or more processes which it thinks are good candidates and kill them." This is important to know about if you start running VMs on your machine and suddenly encounter bizarre behaviour and data loss. – deed02392 Feb 11 at 5:51
1  
@kasperd You won't necessarily see performance impact before irretrievable data loss. The behaviour you're describing will likely happen in a situation with a higher proportion of main memory cached disk files, than processes with lots of memory allocated, but I would suggest with things like web browsers, it's quite easy to have large amounts of data in RAM that can't be paged to disk (because swap is off). We all use our machines differently, I just feel the probability of there being data loss is not addressed in this answer, when I think it ought to be. – deed02392 Feb 11 at 8:56
1  
@deed02392 The data lost due to killed processes is certainly a relevant point, and I did upvote your first comment for that reason. I consider both problems to be worth addressing. In my experience the performance issues have always been showing up before processes being killed, but I am willing to believe there can be workloads where it will be the other way around. I don't particular feel like experimenting with it though. I just make sure all of my systems have a swap partition. – kasperd Feb 11 at 12:21
1  
There is another way to get past the 4 partition limit: use GPT partitioned disks. A modern computer should support it – SztupY Feb 11 at 17:06
1  
Another option for getting around the four-partition limit is to use a swapfile: it's not quite as efficient as a dedicated partition, but it's probably easier than mucking around with partition layouts. – Mark Feb 11 at 22:02

You don't really need a swap partition. In our times computers have 4GB of RAM or more. That is normally enough for daily use.

But... If you do RAM heavy tasks your machine might run out of RAM... and crash.

In my opinion a good solution for you is to install Ubuntu on that single partition an add maybe 1GB of swap as a swapfile.

Here is a good toutorial for that... Ubuntu Linux Create and Add Swap File Tutorial

Another solution would be to enable zRam. Look here... How do I use zRam?

share|improve this answer
    
Thanks for your reply. Since I have 4GB of RAM, I'll try to install Ubuntu in the single partiion of 25GB by giving / root. And I will try to create a swapfile instead of a swap partition. Will update the results. Thanks ! – SubinR Feb 11 at 16:51
    
I have 4Gb RAM, and my machine uses swap when I use memory-intensive tasks. For example, I have a large LibreOffice document with many large images, and when I edit this, my swap is used. Without swap, my machine crashes. So, I recommend swap regardless. – Paddy Landau Feb 16 at 10:23

Swap partitions do two things: they can provide an overall speed boost by freeing up memory for more cache, and they can prevent rare disastrous out-of-memory situations where the system will start killing processes without warning.

If you have tons of RAM, you probably aren't needing it for a speed boost - it'll almost never be utilised. But it is still a good idea to have it for the other purpose: just in case you run out of memory completely. This can still happen even in these days of 8GB+ RAM, ie due to a rogue process, or a very memory-heavy process such as an image editor.

You don't need to use a partition. It is possible to have a swap file instead of a swap partition. Just don't set up any swap partition, and then set up a swap file later.

share|improve this answer

Agree to all the above answers. Nowadays no essentially when you have lots of RAM(16 or 32 GB etc...). In my 32 GB RAM Desktop the swap partition is not being used to a great extent. I kept it as I am working with lot of Bigdata Hadoop and NoSQL which are in general Java based and can result into OOM(Out of memory errors). So just in those kind of scenarios it's good. It never hurts to keep it and if you feel it is not being used then simply merge it to '/'My SWAP Partition usage

share|improve this answer
up vote 1 down vote accepted

Thank you all for the suggestions and inputs. With all your help, I was able to successfully Install Ubuntu 14.0.4 LTS alongside Windows 7 Professional. My Laptop is Lenovo B50 80 with 4 GB RAM, 500 GB HDD preinstalled with Windows 7 Professional.

I'm summarizing what I did below, so that it may help others.

As mentioned in the question, I tried to shrink the C: Volume using Disk Management in Windows and allocated some space to install Ubuntu.

But, when I tried to install Ubuntu in the unallocated space, it was showing as unusable. (It is because Windows does not allow to create more than 4 partitions)

Finally, this is what I did :

Steps to Install Ubuntu alongside Windows 7 in Lenovo B50 80 :

1: The Windows has two drives/ partitions : (Windows C: and Lenovo D: ) other than the 2 hidden partitions for One Key Recovery.

2: The Lenovo D: is 25 GB and has Applications and Drivers folders. We can take a back up of that. ( In a flash drive or by copying it to the C: ).

I believe all the Applications and Drivers are available in the Lenovo website and it can be downloaded. So, I went ahead and deleted the D: partition. So, now there is an unallocated space of 25 GB. Ubuntu needs only 6 GB space for installation. So, 25 GB is more than enough.

But if you think you need more space allocated for Linux. You can shrink the C: upto 200 GB and it will merge with the already unallocated 25 GB. So, now you will be having a single partition of unallocated partition of 225 GBs.

  1. Now restart the system with Live USB Ubuntu Flash Drive. Select Try Ubuntu.

  2. After Ubuntu is loaded. Click Install Ubuntu.

  3. The installation window opens. Select the Language. Click Next/ Continue

  4. There will be options like "Install Ubuntu alongside Windows 7" . But in my case, Ubuntu did not detect Windows 7, so, I got only the following options:

    • Erase the disk and install Ubuntu

    • Something Else.

  5. Choose "Something Else" and click Continue. You will get the Partition screen.

  6. Now you will be able to see all the partitions with the Windows drives and the free space of 225 GB.

  7. Select the Free space and click + at the bottom to create a new Partition.

First, create a partition for Swap Area with 4 GB space. So, Give Size as 4096.

Choose the type of Partition as "Logical" instead of "Primary". Select "Use as" as Swap Area.

Click Ok.

Next we can use the remaining free space for the rest of the Linux installation.

Again Select the Free Space and click + at the bottom.

Size will be having the remaining free space size by default. Choose the type of Partition as "Logical" instead of "Primary".

Select "Use as" as "Ext4 Journaling File System".

Select Mount Point as " /" .

  1. Choose your hard disk "/dev/sda..." for "Device for boot loader Installation" Option.

Click "Install Now". You will get a warning pop up that the two partitions you created now will be formatted.

Click Ok and continue with the Installation.

  1. The Installation will be completed successfully and it will ask you to restart the system.

  2. Go ahead and restart the system.

  3. Remove the Live USB flash drive before rebooting.

  4. The system will sometimes boot to Windows or Ubuntu. You will not get the GRUB loader.

If your system boots to Windows by default and you don't see Ubuntu. Shut down and reboot with Live USB again to Ubuntu.

In my Case, the system restarted to Ubuntu.

  1. Now we need to install the Boot Repair to fix the grub. So, Open the terminal and give the below commands one after the other:

sudo add-apt-repository ppa:yannubuntu/boot-repair sudo apt-get update sudo apt-get install -y boot-repair boot-repair

  1. Boot Repair will open in GUI format. Just follow the given instructions and complete the process.

The GRUB will be successfully fixed.

  1. Shut down and restart the system. You will be seeing the GRUB to choose Ubuntu or Windows to boot.

Any suggestions to improve the above steps are most welcome. Thanks !

Enjoy the Dual Boot = Ubuntu and Windows !!

share|improve this answer

It depends on what you are running on your system.

If you are creating content, it is probably a good idea to still have swap space allocated, so if you do run out of RAM, your processes just get slow instead of being killed and potentially losing work.

If your machine is just running programs, then you don't need or even want swap space. I design and build many kiosk-like display systems that fit this usage exactly. I'd rather a process die suddenly than be slow, because then I can detect that condition and correct it.

As has been said before, you can allocate swap files on your root filesystem after installing if you have run out of main partitions. You might also be able to create an extended partition as one of your main partitions that can overcome the 4-partition limit, if you have a disk that is MBR-based. GPT disks don't have the 4-partition limit.

share|improve this answer

Actually if you did its better. As others has said its ok. If you didn't unless you know that you won't run out of ram. But in case if you needed. You can reserve a pen drive to the swap. Its simple through Gparted

share|improve this answer
    
A pen drive for swap? Really? That's a stupid idea. The data rate is extremely low and a GB of space on an USB pen drive is much more expensive than one on your hard disk. Better move some data to the pendrive if there's no space for swap left on the HDD. And other than that, this does not add any valuable information... – Byte Commander Feb 17 at 8:48
    
Really then can you e xplain why windows uses ready boost technology for improving performance. Hope you have answers – Laksith Feb 20 at 1:51
    
Readyboost is not swap or a paging file like windows virtual memory. Its a cache - its used to store some types of information when storage on flash has a beneficial effect on random access. Readyboost is in addition to virtual memory, not instead of it. Even then you can't use it without a sufficiently fast drive. Totally not the same. – Journeyman Geek Feb 21 at 11:50
    
I didn't mention its the same but you mentioned as a fact that The data rate is extremely low and a GB of space on an USB pen drive is much more expensive than one on your hard disk. So as to your fact why would the windows use it as extension to the virtual memory on your words.... – Laksith Feb 22 at 6:31

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