1 |
On Sunday 22 March 2009 22:15:14 Momesso Andrea wrote: |
2 |
> My current setup is: |
3 |
> |
4 |
> Device Boot Start End Blocks Id System |
5 |
> /dev/sda1 * 1 2894 23246023+ 83 Linux |
6 |
> /dev/sda2 2895 3381 3911827+ 82 Linux |
7 |
> swap /Solaris |
8 |
> /dev/sda3 3382 24804 172080247+ 83 Linux |
9 |
> /dev/sda4 24805 30401 44957902+ 83 Linux |
10 |
> |
11 |
> where sda3 is an lvm volume and sda4 is free space. |
12 |
> |
13 |
> I'd like to to merge sda3 and sda4 into a single partition without |
14 |
> losing the data on it, but I'm not sure if it is possible. |
15 |
> |
16 |
> My guess is that I can use fdisk to delete sda4 and sda3, create a sda3 |
17 |
> partition starting at 3382 and ending at 30401, then use pvresize to |
18 |
> enlarge it. |
19 |
|
20 |
Correct. That's all there is to it. |
21 |
|
22 |
> This is from man pvresize: |
23 |
> "Expand the PV on /dev/sda1 after enlarging the partition with fdisk: |
24 |
> pvresize /dev/sda1" |
25 |
> |
26 |
> Is that going to work or I'm going to lose all the data? |
27 |
|
28 |
Your data is safe if you do exactly the steps you said above. |
29 |
|
30 |
Caveat: I have no idea why this doesn't work, but if you make sda4 an extended |
31 |
partition and create sda5 as a logical with exactly the same start and end as |
32 |
you describe above, you do in fact lose all data. Obviously there is a |
33 |
difference between a physical and a logical partition with the same location, |
34 |
but I don't know why this is. |
35 |
|
36 |
Which is a pity, as 4 logical partitions is a little too constrictive, I |
37 |
prefer the extra freedom to move things around with extended partitions. |
38 |
|
39 |
> P.S. I'm not using vgextend to simply add sda4 to the lvm because I |
40 |
> might want to migrate my root (sda1) to ext4, and to do so I will need |
41 |
> to split it in two separate partitions (/boot using ext3 and / using |
42 |
> ext4). This way I'm not going to need extended partitions. |
43 |
|
44 |
ext3 on /boot is pointless. The ext3 metadata takes up a considerable chunk of |
45 |
the space on a typical /boot, for no good reason at all - writes to it are |
46 |
exceptionally rare so there's no real-worlld benefit to the journal. |
47 |
|
48 |
Ext2 is ideal for /boot. |
49 |
|
50 |
|
51 |
-- |
52 |
alan dot mckinnon at gmail dot com |