Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have Linux Mint 14 installed as my only OS. I have one extended partition containing /swap, / and /home, and I have some unallocated space on my drive.

I'm guessing that Mint decided to put this all on an extended partition instead of three primary partitions.

So I want to build Linux From Scratch using some of my unallocated space. My first question is, do I need to have a swap partition for each distro or can LFS use the swap partition I already have? If so, would the swap partition have to be a primary partition, or does it not matter?

Is there any practical difference between a primary and a logical partition?

A question about definition: is an extended partition just a primary partition that contains logical partitions?

Finally, since deleting Windows 7 (sda 1-3), my Linux partitions are still numbered 5-7. If I create a new partition, will it be called sda1?

Sorry for the question cluster but the sooner I learn this, the sooner I won't have to ask simple questions. :)

share|improve this question

2 Answers 2

up vote 3 down vote accepted

do I need to have a swap partition for each distro or can LFS use the swap partition I already have?

As goldilock says, unless you are hibernating (suspend to disk), yes. Otherwise no, because you could overwrite swap of a hibernated system - either it's saved state or the part that was used as regular swap at suspend time.

If so, would the swap partition have to be a primary partition, or does it not matter?

No, it doesn't matter at all. You can use swap in file on a regular filesystem, if need be (there is a small overhead, but it's also more flexible). You can even swap to NFS, if you're bold enough.

On the other hand, if you ran Windows 7 on the machine, chances are you have enough memory not to need swap at all under normal circumstances - even with "just" 2GB RAM you can do a whole lot of stuff without swap (basic desktop environment will use ~200MB). Not that swap would be unnecessary, but the need for it these days is much smaller then 10 years ago.

since deleting Windows 7 (sda 1-3), my Linux partitions are still numbered 5-7. If I create a new partition, will it be called sda1?

Since the disk is using the MBR partitioning scheme, the numbers, all logical partitions will have number 5 and higher. Unless you expand the extended partition that contains the logical ones, the only remaining space is likely available only for primary partitions, which will be numbered 1-3, provided the extended partition has number 4. See wiki on MBR for more details.

Is there any practical difference between a primary and a logical partition?

Not these days. BIOSes usually weren't able to boot from logical partitions (because they only read the MBR). Today the bootloaders usually know how to do this, so the only thing BIOS does in the system loading process is to read the bootloader trampoline from MBR (or boot sector in a primary partition) and that takes care of everything else by first loading rest of the bootloader, which in turn loads the kernel.

is an extended partition just a primary partition that contains logical partitions?

Yes, you can view it as such with a tiny bit of abstraction - it behaves as such, but the partition metadata is stored differently (as a linked list instead of an array with 4 elements which is what MBR is). As for question in the comment - yes you can only have one extended partition. But once you finalize your setup a bit (or even earlier), you might want to switch to GPT. It might even be possible to do it non-destructively (depends on the exact partitions layout).

share|improve this answer
    
That makes sense. I read that you can only have one extended partition. Is that true? –  Korgan Rivera Dec 6 '12 at 20:05
    
@KorganRivera I've elaborated the answer a bit more. –  peterph Dec 6 '12 at 20:18
    
Thanks. :) That answers all my questions. It sounds like MBR limits me. If I wanted a dozen partitions, it just can't happen. –  Korgan Rivera Dec 6 '12 at 20:26
    
@KorganRivera yes, you'd have to use GPT (or another partitioning scheme) for that. –  peterph Dec 6 '12 at 20:28

Short answer: You can use the same swap partition as the data in swap is not preserved from one boot to the next. It is totally normal to have multiple linux installations on a disk with a single swap.

There is one exception/caveat I know of, however: if you use hibernate (aka, 'suspend to disk'), hibernate uses your swap space for storage. If you then boot another system that also uses hibernate (or perhaps even one that doesn't), you could create some very nasty problems.

Most likely you would know and have some understanding of this if you are using hibernation, but I noticed recently that KDE seems to have included a "hibernate" option in one of its default menus. So to be clear: hibernate is like "sleep" (most people use that at least on laptops), except the computer does not require any power at all (the state is stored on disk, not in ram, and reloaded by the kernel at boot time).

So you only have to worry if you have been making use of some such feature but are unfamiliar with how it works. Normal "sleep" (aka, suspend-to-ram) is fine as it does not involve the swap partition.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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