Discussion:
[linux-lvm] Prepend LV
Oleksandr Panchuk
2018-09-03 09:04:36 UTC
Permalink
Hello, All

I have not found any documentation about how to prepend LV with some free
space
.
Possible use case - we have LV with filesystem and data on it. But to
migrate this LV to KVM virtual machine we need to craft partition inside
this LV with already existing data.

I know it is possible to create new LV and copy data here, but it could be
time consuming for big LVs.

So, Is there any way to prepend LV with some free space ?

Thanks in advance,
Alex
Daniel Etter
2018-09-03 10:40:23 UTC
Permalink
Hello
Post by Oleksandr Panchuk
So, Is there any way to prepend LV with some free space ?
I don't know what a LV with free space should be good for,
but you can achieve this by lvextend.

#lvs /dev/mapper/system-home
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home system -wi-ao---- 25.00g

# df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system-home 25G 8.0G 16G 34% /home

# lvextend -L +20G /dev/mapper/system-home
Size of logical volume system/home changed from 25.00 GiB (6400 extents) to 45.00 GiB (11520 extents).
Logical volume home successfully resized

# df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system-home 25G 8.0G 16G 34% /home

# lvs /dev/mapper/system-home
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home system -wi-ao---- 45.00g


Daniel
Oleksandr Panchuk
2018-09-03 11:02:06 UTC
Permalink
Daniel,

Thanks for fast reply. But I looks like lvextend appends space after LV.

And after running lvextend we will get following:

[25GB LV] + [20 GB free space]

free space added after original LV.

But we need to prepend free space before original LV:

[20 GB free space] + [25GB LV]

free space added before original LV.

Thanks,
Alex
Post by Daniel Etter
Hello
Post by Oleksandr Panchuk
So, Is there any way to prepend LV with some free space ?
I don't know what a LV with free space should be good for,
but you can achieve this by lvextend.
#lvs /dev/mapper/system-home
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home system -wi-ao---- 25.00g
# df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system-home 25G 8.0G 16G 34% /home
# lvextend -L +20G /dev/mapper/system-home
Size of logical volume system/home changed from 25.00 GiB (6400 extents)
to 45.00 GiB (11520 extents).
Logical volume home successfully resized
# df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system-home 25G 8.0G 16G 34% /home
# lvs /dev/mapper/system-home
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home system -wi-ao---- 45.00g
Daniel
_______________________________________________
linux-lvm mailing list
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Zdenek Kabelac
2018-09-03 14:52:10 UTC
Permalink
Post by Oleksandr Panchuk
Hello, All
I have not found any documentation about how to prepend LV with some free space
.
Possible use case - we have LV with filesystem and data on it. But to migrate
this LV to KVM virtual machine we need to craft partition inside this LV with
already existing data.
I know it is possible to create new LV and copy data here, but it could be
time consuming for big LVs.
So, Is there any way to prepend LV with some free space ?
Hi

Lvm2 does NOT support prepend ATM - as there was no big need for such operation.

On the other hand - experienced user can with really low 'math-skill'
requirements for a manual extension on the 'ASCII VG metadata' file in 'vi'
editor - the format is quite easy to follow.

I assume there is already some RFE to provide such support - in terms of
existing limitation that you need to always prepend whole 'extent' (so i.e.
with 4MiB extent size - you need to prepend at least 4MiB)

Regards


Zdenek
Ondrej Kozina
2018-09-10 16:09:16 UTC
Permalink
Post by Zdenek Kabelac
I assume there is already some RFE to provide such support - in terms of
existing limitation that you need to always prepend whole 'extent' (so i.e.
with 4MiB extent size - you need to prepend at least 4MiB)
Here it goes: https://bugzilla.redhat.com/show_bug.cgi?id=1609189

Regards
O.
Oleksandr Panchuk
2018-09-21 13:07:07 UTC
Permalink
Hi, Ondrej

Thanks for link.
I'm looking forward for this feature in nearest LVM releases.

Thanks,
Alex
Post by Ondrej Kozina
Post by Zdenek Kabelac
I assume there is already some RFE to provide such support - in terms of
existing limitation that you need to always prepend whole 'extent' (so
i.e.
Post by Zdenek Kabelac
with 4MiB extent size - you need to prepend at least 4MiB)
Here it goes: https://bugzilla.redhat.com/show_bug.cgi?id=1609189
Regards
O.
Loading...