partition table - too many swap partitions and how big should extended partition be?

Tim Chase blinux.list at thechases.com
Thu May 1 11:19:20 UTC 2008


> - Work out what swap partition linux actually uses so I don't delete the 
> one it needs

There's usually an entry in /etc/fstab for each one.  You can 
find them with

   grep swap /etc/fstab

alternatively, you might try

   swapon -s

to print the current swap areas.

If you get more than one result, you likely have more than one in 
use which Linux certainly allows.  You can edit your fstab to 
point at whichever one(s) you want to keep.  You don't even 
*have* to reboot as long as everything you're running fits in 
memory without swapping.  You should be able to use (from my 
reading of "man swapon")

   swapoff -a
   edit /etc/fstab
   swapon -a

If you don't have enough memory, you might be able to create a 
swap-*file* using "dd", include that in your swap-pool, then 
disable your swaps on the partitions in question, edit your 
fstab, start swapping on your desired partition(s), and then 
disable swapping from the file.

> - Delete the unneeded swap partitions

using fdisk or cfdisk you can nuke these

> - Resize my linux partition to get the most space possible?

I'm less experienced with this one.  I'll let other experts speak 
to that one.

> Also there is a 10 gb extended space or something partition on my disk. It 
> is 10 gb, so how big should this be? Is it required and what is it for?

Without a dump of your partition table, it's hard to tell what 
you're seeing. My best guess from what you're describing is that 
you have some logical partitions (either active or available). 
Some terminology helps:  physical partitions, logical partitions, 
and extended partitions.  Most hard-drives only allow for 4 
physical partitions (this is changing with the advent of recent 
HD technology, but very slowly).  To get around this limitation, 
one or more of those 4 physical partitions can be designated as 
an "extended" partition, which can hold more logical partitions. 
   So if you wanted to have more than 4 partitions, you'd have to 
designate at least one extended partition, and then put your 
logical partitions inside that.

With that terminology in mind, it might help make more sense of 
what you're seeing in your output, or might help you pose the 
question in such a way that folks can be more helpful.

> I thought a linux install only needed a swap partition and a linux 
> partition for the actual install and files. (and if people then choose to 
> have /home on another partition then that is different, but I just said 
> all files in one partition.)

Linux can be installed in merely a single partition (swap is 
somewhat optional, though may take away the ability for the 
machine to hibernate), but as you note, more are possible (on my 
production machines, I like to have partitions for / /var /tmp 
/home /usr and one for swap so there is protection from them 
filling up and preventing other bits from functioning.  On my 
home machine(s), I usually just stick to three partitions:  / 
/home and swap.

Hope this gives you some ideas and help,

-tim







More information about the Blinux-list mailing list