[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Resizing logical volumes



On Tue, 2006-05-16 at 23:15 +0200, Aad Rijnberg wrote: 
> I have installed FC5 using LVM. During installation I chose the /usr volume 
> apparently too small, because now there is not enough room to install 
> updates.

Before changing volume sizes, another option you might want to consider
is to remove a few large packages that you don't use. Doing this will
also have the advantage that you don't need to download and install
updates for these large packages if they appear.

You can get a list of installed packages sorted by size like this:

$ rpm -qa --qf '%{SIZE}\t%{NAME}\n' | sort -n

You can then use "rpm -qi packagename" to get information about what a
particular package is if you don't know it, and "rpm -e packagename" (as
root) to get rid of it if you decide you don't want it. rpm will tell
you if there are other packages that depend on the one you're trying to
remove, and refuse to remove the package.

> To solve this problem, I would like to decrease my /home volume (LogVol03) by 
> some 3GB and increase the /usr volume (LogVol01) by the same amount. /home 
> physically resides on /dev/hda2 whereas /usr resides on /dev/hda3.

The physical location of the volumes does not matter if they are in the
same volume group. In fact, how do you know where they are?

> I was thinking of using system-config-lvm for this. Is that a good idea?

I don't know, I've never used it.

> Can this whole operation be executed without data loss?

Yes.

> It is possible to execute 
> system-config-lvm while the partitions are mounted?

It's not possible to run it when they're not mounted, since
system-config-lvm lives under /usr :-)

I usually do this using the command-line tools. The general flow would
be:

1. Reduce the size of the /home filesystem by *more* than the amount you
eventually want to reduce it by (say 4G). This avoids the possibility
that due to rounding issues your filesystem may extend past the end of
the logical volume it's on when the logical volume is shrunk. You may be
able to do this online using ext2online. If it says it can't do it,
you'll need to go to single user mode, unmount /home and /usr, and use
resize2fs instead (and for the following steps too)

2. Reduce the size of LogVol03 by 3G, using lvreduce.

3. Resize /home to fill the logical volume it's on, again using
ext2online or resize2fs. By not specifying the size to use, the tool
will expand the filesystem to fill the volume.

4. Increase the size of LogVol01 by 3GB using lvextend.

5. Resize /usr to fill he logical volume it's on, again using ext2online
or resize2fs. By not specifying the size to use, the tool will expand
the filesystem to fill the volume.

Paul.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]