Re: Expanding an LVM partition at the front

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 21, 2011 at 2:00 PM, Roberto Ragusa <mail@xxxxxxxxxxxxxxxx> wrote:
> On 02/21/2011 08:17 PM, Matthew Saltzman wrote:
>> I deleted the partition immediately in front of an LVM physical volume.
>> I'd like to use the freed space as part of the LVM volume group.  I know
>> I could create a new partition in the same place, make it a physical
>> volume and add it to the group, but because the space is contiguous, I
>> wondered if it is possible just to move the front of the existing PV
>> partition to include the freed space.
>>
>> I tried changing the start of the partition using fdisk, but then the PV
>> is no longer recognized by LVM.  I suppose that means that there is
>> information about the PV stored in a particular location at the front of
>> the partition.  Putting the starting point back makes the PV
>> recognizable again.
>>
>> So is there a utility that can move the front of a physical volume
>> partition?  (gparted and fdisk apparently can't).
>
> What you are attempting is quite dangerous.
>
> I don't know if automated tools exist for this, but you should
> do this:
>
> let's suppose you have this layout
>
> partition 5 cyl 1600-1999 empty space
> partition 6 cyl 2000-2999 existing PV
>
> - destroy partition 5 and 6 with fdisk (not joking!)
> - copy data from 2000-2999 to 1600-2599 (dd on /dev/sda with appropriate bs,seek,skip,count)
> - now create partition 5 on 1600-2599
>
> At this point you should have your PV available again and you
> have simplified your problem to "I want to enlarge a PV", which you can do
> with fdisk (part5 from 1600 to 2999) and pvresize.
>
> Another probably much safer solution would be:
>
> - get a spare disk (even USB external one)
> - create new PV, add to VG, pvmove your PV to the new PV
> - destroy and recreate your PV
> - pvmove from USB PV to enlarged PV
> - remove USB PV
>
> This is less error prone. It can happen while the filesystem is R/W mounted too.

I'm not positive this would work and it certainly isn't elegant but...

Could you just:
- Create a partition in the space preceding the current partition
- Add the partition to the existing vg
- Allocate those extents to the current lv
- Expand the file system to fill the now extended lv.

I don't even like the idea, I'm just wondering if it would work. I
don't see why this would be any different that allocating extents from
several drives to make one lv / file system...

Richard
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux