LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 06-05-2012, 05:21 AM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 14.04
Posts: 1,337

Rep: Reputation: 42
shrink an lvm partition


I have Fed 17 and Windows installed.
/dev/sda1 ntfs, /dev/sda ntfs, /dev/sda3 ext4 500mb /boot, /dev/sda4 extended 267GB with /dev/sda5 lvm2 pv vg_pedro-bedro


I don't like this. I want to shrink sda5 to half its size and install another Linux there.

Can I do this, or must I reformat the whole hd??

gparted says it can shrink sda4, but I haven't tried it yet, for fear of losing data.
 
Old 06-05-2012, 07:24 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,058

Rep: Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971
You must do (in order):
- shrink the filesystem
- shrink the lv
- (maybe) shrink the vg
- (maybe) shrink the pv.

Then allocate a new partition for the new system.
The maybe's are because it might be possible to re-use the vg and pv for the new system if LVM. Personally I wouldn't risk it - free up all the space you need and allocate new (logical) partition(s) for the new system.

tldp.org has a LVM how-to.
 
Old 06-05-2012, 07:32 AM   #3
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,943
Blog Entries: 5

Rep: Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753
Actually sda5 is almost certainly used as the Physical Volume (PV) for a Volume Group (VG) so you'll definitely need to shrink the VG and the PV. Prior to doing that you'd have to be sure none of the Logical Volumes (LVs) are using the space. Shrinking the filesystems/LVs should only be necessary if the VG doesn't have free space in it already. Shrinking filesystems is done before shrinking LVs and also should be done only after running an fsck on the filesystem.

You'd really need to read and understand man pages for
lvm
vgdisplay
lvdisplay
pvdisplay
pvresize
lvresize
resize2fs (assuming you're using ext2/ext3 filesystems)
 
Old 06-05-2012, 07:50 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,058

Rep: Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971
Definitely ???.

A new system doing a pvscan will find it.
Must test if two systems can use the same pv/vg (presuming some free space in at least the vg) one day ...
 
Old 06-05-2012, 09:13 AM   #5
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,943
Blog Entries: 5

Rep: Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753Reputation: 753
Quote:
Originally Posted by syg00 View Post
Definitely ???.

A new system doing a pvscan will find it.
Must test if two systems can use the same pv/vg (presuming some free space in at least the vg) one day ...
What are you responding to? I don't see how it relates to the OP's question at all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LVM shrink and expand chiendarret Linux - Software 1 08-22-2011 01:12 AM
Shrink LVM without dataloss stry_cat Linux - Enterprise 8 06-14-2011 09:32 PM
[SOLVED] Shrink disk partition after reducing LVM jklaverstijn Linux - Server 6 01-22-2011 03:08 PM
shrink LVM partition bcbotha Fedora 4 06-09-2009 05:00 PM
LXer: How To Resize LVM Software RAID1 Partitions (Shrink & Grow) LXer Syndicated Linux News 0 01-09-2009 02:11 PM


All times are GMT -5. The time now is 07:08 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration