[Linux] Combining partitions

linux@flux.org linux@flux.org
Mon, 18 Aug 2008 16:19:52 -0400


Quoting David Williams <dwilliams@dtw-consulting.com>:

> I think what I am after is LVM, but now you've got me wondering.  So, with
> this I can add other partitions to the logical partition to increase the
> space on the logical partition ?
>
> Do I then need to always access this via the logical partition name ?

It sounds like LVM2 will do what you want, but there are some clarifications=
:

You can't just "merge" the two partitions.. It is a copy/delete =20
operation that you will do. That is, if you don't already have enough =20
free space in the volume group or filesystem associated with the =20
destination partition, then you will need to copy the source files =20
elsewhere then copy them back.
Say you have logical volumes lv_data1 and lv_data2 of 20G apiece, =20
mounted as /data1 and /data2. You want to merge /data2 to be part of =20
/data1. Both are in the volume group vg_data, but vg_data has only 1G =20
space available to allocation. To "merge" the /data1 and /data2 =20
partitions you'd first need to copy /data2 to other storage. Next =20
you'd unmount /data2, delete the LV (thus freeing its LPs/PPs back to =20
the volume group), then expand /data1 with the space you just =20
reclaimed. Finally you can copy the original /data2 stuff to the =20
resized /data1.