2

I have sda disk with 2 partitions. The second partition sda2(which is LVM) is 1.4TB in size and want to shrink to 50GB. I reduced Logical volume to 50GB but when I run vgdisplay it shows Free PE / Size 1.33 TiB. I want this free space to have sda and not sda2 for to create sda3 partition which I want not to be formatted (Who is familiar with Oracle and asm , I will clarify that I want sda3 to mark as an asm disk)

So I want to take 1.33 TiB from sda2 and give it to sda, how? Please, help.

fdisk -l

pvdisplay

vgdisplay

lvdisplay

kupa
  • 381
  • 2
  • 8
  • 18
  • Is it not possible for oracle to use a logical volume? It seems that would be easier to do rather than repartitioning. – DerfK Aug 20 '12 at 14:44

2 Answers2

3

You must resize the LVM physical volume after you have reduced the partition on the filesystem with fdisk.

I have not the possibility to confirm the exact steps right now, so you should get someone to review the steps before you perform them.

1. Backup your data!

In case something goes wrong, make sure you have your data backed up.

2. Resize the filesystem

resize2fs -p /dev/VolGroup00/LogVol00 50GB

3. Resize the logical volume

lvresize -L50G /dev/VolGroup/LogVol00

4. Backup partition table

sfdisk -d /dev/sda > /var/tmp/partition-table.txt

5. Delete /dev/sda2 partition

Use fdisk to delete the partition /dev/sda2

6. Create a new /dev/sda2 partition

Create a new partion with the exact same starting offset as your former partition (this should be default) and make it only 50G

7. Resize the LVM Physical Volume

pvresize /dev/sda2

pkhamre
  • 5,900
  • 3
  • 15
  • 27
  • thank you for response. Can you provide me with the steps how to shrink the /dev/sda2 partition to 50GB using fdisk? (without loosing any data) – kupa Aug 20 '12 at 13:52
  • Edited post with steps for shrinking. Maybe the following URL can help you too http://fedorasolved.org/Members/zcat/shrink-lvm-for-new-partition – pkhamre Aug 20 '12 at 14:06
1

Make sure you have backups!!

That being said, for physical partitions, I have had a lot of luck with gparted whether windows or linux.

Boot off gparted cd and it gives you a nice gui to resize your partitions.

ben
  • 101
  • 5