I have been trying for a while to figure out the partition scheme on my desktop that was automatically installed by Ubuntu when I installed. I let Ubuntu create the partitions as it saw fit on my single disk system and I ended up with sda1 as I expected and sda5 as swap, but I also got a single block sda2 in between the swap and root. Does anybody know why this would have been created? The desktop is old and not efi. Also bonus points for explaining why the swap partition is on sda5 and not just sequential as I would have expected.
The numbers sda1-4 are reserved for "primary" partitions, of which there can be only four. Numbers sda5+ are for logical partitions which reside in an extended partition.
Extended partition is basically a partition holder, which can hold multiple logical partitions. This limitation of 4 partitions is from the old ages when DOS was used - extended/logical partitions are a workaround to allow more partitions in modern systems (however, GPT/EFI partitions are better and allow way more partitions on a single device).
In your case, I would expect this sda2 to be the extended partition which holds the logical partitions, sda5 (swap) in this case. You should be able to confirm this via a graphical partitioning tool such as
Edit: You can find more information about this here: http://en.wikipedia.org/wiki/Disk_partitioning (Check below headings "Primary partition" and "Extended partition".)