LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 01-24-2008, 09:55 AM   #1
unclestoner
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Rep: Reputation: 0
Shrinking a partition that is managed by LVM?


Hello. In Fedora Core 7 I'm trying to shrink a (physical) partition that is part of an LVM volume group. I used "pvreduce" to shrink the size of the Volume Group, but that doesn't affect the size of the physical partition hosting that volume group. Everyone says use fdisk to resize partitions, but how? I start "fdisk /dev/sda" but I don't see any commands to resize/shrink a partition. For parted there is a "resize" command, but it doesn't work on the partition containing the LMV filesystem (parted complains that it doesn't recognize the file system)

How do I do this? It seems like it should be pretty straightforward...
(I'm trying it from rescue mode without the disk in question mounted)

Thanks,
Dave
 
Old 01-24-2008, 01:54 PM   #2
PhenuxRizing
Member
 
Registered: Feb 2004
Distribution: Fedora
Posts: 59

Rep: Reputation: 15
Resizing LVM partitions is not a common task, that is probably why parted doesn't support it yet. I suppose you could do it manually with fdisk by setting the exact cylinder head count in the partition table but that may be more than you care to take on. If you don't mind me asking why do you need to resize that partition? Maybe someone can propose an easier solution to your main goal?
 
Old 01-24-2008, 03:42 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,549
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Quote:
excerpt from 'man lvm';

The following commands are not implemented in LVM2 but might be in
future: lvmsadc, lvmsar, pvdata, pvresize.
If you have the space available on another drive then ghost the partition to that drive. Basically backup to the drive then change the lvm partition as you wish then restore from the ghost/backup to the new one.

I like ext3 and it does what I want without too much trouble. Reliable and I can do just about anything to it and it keeps on ticking.
 
Old 01-24-2008, 03:51 PM   #4
unclestoner
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by PhenuxRizing View Post
Resizing LVM partitions is not a common task, that is probably why parted doesn't support it yet. I suppose you could do it manually with fdisk by setting the exact cylinder head count in the partition table but that may be more than you care to take on. If you don't mind me asking why do you need to resize that partition? Maybe someone can propose an easier solution to your main goal?
Thanks for your response and for understanding...on other forums people repeatedly tell me how to resize a logical partition within a volume group, which is _not_ what I want to do...I want to resize physical partition (that happens to contain LVM) on a disk to make room for other physical partitions. I guess it's rare as you say, because if your using LVM then you can just install logical partitions.

The reason is that I'm trying to install a little (physical) partition used by a tool (Altiris Deployment Server...this partition allows the machine to boot up to an "automation environment" which is Linux 2.4 I believe to connect to a server to re-image the machine, etc). The tool is complaining that there is no room on the disk for the partition it is trying to install. The tool needs install the automation OS to a physical partition (just as grub must be installed to a physical partition). So, I need to make more room on the disk.

Thanks,
Dave
 
Old 01-24-2008, 03:56 PM   #5
unclestoner
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by onebuck View Post
Hi,
If you have the space available on another drive then ghost the partition to that drive. Basically backup to the drive then change the lvm partition as you wish then restore from the ghost/backup to the new one.
Thanks, I had initially tried Ghost (a really old version booted from DOS) to save the image of the machine for future use. Unfortunately the disk is big (~500GB) and Ghost was predicting it would take about a day to image it. I didn't want to wait and didn't trust such an old version of Ghost to handle the big disk properly.

So, I decided to try Altiris Deployment Server to do my imaging, but it needs a little partition installed and that's what I'm having problems with.

Quote:
Originally Posted by onebuck View Post
I like ext3 and it does what I want without too much trouble. Reliable and I can do just about anything to it and it keeps on ticking.
Yeah, I'm newish to Linux but I'm starting to not like LVM so much. This is about the 3rd or 4th problem I've had that would not have been a problem if I had been using straight physical partitions. Lesson learned.
 
Old 01-24-2008, 06:47 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,549
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,
Quote:
Originally Posted by unclestoner View Post
Thanks, I had initially tried Ghost (a really old version booted from DOS) to save the image of the machine for future use. Unfortunately the disk is big (~500GB) and Ghost was predicting it would take about a day to image it. I didn't want to wait and didn't trust such an old version of Ghost to handle the big disk properly.

So, I decided to try Altiris Deployment Server to do my imaging, but it needs a little partition installed and that's what I'm having problems with.



Yeah, I'm newish to Linux but I'm starting to not like LVM so much. This is about the 3rd or 4th problem I've had that would not have been a problem if I had been using straight physical partitions. Lesson learned.
I was referring to G4L (Ghost for Linux). You can use them to ghost the image to another drive then do your work on the current drive.

Another way would be to use the 'dd' command to copy the image to another drive then perform your resizing on the old drive. Then just 'dd' the image back. You could look at the great LQ post 'Learn The DD Command Revised'.

Last edited by onebuck; 01-24-2008 at 07:57 PM.
 
Old 01-24-2008, 07:23 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,848

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Quote:
Originally Posted by unclestoner View Post
I start "fdisk /dev/sda" but I don't see any commands to resize/shrink a partition.
There is no (single) command. Delete the partition, then create a new (smaller) one in its place. This has no effect on the data - if it's done right.
It's important to get the starting cylinder (sector if really old/small drive) correct, and make sure it's no smaller than the underlying filesystem. Doesn't matter (safer actually) if the partition is slightly larger than the filesystem size.
 
Old 01-25-2008, 10:36 AM   #8
PhenuxRizing
Member
 
Registered: Feb 2004
Distribution: Fedora
Posts: 59

Rep: Reputation: 15
UncleStoner,

Basically what everyone is telling you is that you need to backup your data and reformat the hardrive. Depending on how much data you have in that Volume Group you might get away with burning a couple of DVD's if you don't have a spare hard drive laying around.

How much space does this automation OS require? If it is small enough it can probably also fit on an inexpensive flash drive. That way you would not have to reformat the drive.
 
Old 01-25-2008, 04:12 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,848

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Not me. As far as I'm concerned all the hard work has been done.
The final partition resizing is easy - just needs to be careful.
 
  


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 and shrinking the root filesystem coreychch Linux - Newbie 5 11-22-2015 11:35 PM
Shrinking and moving an lvm partition. (and random fdisk help) pardasaniman Linux - Software 2 08-02-2006 09:11 AM
Shrinking an LVM partition Sabre_X Linux - Software 6 10-01-2005 12:13 AM
Shrinking Linux Partition w/ Partition Magic jrdioko Linux - Newbie 11 12-21-2003 04:46 PM
partition or shrinking? M@tt Linux - Newbie 2 11-12-2001 10:35 AM


All times are GMT -5. The time now is 04:52 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration