[SOLVED] Can pvresize handle adding space to the front (start) of the partition.
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can pvresize handle adding space to the front (start) of the partition.
The title says it all.
If I resize a disk partition by adding space at the beginning of a partition instead of the end will pvresize handle this?
Does the partition editor I use to do this have any impact on this?
Is gparted clever enough to do this safely? For example moving the existing data to the start of the new partition so that the offsets are not affected, as it does with normal filesystem partitions.
I can think of many potential pitfalls. I wonder if it would be easier to add the space as a new pv.
I wonder if it would be easier to add the space as a new pv.
Any comments?
Much safer.
Never tried it, and LVM is generally pretty accommodating, but it's "your foot, your gun". LVM is an emulation layer, so where the PEs actually reside shouldn't matter. But, like I said ...
But looking into this has made me realise how much I did not know about the actions that higher level partition editors such as gparted perform when partitions are moved or resized. It is fairly obvious what goes on with normal filesystem partitions. But, I suspect, the only way I can find out what will happen when the partition is a lvm2 pv is to look at the code.
Too hard for me these days - I once tried looking at the memory management code for swap. Drove me to drink ...
It's only data - if you're of a mind, try it and see what happens. If it all goes down the drain, restore it and try something else.
LOL.
I just looked. Going to put my head in bucket of water now! Many many years ago I came across this comment in the change log of some code. It went something like this. (UK date style)
xx/yy/1971 - Super whizzy new code added.
xx/yy/1972 - When I first wrote this only two people understood it. God and myself. Now, God only knows.
Mind you this guy also used to sprinkle his code with pieces of poetry!
There would not be any way to invoke pvresize on the enlarged partition. If you add space at the beginning, the partition will no longer begin with an LVM2 header, and pvresize will not recognize it.
You can use gparted to resize and relocate the partition. Properly done you would free the space before the partition, then relocate the partition into the new space while at the same time enlarging it. Doing that would handle the PV question. The PV is merely a partition or device and gparted handles that very nicely.
After the partition is resized then you can use the LVM tools to resize the LV and at the same time resize the file system.
To answer my own question. It looks like it is possible to do this using gparted live disk or similar. The reason for using a live disk is because the lv in question is the system root.
The steps to do it are.
1. Boot the rescue disk (it must support lvm).
2. Launch gparted
3. Select the correct disk.
4. Select the correct lvm2 pv partition.
5. In the partition menu select deactivate. The resize/move option should now be enabled.
6. Resize/move the partition. This process should include a pvresize step.
7. Activate the pv partition.
Now the question is. "Am I feeling lucky?". The answer is not until I really need to do it :-).
I still can't see why do you need it at all (what is it good for) and how does your steps will do that.
I was just documenting those steps for posterity. As I said am not going to use them yet. Before I do use them I will probably verify them on a test disk. If I do the test, I might remember to post the results back. If any else wants to try them, feel free.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.