[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to Boot with LVM

On Sep 5, 2015, at 7:24 PM, ray <ray@aarden.us> wrote:

> I would like to configure LVMs for everything including boot.

Is it “just for fun” or do you have a real-world reason for wanting everything, including boot, to be on LVM?

I’ll describe my own typical setup (special purpose systems may have different setups to meet special purpose needs).  For purposes of illustration, I’ll describe a system with two identical disks.  The principles should be clear as they apply to systems with larger or more varied configurations.  If you have only a single disk, you can skip the RAID parts in this and go straight to LVM.

I configure a small (<1GB) “/boot” partition as a primary partition (e.g. /dev/sda1) on one of the disks, with the same space on the other disk unused. [1]  I make another primary partition (e.g. /dev/sd[ab]2) , on each of the disks, sized to be one half of the size I want for my swap.  The rest of the space on each disk goes into a single, large, logical partition (e.g. /dev/sd[ab]5).

The two swap partitions I set up as a RAID0 (e.g. /dev/md0).  This will be my system swap. [2]

The two large logical partitions, I configure into a RAID1 (e.g. /dev/md1). [3]

I configure the RAID1 as the physical volume for a single volume group which I partition using LVM into a root that’s big enough to be about 50% full when fully installed,  and /home that’s as big as I think I’ll need for my users.  The remainder of the VG I leave unconfigured, so I can grow into it as needs become apparent over time.

If I have enough RAM to make it useful, I’ll put /tmp on a tmpfs.  I size it at about 50% of my swap space.  With a smaller RAM, I make a separate logical volume for /tmp.

[1] I know there are ways to make grub work with RAID1, but it’s too complicated for me to get it right.  Instead, I just make regular backups of the /boot partition.  If the disk with /boot on it develops a bad spot in an inconvenient place, I simply boot from a CD in rescue mode and restore the contents of /boot from a backup into the unused space that I reserved on the other disk.

[2] There’s no particular point in putting swap on a redundant RAID.  If your swap develops a bad spot, you probably want to boot from a CD into rescue mode ASAP so you can take necessary measures to fix the problem.  Using RAID1 for swap would just mask the problem — possibly until it’s too late.

[3] Conversely, everything else on the system wants to be redundantly protected.  If I have three or more disks, I’ll use RAID5; with four or more I might opt for RAID6.

Here’s an example:

rbthomas@monk:~$ lsblk
sda                8:0    0 465.8G  0 disk  
|-sda1             8:1    0   953M  0 part  /boot
|-sda2             8:2    0  18.6G  0 part  
| `-md0            9:0    0  37.3G  0 raid0 [SWAP]
|-sda3             8:3    0     1K  0 part  
`-sda5             8:5    0 446.2G  0 part  
  `-md1            9:1    0 446.1G  0 raid1 
    |-root-root  253:0    0  18.6G  0 lvm   /
    `-root-home  253:3    0   210G  0 lvm   /home
sdb                8:16   0 465.8G  0 disk  
|-sdb1             8:17   0   953M  0 part  
|-sdb2             8:18   0  18.6G  0 part  
| `-md0            9:0    0  37.3G  0 raid0 [SWAP]
|-sdb3             8:19   0     1K  0 part  
`-sdb5             8:21   0 446.2G  0 part  
  `-md1            9:1    0 446.1G  0 raid1 
    |-root-root  253:0    0  18.6G  0 lvm   /
    `-root-home  253:3    0   210G  0 lvm   /home
sr0               11:0    1  1024M  0 rom   


Reply to: