Gentoo Archives: gentoo-user

From: "J. Roeleveld" <joost@××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] LVM: extending volume groups and logical volumes
Date: Fri, 16 Dec 2011 07:36:23
Message-Id: 201112160841.07959.joost@antarean.org
In Reply to: [gentoo-user] LVM: extending volume groups and logical volumes by Allan Gottlieb
1 On Friday 16 December 2011 03:18:16 Allan Gottlieb wrote:
2 > I need to add space to /var (thank you, libreoffice), which is on lvm.
3 > Since my one volume group vg is getting low, I thought this would be a
4 > good time to extend it as well.
5
6 Actually, you need space in /var/tmp/portage
7
8 > Alan (McKinnon) has posted very helpful lvm bits (reprinted below).
9 > Following alan's bottom up creation mandate I believe the idea is
10 >
11 > phy disk: /dev/sda my only drive
12 > phy part: fdisk create another partition of type LVM (/dev/sda8)
13 > phy vol: pvcreate /dev/sda8
14 > vol grp: vgextend vg /dev/sda8
15 > log vol: lvextend --size +10G /dev/vg/var
16 > file sys: resize2fs /dev/vg/var
17 > files/dirs: not relevant
18 >
19 > Questions
20 >
21 > 1. Apparently 2.6 (hence 3.x) kernels can expand mounted file systems
22 > (/var is mounted as ext3).
23 >
24 > Since I can't unmount /var because it is in use, I guess that, if I
25 > every need to shrink /var, I would need to boot off a CD. Is that
26 > correct?
27
28 For shrinking, you need to umount the partition first. Online-resizing only
29 works when increasing the size.
30
31 > Back in the day, we had single user mode for this, but I don't see
32 > how to get the equivalent now.
33
34 "rc single" (See Dales email)
35
36 > Is it really safe to extend /var (i.e., /dev/vg/var) while mounted
37 > as ext3? It sounds frightening since daemons could start running
38 > and access /var.
39
40 Yes, I regularly extend filesystems while already copying data to them.
41
42 > 2. Since currently /var is entirely from /dev/sda7 (my original lvm
43 > partition) should I use the optional parameter to lvextend to
44 > force the new space for /var to come from there as well?
45 > lv extend --size +10G /dev/sda7
46
47 No, LVM can assign space from any disk. It will know where to go when
48 accessing it.
49
50 If it's just temporary for LibreOffice, I'd suggest making a temporary LV, mount
51 it at /var/tmp/portage and then emerging the software.
52 Then when finished, umount and remove the LV.
53
54 I see no need to have /var really large for normal use and have never tried
55 shrinking filesystems myself.
56
57 > thanks in advance
58
59 Your welcome :)
60
61 HTH,
62
63 --
64 Joost

Replies

Subject Author
Re: [gentoo-user] LVM: extending volume groups and logical volumes Dale <rdalek1967@×××××.com>
Re: [gentoo-user] LVM: extending volume groups and logical volumes Neil Bothwick <neil@××××××××××.uk>