PDA

View Full Version : Core 4 partition resizing catch 22



urilabob
12th October 2005, 01:43 PM
I made the mistake of using the default partitioning in installing FC4 - the default is to
use most of the available space for the home partition (which seems a fairly unfortunate default for the default logical volume system). Anyway, I now need a different partitioning scheme, reducing the size of the home partition and using the released space for another purpose. I've found relatively detailed instructions on how to do that on linuxquestions.org, using e2fsck and resize2fs from a rescue CD.
However there seems to be a catch-22 in FC4. I need to boot from another filesystem in order to be able to unmount and resize the home filesystem, so that I can reduce the logical volume size. As far as I can see, that means a rescue CD of some kind. I've tried a couple. The FC4 rescue CD actually mounts and relies on the home filesystem (in particular, that's where it gets /bin and /sbin from); so that doesn't work. I've tried looking for other rescue CDs. The latest Debian version, from about May this year, uses too-old versions of e2fsck and resize2fs; they report that the filesystem has unrecognised features, and refuse to touch it. Since the Debian CD is actually relatively recent, I doubt I'm going to find a rescue CD for any system that has sufficiently up-to-date ext3 handling software.
Does anyone have any decent suggestions on how to get around this, so that I can shrink my ext3 filesystem, and then the logical volume? For example, is there any reasonable way to update the e2fsck and resize2fs utilities (in resize2fs' case, that means also rebuilding some system libraries) on the Debian rescue disk iso image (I can't seem to find a way to open it in write mode)
Thanks and Best Wishes
Bob McKay

homey
12th October 2005, 03:29 PM
The FC4 rescue CD actually mounts and relies on the home filesystem (in particular, that's where it gets /bin and /sbin from); so that doesn't work.
Sorry, but that is incorrect. The FC4 rescue CD and FC4 CD#1 are able to run on their own. If you accidently told it to mount /mnt/sysimge, you can unmount it...
For example:
Check to see what is mounted with the command: mount
Un-mount it with the command: umount /mnt/sysimage

The command: which e3fsck shows it as /usr/sbin/e2fsck
and on my FC4 box, it's at /sbin/e2fsck

The command: which resize2fs shows it as /usr/sbin/resize2fs where that also is at /sbin/resize2fs on my FC4 box.

I got Knoppix 4.0.2 around 9/25/05 , can't remember if it has the updated e2fsck but it may have.

urilabob
12th October 2005, 04:33 PM
Sorry, but that is incorrect. The FC4 rescue CD and FC4 CD#1 are able to run on their own. If you accidently told it to mount /mnt/sysimge, you can unmount it...
For example:

I got Knoppix 4.0.2 around 9/25/05 , can't remember if it has the updated e2fsck but it may have.

Sorry, I should have said that more carefully. The rescude CD can run on its own, but it is very minimal and many of the important system commands aren't available unless you mount a filesystem containing them. My point is that the commands I need aren't on the CD, and the only place I can easily get them for this purpose is precisely the filesystem I needed to unmount.

I'll give downloading Knoppix a try, thanks.

urilabob
14th October 2005, 04:09 AM
Thanks to all who helped me solve this problem. I have now found a solution that worked for me. Since I know other people are being caught by fedora's disastrous default logical volume setup, I'm providing here the recipe I used. If you decide to do something similar, please understand I am _not_ a linux expert. You should evaluate for yourself whether it might work for you, and make sure that you fully understand the risks. Especially, make sure you have
backed up your system fully first. I would not have attempted this before I discovered dar (http://dar.linux.free.fr/), and was certain I had the system fully backed up.

A. I ran Knoppix
1. Downloaded Knoppix and burned to CD (http://www.knoppix.net/)
2. Booted Knoppix on the computer

B. Got LVM Running on Knoppix (from http://www.knoppix.net/wiki/LVM2)
1. configured internet connection under Knoppix
2. modprobe dm-mod
3. apt-get update
4. apt-get install lvm-common lvm2
5. lndir /lib/lvm-200/ /usr/sbin/

C. Resized the volume (based on http://www.linuxquestions.org/questions/showthread.php?s=&threadid=337823&highlight=resize+lvm)
The volume I was resizing was /dev/VolGroup00/LogVol00
I was resizing to 58G
It's _crucial_ that the parameters in resize2fs and in lvreduce match
Otherwise you will probably destroy your filesystem
1. vgscan
2. vgchange -a y?3. e2fsck /dev/VolGroup00/LogVol00?4. resize2fs -p /dev/VolGroup00/LogVol00 58G?5. lvreduce -L58G /dev/VolGroup00/LogVol00

I strongly recommend including the -p parameter in resize2fs. My resize took a couple of hours, and (because I omitted this), I had no way of confirming that it was actually proceeding rather than just hung. Fortunately, I resisted the temptation to reboot...