Gentoo Archives: gentoo-user

From: Pandu Poluan <pandu@××××××.info>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] LVM: extending volume groups and logical volumes
Date: Fri, 16 Dec 2011 13:29:50
Message-Id: CAA2qdGVDom6ePCtBMCrse=Q+yW57mF-AeLbj13r4Ly-RHF_BLA@mail.gmail.com
In Reply to: Re: [gentoo-user] LVM: extending volume groups and logical volumes by Neil Bothwick
1 On Dec 16, 2011 5:05 PM, "Neil Bothwick" <neil@××××××××××.uk> wrote:
2 >
3 > On Fri, 16 Dec 2011 08:41:07 +0100, J. Roeleveld wrote:
4 >
5 > > On Friday 16 December 2011 03:18:16 Allan Gottlieb wrote:
6 > > > I need to add space to /var (thank you, libreoffice), which is on lvm.
7 > > > Since my one volume group vg is getting low, I thought this would be a
8 > > > good time to extend it as well.
9 > >
10 > > Actually, you need space in /var/tmp/portage
11 >
12 > In fact, he needs space in wherever $PORTAGE_TMPDIR points to. Just set
13 > this variable to somewhere with enough space before emerging libreoffice.
14 >
15 > > > phy disk: /dev/sda my only drive
16 > > > phy part: fdisk create another partition of type LVM (/dev/sda8)
17 > > > phy vol: pvcreate /dev/sda8
18 > > > vol grp: vgextend vg /dev/sda8
19 > > > log vol: lvextend --size +10G /dev/vg/var
20 > > > file sys: resize2fs /dev/vg/var
21 >
22 > Did you say your existing PV is sda7? In that case, why mess with having
23 > two adjacent partitions are separate PVs in the same VG. Delete sda8,
24 > resize sda7 to fill the space and run pvresize /dev/sda7 to resize the PV
25 > to fit. Then you can use lvresize and resize2fs to increase /var, or
26 > create a separate space for PORT_TMPDIR.
27 >
28 > I prefer to keep potentially huge temporary directories away from
29 > critical filesystems like /var.
30 >
31
32 Alternatively, mount sda8 under /mnt, create "shadow" directories in sda8,
33 and bindmount them when needed.
34
35 E.g.:
36
37 mkdir /mnt/sparespace
38 mount /dev/sda8 /mnt/sparespace
39 mount -o bind /mnt/sparespace /var/tmp/portage
40
41 Of course, this assumes sda8 has enough space for heavy compiles (i.e., 10
42 GiB or more). Create a huge number of inodes or use a filesystem other than
43 ext[2-4] for sda8, and you're covered.
44
45 Rgds,