0

I was trying to make a swap partition, but an error message came saying

Primary Partition Not Available 

I checked the internet and found out there can't be more than 4 partitions because Linux only has room for 4 by default (for some reason). But I can see there's a sda5 in my partition table.

 /dev/sda1 229474304 230518783 1044480 510M 27 Hidden NTFS WinRE Free space 230518784 230520831 2048 1M /dev/sda2 230520832 934482553 703961722 335.7G 7 HPFS/NTFS/exFAT /dev/sda3 934483966 976771071 42287106 20.2G 5 Extended └─/dev/sda5 934483968 976771071 42287104 20.2G 83 Linux /dev/sda4 2048 20973567 20971520 10G 83 Linux 

How is there more than 4 primary partitions? Is sda5 even a primary partition? Why is sda5 looking like a branch of sda3? Please point me towards the right direction.

(I just wanted to make a swap partition, since LFS is recommending, DO I even need a swap partition when I have 8GB RAM?)

4
  • A Primary partition can contain (unsurprisingly) secondary partitions. sda5 is a secondary, and you can create many (I have 5 inside my /dev/sda3). The restriction to 4 is a result of a Microsoft decision which is tangled up with the boot mechanism. Commented Feb 19, 2021 at 11:54
  • 1
    To be more precise, the old MBR (or DOS, as it is also called) partition table from the 1980s has a size of 64 bytes (not a typo). It resides at the end of the first 512-bytes-block on the disk. Since each partition is described by 16 bytes, only 4 primary partitions are possible. sda3 on this particular disk is used as a container for an additional partition table elsewhere on the disk, which has enough room for plenty of secondary partitions. All that becomes a non-issue if you use the modern (i.e. not even 30 years old) GPT format instead of MBR. Commented Feb 19, 2021 at 12:20
  • The need of swap does not depend on the size of RAM alone. It depends on the workload. Since your system is most probably experimental without running much, you can probably live without swap space. Commented Feb 19, 2021 at 12:21
  • That was very informative @berndbausch, exactly what I needed. Commented Feb 19, 2021 at 17:00

1 Answer 1

0

/dev/sda5 is an extended partition (aka logical partition), hence it looks like a branch. Yes, that is true, Linux supports only four physical partitions. Your system already have four physical partitions. You can use cfdisk command to create a new logical partition (/dev/sda6) and use that for swap

2
  • Thanks, I really appreciate that effort, it worked like a charm. Commented Feb 19, 2021 at 16:58
  • 1
    Linux supports as many partitions as fit the disk. MBR partition tables have 4 entries, no matter which operating system uses the disk, Windows, BSD, Linux, etc. GPT partition tables have at least 128 entries according to the UEFI standard, and that's what Linux supports, too. Commented Feb 19, 2021 at 18:22

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.