Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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
add comment

2 Answers

up vote 1 down vote accepted

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

share|improve this answer
    
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 fedorasolved.org/Members/zcat/shrink-lvm-for-new-partition –  pkhamre Aug 20 '12 at 14:06
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.