LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-19-2011, 07:28 AM   #1
jklaverstijn
LQ Newbie
 
Registered: Jan 2011
Posts: 15

Rep: Reputation: 0
Shrink disk partition after reducing LVM


Hi all,

I run Fedora FC13-x64. Recently I added a few TB's of RAID5 storage tto my server and moved most data from the root filesystem to that. Now my root volume is way too big. My basic install resulted in a 1TB LVM volume group entirely dedicated to a single lv_root.

Now I want to make room and eventually clone this disk to a much smaller root disk. I see many threads about reducing the size of an LVM logical volume. My first steps were succesful. I used lvreduce and resize2fs to reduce the size of the logical volume and filesystem. I also user pvreduce to reduce the size of the physical volume group.

But still gparted and fdisk report the physicalk volume (/dev/sde2) as 900GB. The embedded LVM stuff is as small as 60GB. Anyway LVM manager and GParted doe not allow me to shrink /dev/sdf2 to snuggly fit the LVM stuff in it.

Anyone who can tell me how to accomplish this?

Thanks in advance, Jan.

Last edited by jklaverstijn; 01-19-2011 at 07:29 AM. Reason: typo' s
 
Old 01-19-2011, 10:37 AM   #2
nelz
Member
 
Registered: Aug 2004
Posts: 34

Rep: Reputation: 6
Use cfdisk (or fdisk or gparted or whichever you prefer) to delete sfd2, then recreate with the same start point but a smaller size. Make it a little larger than your VP size to be on the safe side, then run pvresize without a size to make the PV fill the new partition.
 
Old 01-19-2011, 10:45 AM   #3
jklaverstijn
LQ Newbie
 
Registered: Jan 2011
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by nelz View Post
Use cfdisk (or fdisk or gparted or whichever you prefer) to delete sfd2, ...
Thanks for the response.

Would deleting the partition not destroy my data? I didn't mention this explicitly but I am looking for a way that would work without dataloss.

Cheers, Jan.
 
Old 01-20-2011, 05:05 PM   #4
jklaverstijn
LQ Newbie
 
Registered: Jan 2011
Posts: 15

Original Poster
Rep: Reputation: 0
I did some research and indeed deleting the partition and creating a new, smaller one would/should preserve the data.

There are some mentions of damage to/destruction of the filetable but as this is LVM ... who knows. Thing is the thought is quite scary. I will make a backup first, test the approach in Virtualbox and report later on my findings. trying to muster the courage...

- Jan
 
Old 01-20-2011, 06:03 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Deleting partitions is safe, with a few caveats:
- ensure your partition is at least as large as your data (as mentioned above)
- ensure you get the start of the partitions (old an new) correspond exactly
- don't do this if your pv is a full disk (rather than a partition on the disk).
 
Old 01-21-2011, 03:52 AM   #6
nelz
Member
 
Registered: Aug 2004
Posts: 34

Rep: Reputation: 6
It's safe, as already stated, because all you're deleting is the entry in the partition table, not the data on disk. In fact, you don't write anything to the disk, even the partition table, until after you have removed the old and add the new partition, so all you're really changing is the end point of the partition. It's just having to press the delete key that makes this seem so scary.
 
Old 01-22-2011, 03:08 PM   #7
jklaverstijn
LQ Newbie
 
Registered: Jan 2011
Posts: 15

Original Poster
Rep: Reputation: 0
I made a Clonezilla backup first and then followed the advise. And sure enough it did the trick as promised. Thanks a lot for the great advise.

Regards Jan
 
  


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
Shrink my partition to new disk amol28kulkarni Red Hat 4 10-09-2010 01:57 PM
Reducing size in LVM SBN Linux - General 8 07-28-2009 06:30 AM
shrink LVM partition bcbotha Fedora 4 06-09-2009 05:00 PM
Reducing the Linux LVM(8e) partition itself (not PV, VG or LV). ajitkth Linux - General 1 03-08-2005 03:45 AM
Reducing size of PV (partition) in LVM clacour Linux - General 2 10-24-2003 08:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

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