FedoraThis forum is for the discussion of the Fedora Project.
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.
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.
I have been pulling my hair out all afternoon over this:
How do I resize the *root* LVM Logical Volume (/dev/VolGroup00/LogVol00) as created by a "default" install of Fedora?
OR
How do I create the block device entries for LVM Logical volumes when booting with a rescue CD (i.e /dev/VolGroup00/LogVol00)?
OR
How do I unmount /mnt/sysimage if I have mounted it when booting from a rescue CD?
I know how to resize the LV provided that I can unmount it AND have the block device defined in /dev. But, I can't unmount the root volume on a live system. So I must use the "rescue" CD to boot the system.
But, if I boot with the rescue CD and skip mounting the system partitions, then the block entries for LVM in /dev are not created. If I boot from the rescue CD and do mount the system partitions, the /dev block devices are created but I can't umount the /mnt/sysimage (I get a device is busy error). I get this umount error even after unmounting /mnt/sysimage/boot and /mnt/sysimage/dev.
1. resizing lvm root:
Use an LVM2 enabled livecd like:
Debian From Scratch http://people.debian.org/~jgoerzen/dfs/
2. LVM device nodes are created by an lvm2 enabled kernel!
The bottom line about resizing ext3 logical volumes is that it is easy to make them bigger, but difficult to make them smaller. In theory, the resize2fs command can reduce the size of the ext3 filesystem, but in practice, you will get a fatal error message regarding the new target size when you try to reduce the ext3 filesystem.
RedHat has really screwed everyone who uses the installation default LVM partitioning scheme, because it fills the volume group with logical volume(s), but does not provide tools for reducing the ext3 logical volumes to allow others to be created or enlarged. I anticipate that these tools will appear at some future date, presumably before the release of RHEL5. But, for now, you're screwed.
I've had no such problems using DFS, or Debian Sid. Growing/shrinking both filesystems and logical volumes have been painless. As a bonus, using a rescue cd also provides an easy way to dd the filesystems to an image file over nfs before any changes are made (jic).
Thank you for the replies.
I was sucessfull in reducing the root LVM logical volume on a default FC3 install to 10G with the following commands:
Boot with rescue CD. Skip mounting of the system partitions.
# lvm vgchange -a y
# e2fsck -f /dev/VolGroup00/LogVol00
# resize2fs -f /dev/VolGroup00/LogVol00 10G
# lvreduce -L10G /dev/VolGroup00/LogVol00
I recieved a message "Please run e2fsck -f /dev/VolGroup00/LogVol00" when trying to run resize2fs (even after I had run e2fsck) so I added the -f switch to force the resize. All went well.
It’s a good thing that uberNUT69 and jdupre pointed out that resize2fs reduced their ext3's without any problems, because it got me to go back and look at it again.
The bottom line is that resize2fs does an excellent job of reducing the ext3 size, as long as you remember to leave room for the root reserve space when you shrink the ext3.
Previously, I was trying to first reduce the ext3 to a minimal size before reducing the LV size, followed by expanding the ext3 to the new LV size. The idea was to avoid any possibility of clipping the end of the ext3, by first making it smaller than the new LV size. What I forgot to do was to allow for the root reserve space when I picked a target size for the interim ext3. Once that was entered into the calculation, everything worked fine.
[root@d400-image ~]# umount /dev/lvm-hdx/lvm0 /test_vol
umount: /dev/mapper/lvm--hdx-lvm0: not mounted
umount: /dev/mapper/lvm--hdx-lvm0: not mounted
[root@d400-image ~]# lvm lvreduce -L10M /dev/lvm-hdx/lvm0
/dev/cdrom: open failed: Read-only file system
Rounding up size to full physical extent 12.00 MB
WARNING: Reducing active logical volume to 12.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvm0? [y/n]: y
Reducing logical volume lvm0 to 12.00 MB
Logical volume lvm0 successfully resized
[root@d400-image ~]# lvm lvreduce -L1M /dev/lvm-hdx/lvm0
/dev/cdrom: open failed: Read-only file system
Rounding up size to full physical extent 4.00 MB
New size (1 extents) matches existing size (1 extents)
lvreduce: Reduce the size of a logical volume
If you are reducing an LVM partition, you should resize the
filesystem on it first. Even if your lvreduce command had
worked as you intented, your df command probably would
not have shown a difference size because the filesystem
hasn't been changed, just the device it sits on.
Next, the lvreduce command is rounding up to the nearest
physical extent, so how about you run your tests on a
larger partition, eg. 50MB ?
Ive been trying to reduce my /root ext3 volume with the above instructions. I had the usual WARNING messages, but my main concern was the following error message:
Bad boot block on volume or volume NOT a ext2 file system????
Whats the cause of this? It seems like other people are using e2fsck on a ext3 file system,
so is mine failing?
This is actually pretty easy now, although it wasn't obvious to me. (Fedora Core 6, Kernel 2.6.22)
Although I couldn't use "system-config-lvm," lvextend and resize2fs from the command line was all I needed. Apparently online resizing is now in the Kernel.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.