LVM resizing root partition quiestion

Paul Howarth paul at city-fan.org
Tue Aug 2 10:09:28 UTC 2005


Michael D. Setzer II wrote:
> On 2 Aug 2005 at 10:26, Paul Howarth wrote:
> 
> 
>>Michael D. Setzer II wrote:
>>
>>>I've tried to resize a "/" partition using information from the thread 
>>>below after booting from the FC3 DVD with linux rescue.
>>>I ran the lvm lvscan, then lvm vgchange -ay, and then did the resize 
>>>command to change the partition from 35GB to 30GB. It is using no more 
>>>than 12GB of space. This was a test machine, and was to see if it would 
>>>work. It gave a warning message, but it being a test machine, was no 
>>>problem. Unfortunately, after rebooting the machine had a kernel panic 
>>>with an inodees error message.
>>
>>You say you did "the resize command"; which resize command?
> 
> 
> If I recall correctly, I used lvresize. 
> 
> 
>>You need to reduce the size of the filesystem (resize2fs) before you 
>>reduce the size of the partition or logical volume (lvreduce) that it's 
>>on. Did you do that?
> 
> 
> The answer is no,  I've looked for a step by step for doing this, but 
> haven't come up with the correct search to find it.
> 
> 
>>>The reason that I want to be able to resize the partition, is that I 
>>>have another machine with a AMD64 3000+ CPU and a 250GB drive with FC3 
>>>as well. In the default installation, it setup the drive with the boot 
>>>and "/" partitions. System works fine, but it is used to do backups of 
>>>other systems on the network, and these are about 15GB files for each 
>>>lab. I want to be able to backup the root partition of this machine as 
>>>well, but with the 200+GB partition, it doesn't work well. I would like 
>>>to redo the machine in a  way to have the directory for the images as a 
>>>separate partition. I've been able to add a 70GB drive, and have it map 
>>>to another directory in the manner that I would like to do with this 
>>>250GB drive.
>>>
>>>Can this be done with LVM. I've used presizer in the past, and also 
>>>partition magic with windows. I'm sure it can be done, but I have found 
>>>it yet. Thanks again.
>>
>>Yes, you can do it. You don't another drive. You can reduce the size of 
>>the root filesystem, then reduce the size of the logical volume. This 
>>frees up space in the volume group, so you can create a new logical 
>>volume for the backups, create a new filesystem on that logical volume, 
>>then mount the new filesystem on the directory you want to use for the 
>>backups. Job done.
> 
> 
> I  put in the 70GB drive to copy all the image files, and did a backup 
> of the large root filesystem to have a backup. Created an 18GB file. 
> 
> 
>>(actually, when reducing partition/volume sizes, I tend to reduce the 
>>the filesystem size to *smaller* than the target size of the 
>>partition/volume group, then reduce the size of the partition/volume, 
>>then use resize2fs without a size so as to get the filesystem to fill 
>>the partition/volume; this ensures that at all times the filesystem 
>>lives within the partition/volume, without having to worry about 
>>rounding errors etc.).
> 
> 
> Is there a place were I could get the step by step instructions.Using 
> various combinations of words, I end up with from 40,000 to 5,000 
> pages. 
> 
> P.S. These are for my G4L - Ghost for Linux images that I've been 
> working on. 
> 
> Again Thanks for the quick response.

There really is no substitute for reading all those words. I'd go for 
the Linux LVM HOWTO (google). It's important to understand exactly what 
you're doing when you do something like this, as someone else's 
step-by-step guide may not be appropriate for your circumstances.

The key here is that on completion of each step, you still have a 
working system at that point. The steps you need are as described above. 
Check out too the manpages for resize2fs, lvreduce, lvcreate, and 
mke2fs, which are the commands you'll need.

Paul.




More information about the fedora-list mailing list