In principle there is no problem with all 4 primary partitions. Some of the new computers are shipping with 4 primary partitions. The main concern is, you will have no option to make any more partitions, in case you need one more.
Even though computers these days have enough RAM to run Ubuntu, the operating system has roots in older time when a swap
partition was a must. So even though you may not need it, it is a good idea to have one. It will make the system feel happy.
A separate /home
partition is actually an excellent idea. I put it in all my Ubuntu installs. This makes fresh installs of new versions dead simple. Sometimes upgrades from the previous versions don't go well. At other times, after four or five upgrades on top of one another, the system gets cluttered with stuff you don't need and a fresh install is the solution. In these situations a separate /home
partition makes it easy to retain your personal data and settings while starting afresh with a new system install.
So if you go with /
, /home
, and swap
you still have space for one more primary partition for data.
The partitions need not be in continuous blocks. You can leave unallocated spaces in between. For example, if you leave some unallocated space in between sda3 and sda4. You may later expand sda3 or move sda4 to the left and then expand sda4.
However, when the partitions get very full, there may not be enough space to copy files over for moving partitions. Then you won't be able to move them around. So, it may be better to adjust your partitions sooner than later.
Even though I don't remember the last time I had my data erased or corrupted by fiddling with partitions, it can happen. Sometimes it is operator error, that is, I make the wrong choice. Thus, it is very very important to backup everything in another hard drive before embarking on any kind of partition re sizing, moving, and deleting.
Hope this helps
First, if Windows 8 was pre-installed on the computer, it probably used the GUID Partition Table (GPT), which does not suffer from the 4-partition limit of the older Master Boot Record (MBR) partitioning system. Therefore, I recommend you check your partition table type. You can do this from an Ubuntu live disk (or your installed Ubuntu, if you've gotten that far) by typing sudo parted /dev/sda print | grep Table
. (This assumes you've got just one disk; if you've got more than one disk, do the same for each one, such as /dev/sdb
, /dev/sdc
, and so on.) If the output reads Partition Table: gpt
, you're using GPT, and something other than the 4-partition limit is causing you problems; if it reads Partition Table: msdos
, then you're using MBR. All this said, your symptom certainly sounds like the MBR 4-partition limit, so I'll assume that's what you're encountering. (Windows 8 may use MBR if you installed it or re-installed yourself, especially on an older computer.)
In Linux, if you type sudo parted /dev/sda print
, you'll see your partitions. Primaries are numbered 1-4 and logical partitions are numbered 5 and up. The same is true if you use sudo fdisk -l /dev/sda
. In GParted, the same numbering applies, but you'll also see the representation in the GUI shows logical partitions contained in the pale blue extended partition. This is easy to overlook, but it's pretty clear once you know about it. Third-party Windows tools should make this clear, too, although I'm not familiar enough with any of them to give you details. Unfortunately, the stock GUI tools that come with Windows are as clear as mud about this, so I don't recommend you use them for this purpose. Also, do not use the stock Windows tools to create partitions, particularly if that would bring their number over 4; these tools tend to convert from a plain-vanilla MBR setup to a proprietary Windows format atop MBR, and that proprietary format is essentially unusable for Ubuntu.
As to converting partitions from one type to another, it is possible, using the fixparts
program that comes with Ubuntu in the gdisk
package. See its online documentation for details. (Note: I'm the author of FixParts.) The big caveat is that converting to logical form requires a small gap before each to-be-logical partition. Given your layout, you might need to slightly shrink the partition before your Linux partition to make this work. Some third-party Windows tools can also reportedly do this conversion, but I'm not familiar enough with them to give details. There is a Windows version of FixParts, too. Whenever you muck with partition tables, there's some risk of catastrophic data loss, so you should definitely do this only after backing up important data. That said, the primary-to-logical conversion is simple compared to some (such as partition resizing, especially resizing from the front of the partition).
Swap space is optional for most purposes. Today, it's most useful if you want to perform suspend-to-disk operations, in which case you need at least as much swap space as you have RAM. It's also useful if you've got relatively little RAM, and to help the kernel improve performance by allocating RAM efficiently. (It can swap out programs you haven't used in ages, freeing up the RAM for use by caches.) You can set up a swap file rather than a swap partition, if you so desire.
Best Answer
You do not need a swap partition: you can just as well use a swap file. There is no performance difference between a swap partition and a swap file. To add a swap file:
Create the file (in this example, a 4 GiB file named
/swapfile
):Format it as swap:
Enable swapping on the new swap file:
Add the newly created file to /etc/fstab by appending
/swapfile none swap sw 0 0
to/etc/fstab
.See the Digital Ocean tutorial How To Add Swap on Ubuntu 14.04.