Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to resize my PV so that I could make room for a new partition,

/dev/sda7 -->  belongs to Volume Group: vg0

vg0 has 23g free space not allocated, so I tried

pvresize --setphysicalvolumesize XXg

to reduce its size. What's next?

I tried resize2fs, and it won't work with LVM partitions.

I'll have to reduce /dev/sda7, so that I could create a new partition, e.g /dev/sda8 for windows system.

share|improve this question
    
if you want to remove pv from vg0, then you could do with pvmove and followed by vgreduce –  Nikhil Mulley Dec 10 '11 at 11:39
    
When writing a question, please report error messages if any. Thanks. –  Faheem Mitha Dec 10 '11 at 14:14

1 Answer 1

up vote 2 down vote accepted

resize2fs works on the formatted filesystems(mke2fs), generally created over the logically created partitions(lvcreate).

If vg0 (volume group) has 23g free space, then why do you need resize2fs? You can perhaps create another logical volume from the volume group, formate the new logical volume and mount it.

If you need more room out of your existing volume group, then you need not do pvresize at all. Just start with resizing the filesystem that has enough free space and can sustain giving out the needed disk space. To shrink the volume, You can directly do a reduction of filesystem size with resize2fs but better do it on an umounted filesystem. Now lvreduce can reduce the volume to make more space for to be newly created logical volume and a filesystem.

If you need more room into your existing volume group, and you are probably adding more physical volumes or disks, then you need pvresize followed by lvextend and then resize2fs.

Better start the approach by taking the notes from pvdisplay, vgdisplay and lvdisplay and then muck around. If anything goes wrong, you will be sure what was the state earlier.

share|improve this answer
    
i need a partition for windows , but i got all the rest space for a single LVM partition. –  warl0ck Dec 10 '11 at 11:43
    
If you need a space for Windows, use either parted, or something like partition magic to get there because all of these tools and lvm operate on Linux oriented filesystems/partitions. Caution: Data risk, excercise enough measures to make sure the data is back'dup. BTW, I would still go with reducing the filesystem size, lvreduce, pvresize and then would go about parted/gparted/partition magic to free some unallocated space for Windows allocation. –  Nikhil Mulley Dec 10 '11 at 16:58

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.