Re: lvm resizing and shifting

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

 



Roberto Ragusa wrote:
Craig White wrote:

I was able to reduce the size of the logical volumes, move the logical
volumes so they are adjacent and then reduce the size of the physical
LVM but I cannot seem to reduce the partition itself and I'm gathering
that this may not be possible.

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               VolGroup00
  PV Size               95.00 GB / not usable 31.81 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              3039
  Free PE               127
  Allocated PE          2912
  PV UUID               oAYcCQ-5n28-0C6i-1LLE-voCR-E19v-SQYQK0

# fdisk -l /dev/sda

Disk /dev/sda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00086350

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       24792   199037317+  8e  Linux LVM

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/root              88G   54G   30G  65% /
/dev/sda1              99M   36M   59M  39% /boot

so in the end, /dev/sda2 remains approximately 200G and even the
gpartd-liveCD cannot resize /dev/sda2   ;-(

Is it even possible?


What you are attempting is not a common way to use the LVM system.
I often create many pv on one disk (sda2, sda3, sda4) just to avoid
this kind of problems.

The pv is now 95G, so only the first 95G of sda2 are used (usable).
Now, thinking about it, resizing sda2 could simply mean you
have to delete and immediately recreate sda2 with a smaller size.
We just have to be sure about where the pv metadata are stored.
According to

  http://www.guug.de/lokal/rhein-main/2004-09-23/LVM2_sage_23.09.pdf

we learn that

  LVM2 format is an ASCII text format which is at the beginning,
 after a disk label, of every PV in 2 copies by default
  in large configurations...

so it is at the beginning of the pv.

The procedure I'd try (assuming I had a backup of everything, as
_this is obviously dangerous_):

1) Boot from CD and without any kind of lvm detection.
2) Destroy sda2 and recreate it as 100G.
3) Boot the system again, check that the LVM is OK and
pvresize sda2 in automatic size (so it goes from 95G to 100G).

Step 3) avoids that you have to calculate the new size for sda2,
which is very difficult because of the partition and LVM roundings.

If you find the courage to try this, let me know how it went.

:-)
----
OK - makes sense and thanks for the concept.

By the way...in studying information on parted, it appears that it is not capable of resizing an LVM partition...which explains why I couldn't get anything done beyond lvresize/pvresize.

I'm currently backing up everything - which I probably should have done before I ever started but clearly, the steps you outline go beyond a simple leap of faith. Unfortunately, I am using a USB disk so the backup is quite slow - c'est la vie

To back up, I booted from CD #1 in rescue mode and am using the following command...

cp -ar /mnt/sysimage/* /mnt/usb

Does anyone think that there is a problem with this type of logic for backup in terms of preserving linked files, etc?

Obviously I will have all my user files so a complete wipe and clean re-install will only suck time but no important data and I've done it this way in the past but I keep wondering if I should have tar'd everything to the USB disk instead

Thanks

Craig

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux