Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-19-2011, 08:28 AM
|
#1
|
LQ Newbie
Registered: Jan 2011
Posts: 15
Rep:
|
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 08:29 AM.
Reason: typo' s
|
|
|
01-19-2011, 11:37 AM
|
#2
|
Member
Registered: Aug 2004
Posts: 34
Rep:
|
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.
|
|
|
01-19-2011, 11:45 AM
|
#3
|
LQ Newbie
Registered: Jan 2011
Posts: 15
Original Poster
Rep:
|
Quote:
Originally Posted by nelz
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.
|
|
|
01-20-2011, 06:05 PM
|
#4
|
LQ Newbie
Registered: Jan 2011
Posts: 15
Original Poster
Rep:
|
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
|
|
|
01-20-2011, 07:03 PM
|
#5
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,334
|
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).
|
|
|
01-21-2011, 04:52 AM
|
#6
|
Member
Registered: Aug 2004
Posts: 34
Rep:
|
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.
|
|
|
01-22-2011, 04:08 PM
|
#7
|
LQ Newbie
Registered: Jan 2011
Posts: 15
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 05:55 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|