LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Shrink partition (LVM encrypted PVs + encrypted LVs) (https://www.linuxquestions.org/questions/linux-newbie-8/shrink-partition-lvm-encrypted-pvs-encrypted-lvs-4175462935/)

gedaj 05-21-2013 06:50 PM

Shrink partition (LVM encrypted PVs + encrypted LVs)
 
I am wanting to shrink my linux partition to create space for a new installation of windows.

I have 2 physical hard discs on which I have installed centos 6 using LVM. I selected encrypt PV and encrypt LV when installing the OS.

Output from pvdisplay:
--- Physical volume ---
PV Name /dev/mapper/luks-e8b4c341-4b52-44cb-974a-f9898cd19f67
VG Name vg_aclsamsung_b
PV Size 698.63 GiB / not usable 0
Allocatable yes
PE Size 4.00 MiB
Total PE 178850
Free PE 87458
Allocated PE 91392
PV UUID 9vSiwW-qPjN-2e4K-wKsm-NXYY-DX9c-RgYRe8

--- Physical volume ---
PV Name /dev/mapper/luks-daff07dc-4fd4-456c-add4-d826172dfd9f
VG Name vg_aclsamsung_a
PV Size 698.15 GiB / not usable 0
Allocatable yes
PE Size 4.00 MiB
Total PE 178725
Free PE 151077
Allocated PE 27648
PV UUID 6SKnTX-QwRD-MXe1-JK6p-Zdym-PgwZ-InTLZT


My understanding is that I have spare capacity in my PV and so I just need to shrink the PV and resize the associated crypt.
I don't think I need to resize my LVs as they are fine as they are. Do I also need to delete and recreate my partition table?

I've been racking my brains over this one and talking myself into confusion after having read so many articles courtesy of Mr Google.

Can anyone kindly give any pointers as to what I need to do or if I'm better off just wiping my hard discs and re-installing?

TIA

cbtshare 05-21-2013 07:17 PM

Please post the output of #vgs and #pvs.Also you cant shrink PV you can shrink LV .

Youd first have to knowthe size you want the LV to be.Umount the drive,run fsck -y /drive,use the lvreduce command lvreduce -L newSize /dev/mapper/vg-lv-name.(you will get a warning that data will be lost if it is bigger than the shrunken size you specified,just backup first).....then run resize2fs ,resize2fs /dev/mapper/vg-lv-name .

Then remount the drive n your good.

gedaj 05-22-2013 04:44 AM

Thanks for your response. I thought I could get away with not reducing the size of my LVs as they are fine as they are...

output of vgs:
[root@acl-samsung ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_aclsamsung_a 1 3 0 wz--n- 698.14g 590.14g
vg_aclsamsung_b 1 1 0 wz--n- 7.46g 0
vg_aclsamsung_c 1 3 0 wz--n- 698.63g 341.63g

output of pvs:
[root@acl-samsung ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/luks-daff07dc-4fd4-456c-add4-d826172dfd9f vg_aclsamsung_a lvm2 a-- 698.14g 590.14g
/dev/mapper/luks-e5252ea8-e0e0-489f-9966-a4713d8c25e4 vg_aclsamsung_b lvm2 a-- 7.46g 0
/dev/mapper/luks-e8b4c341-4b52-44cb-974a-f9898cd19f67 vg_aclsamsung_c lvm2 a-- 698.63g 341.63g


All times are GMT -5. The time now is 04:28 PM.