What is the use of /boot (lvm based) in partitioning?
[The information in this answer about GRUB2 and LVM is largely due to Jan's efforts; originally this answer was severely in error, and Jan deserves credit for the improvements I have made. -Eliah]
When not using LVM, a separate /boot
partition is primarily useful for ensuring that the files necessary for booting are close enough to the beginning of the drive, when the /
partition is itself not at the beginning of the drive. For example, you might want to put your linux-swap partition very near the beginning of the drive, since on some drives data near the beginning of the drive is potentially accessed more quickly. Then you could have a small /boot
partition, followed by your linux-swap partition, followed by the /
partition (then followed by other separate partitions if you have them, such as /home
).
For quite some time, this has been largely unnecessary, because with newer BIOSes, you can usually boot a system whose boot files are in a partition far from the beginning of the disk. Still, there is very little disadvantage to doing so (unless you make /boot
so small that it fills up--it should probably be about 250 MiB), so many people who partition manually still do this.
Older boot loaders like LILO themselves had limitations that made separate /boot
partitions helpful, as Jan points out.
When using LVM, if your /
partition is on the LVM, it used to be necessary to have a separate /boot
partition. In such a configuration, the /boot
partition is not be a partition of the LVM, but rather a partition on the disk before the LVM starts. This is because boot loaders could not read files from an LVM. So you could never boot into your system on the LVM if it didn't have a separate /boot
partition (see this and this for details).
The ability to read files from an LVM was added with GRUB2, which means that all recent versions of Ubuntu (Ubuntu 9.10 Karmic Koala and later) have it. So with proper configuration you can have your entire Ubuntu system in an LVM without a separate /boot partition. See this page for details about how to configure this. (In fact, the only currently supported Ubuntu release that uses the original GRUB instead of GRUB2 is Ubuntu 8.04 LTS Server; every other non-EoL release--10.04 LTS, 10.10, 11.04, and 11.10--uses GRUB2.)
If you're using LVM but not for your Ubuntu system drive, just for a storage drive, or for some part of your system (perhaps for /home
) but not /
, then a separate /boot
partition is not necessary, even if you are using an old (pre-GRUB2) system.
In summary, a separate /boot
partition is largely a matter of personal preference for systems that do not use LVM, whereas an older system installed on an LVM might need one.
/boot
exists for technical and historic reasons.
The boot loader (grub or lilo) must be able to access its own files, the Linux kernel and the initial ramdisk. Those files are placed in /boot
.
Early version of lilo could only access some subset of the HDD, would only understand a limited number of filesystems (practically only ext2), and required the filesystem to reside on a primary or logical partition (i.e. no md RAID or LVM). Therefore, it became common practice to have a small /boot
partition.
Modern versions of grub are much more flexible, and, therefore, in many cases a separate partition for /boot
is no longer required.
For dual booting Linux and Windows, /boot
is irrelevant (although I like to use the boot partition's boot sector for the boat loader.) However, when dual booting different Linux installation, it's common to share /boot
.