Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #157515

Re: How to Boot with LVM

From Rick Thomas <rbthomas@pobox.com>
Newsgroups linux.debian.user
Subject Re: How to Boot with LVM
Date 2015-09-07 13:20 +0200
Message-ID <q62CS-3We-23@gated-at.bofh.it> (permalink)
References <q5ybL-2wJ-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
NAME             MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
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   


Enjoy!
Rick

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to Boot with LVM ray <ray@aarden.us> - 2015-09-06 04:50 +0200
  Re: How to Boot with LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-09-06 22:40 +0200
    Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-07 02:30 +0200
      Re: How to Boot with LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-09-07 10:40 +0200
        Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-08 01:50 +0200
          Re: How to Boot with LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-09-08 12:40 +0200
            Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-08 14:00 +0200
              Re: How to Boot with LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-09-08 15:00 +0200
  Re: How to Boot with LVM Rick Thomas <rbthomas@pobox.com> - 2015-09-07 13:20 +0200
    Re: How to Boot with LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-09-07 14:40 +0200
    Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-08 02:00 +0200
      Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-08 03:40 +0200
        Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-08 14:10 +0200
          Re: How to Boot with LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-09-08 15:10 +0200
            Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-09 04:00 +0200
              Re: How to Boot with LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-09-09 21:10 +0200
                Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-10 02:40 +0200
                Re: How to Boot with LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-09-10 17:00 +0200
                Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-12 04:30 +0200
                Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-12 05:10 +0200
                Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-14 02:40 +0200
                Re: How to Boot with LVM David Wright <deblis@lionunicorn.co.uk> - 2015-09-10 18:10 +0200
                Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-12 05:10 +0200
      Re: How to Boot with LVM Rick Thomas <rbthomas@pobox.com> - 2015-09-08 10:50 +0200
        Re: How to Boot with LVM ray <ray@aarden.us> - 2015-09-09 04:10 +0200

csiph-web