LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-21-2013, 05:50 PM   #1
gedaj
LQ Newbie
 
Registered: May 2013
Posts: 2

Rep: Reputation: Disabled
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
 
Old 05-21-2013, 06:17 PM   #2
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Rep: Reputation: 42
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.

Last edited by cbtshare; 05-21-2013 at 06:27 PM.
 
Old 05-22-2013, 03:44 AM   #3
gedaj
LQ Newbie
 
Registered: May 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Install Debian with encrypted home partition (without lvm) lazylogic Debian 1 02-19-2013 02:40 PM
Resizable encrypted LVM requiring just one password on boot (encrypted volume group)? Nyyr Linux - Software 9 01-24-2013 05:52 AM
[SOLVED] Increase size of an encrypted LVM partition jjthomas Slackware 2 01-13-2013 04:10 AM
[SOLVED] Encrypted LVM Phorize Slackware 20 05-18-2011 04:30 PM
[SOLVED] Can you shrink a LUKS-encrypted physical volume? (LVM2) piratesmack Slackware 1 11-12-2010 10:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration