Is swap primary or logical?
Default install usually puts swap in a logical partition. It really does not matter whether logical or primary other than future partition planning, so usually logical works better.
The swap partition is nested in the extended partition because that's what it means to be a logical partition. In your case, making the swap partition a logical partition rather than a primary partition won't change anything regarding the primary partition quota, since you don't otherwise have an extended partition.
Boot Partition: Your boot partition ought to be a primary partition, not a logical partition. This will ease recovery in case of disaster, but it is not technically necessary.
Windows must be installed on either a primary or a logical partition. Creates an extensible firmware interface (EFI) partition type. The EFI partition type configures the partition as an EFI system partition (ESP). This is a required partition for a GUID partition table (GPT)-based disk.
So, when Swap is at the end of the root, and I have some free space left to to extend to Swap size without touching the root partition (/) to avoid data lost. If you have swap in between, you cannot easily extend the swap size. You need to touch the root partition. That's the advantage.
If your system is using swap a lot, it will affect performance of the system overall as traditional drives are much slower than RAM. You either need to configure and adjust some of your applications to use less resources, or add more RAM.
Swap files in Linux
One is the swap partition, a dedicated section or partition on the drive. The second is the swap file that resides among system and data files and is easy to resize. With a swap file, a separate partition is not required.
You can install windows on an extended/logical partition if you already have a spare NTFS primary partition on the same hard disk. The windows installer will install the OS on the chosen extended partition but it needs the NTFS primary partition to install the boot loader.
When more than four logical disks are required on a single physical disk, the first partition should be a primary partition. The second partition can be created as an extended partition, which can contain all the remaining unpartitioned space on the disk.
How many logical drives can be set up on one physical drive? On a single physical drive, you can configure up to 24 logical drives. For a computer with one physical drive with C: drive as its first logical drive, you can configure up to 23 additional logical drives on that drive's extended partition if also configured.
Does 16GB RAM need swap space?
...
How much should be the swap size?
RAM Size | Swap Size (Without Hibernation) | Swap size (With Hibernation) |
---|---|---|
8GB | 3GB | 11GB |
12GB | 3GB | 15GB |
16GB | 4GB | 20GB |
24GB | 5GB | 29GB |
...
What's the right amount of swap space?
Amount of RAM installed in system | Recommended swap space |
---|---|
≤ 2GB | 2X RAM |
2GB – 8GB | = RAM |
> 8GB | 8GB |

...
Recommended swap with hibernation.
If using gpt which is highly recommended with UEFI boot, all partitions are primary. There is no extended and logical partitions like with MBR partitioning. You do not need swap partition with newer verisons of Ubuntu as it now uses a swap file. You can only have one ESP - efi system partition per drive.
A logical drive is a drive space that is logically created on top of a physical hard disk drive. A logical drive is a separate partition with its own parameters and functions, and it operates independently.
There is no better choice between logical and primary partition because you must create one primary partition on your disk. Otherwise, you will not be able to boot your computer. 1. There is no difference between the two kinds of partitions in the ability to store data.
With no swap, the system will run out of virtual memory (strictly speaking, RAM+swap) as soon as it has no more clean pages to evict. Then it will have to kill processes.
The short answer is, No. There are performance benefits when swap space is enabled, even when you have more than enough ram. Update, also see Part 2: Linux Performance: Almost Always Add Swap (ZRAM). …so in this case, as in many, swap usage is not hurting Linux server performance.
Uses of Swap Space
It is a technique of removing a process from the main memory, storing it into secondary memory, and then bringing it back into the main memory for continued execution. This action of moving a process out from main memory to secondary memory is called Swap Out.
To change the default priority of your swap partitions you would have to add/alter your /etc/fstab . also, if you have 2 swap partitions of the same priority on different disks, kernel will stripe swapping to them. It is like raid0, with the performance boost.
What is swap memory for?
Memory swapping is a memory reclamation method wherein memory contents not currently in use are swapped to a disk to make the memory available for other applications or processes. The exact state or "page" of memory is copied to the disk to make the data contiguous and easy to restore later.
Swap space is a space on a hard disk that is a substitute for physical memory. It is used as virtual memory which contains process memory images. Whenever our computer runs short of physical memory it uses its virtual memory and stores information in memory on disk.
A logical partition (LPAR) is the division of a computer's processor s, memory , and storage into multiple sets of resources so that each set of resources can be operated independently with its own operating system instance and application s.
Windows can be installed not only on a primary partition but also on a logical partition. Yes, the bootloader of Windows installed on a logical partition won't run, but it can still be booted by the bootloader of an OS on a primary partition.
- Input diskpart on the search box, right-click it, and choose "Run as administrator".
- Type each command line and press Enter: list disk > select disk* > create partition extended > create partition logical > format quick > assign letter=* > exit.
Deleting a partition effectively erases any data stored on it. Do not delete a partition unless you are certain you do not need any data currently stored on the partition. To delete a disk partition in Microsoft Windows, follow these steps. Press the Windows key or click Start.
Partitions and Logical Drives
Primary partition You can create up to four primary partitions on a basic disk. Each hard disk must have at least one primary partition where you can create a logical volume. You can set only one partition as an active partition.
With computer hard drives, a primary drive is the first drive on a computer with more than one drive. For example, in Windows, the primary drive is the C: drive. If you had another hard drive in Windows, it would likely be the D: drive.
The partitioning process shouldn't delete any data, but you can't be too careful when working with your hard drive. Partitioning in Windows' Disk Management tool.
An allocated part of a physical disk drive that is designated and managed as an independent unit. For example, drives C:, D: and E: on a Windows PC can represent three physical drives or one physical drive partitioned into three logical drives.
Why does my hard drive have 4 partitions?
The answer to why you have four partitions is: The EFI partition is used to store files used by UEFI. Recovery and restore are used to hold system files needed when performing for example a factory reset. The C: partition is your (and the operating systems) primary partition used for storage.
Also, any memory used during start up will naturally be recycled/overwritten when its no longer useful and other processes need the physical memory. There's no context in which you'd need to explicitly clear any such memory, and, unless one is using more than 32GB of memory actively, no need to swap.
/ (Linux system)
Now select the rest of the free space to create the root partition. Ubuntu recommends at least 15GB for the system partition. However, if you want to play games and install many programs, I recommend 50GB or even 100GB. It depends on the size of your hard drive and your needs.
5 GB is a good rule of thumb that will ensure you can actually hibernate your system. That should usually be more than enough swap space, too. If you have a large amount of RAM — 16 GB or so — and you don't need hibernate but do need disk space, you could probably get away with a small 2 GB swap partition.
- Step 1) Create a swap file of size 1 GB. ...
- Step 2) Secure the swap file. ...
- Step 3) Enable the Swap Area on Swap File. ...
- Step 4) Add the swap file entry in fstab file. ...
- Step 5) Extend Swap Space. ...
- Step 6) Now verify the swap space.
setup - tells dphys-swapfile to compute the optimal swap file size and (re-)generate an fitting swap file. Default it 2 times RAM size. This can be called at boot time, so the file allways stays the right size for current RAM, or run by hand whenever RAM size has changed.
Swapping refers to copying the entire process address space, or at any rate, the non-shareable-text data segment, out to the swap device, or back, in one go (typically disk). Whereas paging refers to copying in/out one or more pages of the address space. In particular, this is at a much finer grain.
Swap is disk space reserved for if you run out of RAM. Hibernate is the ability to save all RAM to disk and power off. In resume, the swap can be loaded to RAM for theoretically faster resume and to get back exactly where you left off.
You should put swap only on SSDs. Put it on HDD only if you are willing to accept the potential for thrashing, in return for more swap space. If you are still worried about SSD's lifespan, use "scratch SSD" that you can replace regularly, but I recommend trying to reduce swapping first, by eg. having more RAM.
The process of writing pages out to disk to free memory is called swapping-out. If later a page fault is raised because the page is on disk, in the swap area rather than in memory, then the kernel will read back in the page from the disk and satisfy the page fault. This is swapping-in.