# Ubuntu – Wanting to understand LVM & the default setup

gpartedlvmpartitioning

From what I understand LVM allows me to

resized and moved around almost at will ~ from here

Then I thought, with the usual partitions, I can also resize them? Perhaps with LVM I can have 1 Logical Volume span multiple disks?

Also the default LVM Setup in Ubuntu is abit confusing …

Whats the 255MB ext2 parition for? Shouldn't ext4 be better? Looks awefully similar to those OEM partitions on Windows …

Why is there 4MB wasted … How do I determine how much space I should allocate to swap. I read previously for Windows that if I have enough RAM, I should have low/no swap space to force OS to use faster RAM? True?

Why does Ubuntu split the same HDD into 2 different Views?

Why do I get such a different picture in GParted? No swap here? Then now, if I want to add a partition, I should shrink sda5 then add one? Since its the OS partition I cant do that when booted I guess?

I don't know why the default LVM setup was chosen, but I can offer some background on how LVM works.

Without LVM, you divide a disk in partitions, and each partition contains a filesystem (/, /home, etc.) or something else such as swap space.

LVM introduces a layer of insulation between the disk structures and the content-bearing structures. I'll refer you to the Wikipedia article for a more in-depth presentation, but in a nutshell, each disk partition is an LVM physical volume, while each filesystem or swap area is an LVM logical volume. There's no relationship between the extent of logical and physical volumes: the space in a physical volume can be divided between several logical volumes, and a logical volume can be stored across multiple physical volumes.

This explains why you're seeing two views. At the disk partitioning level, you have a disk with two partitions, one of which happens to be an LVM physical volume. At the content level, you have several filesystems, some of which happen to be on LVM logical volumes.

Parted isn't showing the LVM logical volumes. Either this version of Parted doesn't support LVM (hmm, I thought it did), or you need to tell it to switch to a different view, or you have already created partitions but not logical volumes yet.

I don't know where you're seeing 4MB wasted. I see 17MB unallocated, and I don't know why. Up to 4MB unused could happen with LVM: the size of each logical volume is a multiple of 4MB.

I don't know for sure what the 255MB ext2 partition is for, but I guess it's meant to be /boot. It used to be that Grub, the default Ubuntu bootloader, couldn't boot from LVM. But Grub 2, the default bootloader for new installation since Ubuntu 9.10, supports an all-LVM installation, so you probably don't need that boot partition. (There are rare cases where an ext2 boot partition is still useful, for example if you're dual-booting with another operating system that doesn't support loading a kernel from LVM or ext4.)