Gentoo Archives: gentoo-user

From: Allan Gottlieb <gottlieb@×××.edu>
To: gentoo-user@l.g.o
Subject: [gentoo-user] LVM: extending volume groups and logical volumes
Date: Fri, 16 Dec 2011 02:19:38
Message-Id: yu9mxattg2f.fsf@nyu.edu
1 I need to add space to /var (thank you, libreoffice), which is on lvm.
2 Since my one volume group vg is getting low, I thought this would be a
3 good time to extend it as well.
4
5 Alan (McKinnon) has posted very helpful lvm bits (reprinted below).
6 Following alan's bottom up creation mandate I believe the idea is
7
8 phy disk: /dev/sda my only drive
9 phy part: fdisk create another partition of type LVM (/dev/sda8)
10 phy vol: pvcreate /dev/sda8
11 vol grp: vgextend vg /dev/sda8
12 log vol: lvextend --size +10G /dev/vg/var
13 file sys: resize2fs /dev/vg/var
14 files/dirs: not relevant
15
16 Questions
17
18 1. Apparently 2.6 (hence 3.x) kernels can expand mounted file systems
19 (/var is mounted as ext3).
20
21 Since I can't unmount /var because it is in use, I guess that, if I
22 every need to shrink /var, I would need to boot off a CD. Is that
23 correct?
24
25 Back in the day, we had single user mode for this, but I don't see
26 how to get the equivalent now.
27
28 Is it really safe to extend /var (i.e., /dev/vg/var) while mounted
29 as ext3? It sounds frightening since daemons could start running
30 and access /var.
31
32 2. Since currently /var is entirely from /dev/sda7 (my original lvm
33 partition) should I use the optional parameter to lvextend to
34 force the new space for /var to come from there as well?
35 lv extend --size +10G /dev/sda7
36
37 thanks in advance
38 allan
39
40
41 ==================== from Alan McKinnon ==============================
42
43 Let's look first at the layers of stuff involved:
44
45
46 files & directories
47
48 file system
49
50 logical volume (LV)
51
52 volume group (VG)
53
54 physical volume (PV)
55
56 physical partition (i.e. /dev/sda1 etc)
57
58 physical disk (i.e. something Seagate etc made)
59
60 OK, there's a lot of stuff there. When you made the LV, you worked from
61 the bottom up
62
63 Nothing in that list can be bigger than the thing below it.

Replies

Subject Author
Re: [gentoo-user] LVM: extending volume groups and logical volumes Dale <rdalek1967@×××××.com>
[gentoo-user] Re: LVM: extending volume groups and logical volumes "Jens Müller" <blog@×××××××××.de>
Re: [gentoo-user] LVM: extending volume groups and logical volumes "J. Roeleveld" <joost@××××××××.org>
Re: [gentoo-user] LVM: extending volume groups and logical volumes Philip Webb <purslow@××××××××.net>
Re: [gentoo-user] LVM: extending volume groups and logical volumes Allan Gottlieb <gottlieb@×××.edu>