Gentoo Archives: gentoo-user

From: Momesso Andrea <momesso.andrea@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Resizing physical volume for lvm.
Date: Sun, 22 Mar 2009 20:47:06
Message-Id: 20090322214239.69842cb9@revolver
In Reply to: Re: [gentoo-user] Resizing physical volume for lvm. by Alan McKinnon
1 On Sun, 22 Mar 2009 22:35:35 +0200
2 Alan McKinnon <alan.mckinnon@×××××.com> wrote:
3
4 > On Sunday 22 March 2009 22:15:14 Momesso Andrea wrote:
5 > > My current setup is:
6 > >
7 > > Device Boot Start End Blocks Id System
8 > > /dev/sda1 * 1 2894 23246023+ 83 Linux
9 > > /dev/sda2 2895 3381 3911827+ 82 Linux
10 > > swap /Solaris
11 > > /dev/sda3 3382 24804 172080247+ 83 Linux
12 > > /dev/sda4 24805 30401 44957902+ 83 Linux
13 > >
14 > > where sda3 is an lvm volume and sda4 is free space.
15 > >
16 > > I'd like to to merge sda3 and sda4 into a single partition without
17 > > losing the data on it, but I'm not sure if it is possible.
18 > >
19 > > My guess is that I can use fdisk to delete sda4 and sda3, create a
20 > > sda3 partition starting at 3382 and ending at 30401, then use
21 > > pvresize to enlarge it.
22 >
23 > Correct. That's all there is to it.
24 >
25 > > This is from man pvresize:
26 > > "Expand the PV on /dev/sda1 after enlarging the partition with
27 > > fdisk: pvresize /dev/sda1"
28 > >
29 > > Is that going to work or I'm going to lose all the data?
30 >
31 > Your data is safe if you do exactly the steps you said above.
32
33 Good to know! In any case backups are available, but I prefer not to
34 use them if not necessary.
35
36 >
37 > Caveat: I have no idea why this doesn't work, but if you make sda4 an
38 > extended partition and create sda5 as a logical with exactly the same
39 > start and end as you describe above, you do in fact lose all data.
40 > Obviously there is a difference between a physical and a logical
41 > partition with the same location, but I don't know why this is.
42 >
43 > Which is a pity, as 4 logical partitions is a little too
44 > constrictive, I prefer the extra freedom to move things around with
45 > extended partitions.
46 >
47 > > P.S. I'm not using vgextend to simply add sda4 to the lvm because I
48 > > might want to migrate my root (sda1) to ext4, and to do so I will
49 > > need to split it in two separate partitions (/boot using ext3 and /
50 > > using ext4). This way I'm not going to need extended partitions.
51 >
52 > ext3 on /boot is pointless. The ext3 metadata takes up a considerable
53 > chunk of the space on a typical /boot, for no good reason at all -
54 > writes to it are exceptionally rare so there's no real-worlld benefit
55 > to the journal.
56 >
57 > Ext2 is ideal for /boot.
58 >
59 Thanks for the advice. Will be a problem for lvm if I add a partition
60 before it? I mean, will I need to change any config files while lvm is
61 gonna reside on sda4 instead of sda3?
62
63 ---
64 TopperH
65 http://topperh.blogspot.com

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Resizing physical volume for lvm. Alan McKinnon <alan.mckinnon@×××××.com>