LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 06-27-2005, 07:31 PM   #1
jdupre
Member
 
Registered: Sep 2003
Distribution: LFS6.1, FC3, RH9
Posts: 36

Rep: Reputation: 15
How to Resize Root LVM Logical Volume???


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.

Please help save my hair!
 
Old 06-27-2005, 07:44 PM   #2
uberNUT69
Member
 
Registered: Jan 2005
Location: Tasmania
Distribution: Xen Debian Lenny/Sid
Posts: 578

Rep: Reputation: 30
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!
 
Old 06-28-2005, 01:07 AM   #3
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHL9;F1-10; CentOS4-5; DebianSarge-Squeeze
Posts: 1,151

Rep: Reputation: 46
To activate the LVMs in FC4 Rescue Mode, run this from the command line:

lvm vgchange -a y

For a list of LVM commands, run:

lvm help

There is a really good LVM HowTo here http://www.ibiblio.org/pub/Linux/doc...LVM-HOWTO.html

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.
 
Old 06-28-2005, 07:27 AM   #4
uberNUT69
Member
 
Registered: Jan 2005
Location: Tasmania
Distribution: Xen Debian Lenny/Sid
Posts: 578

Rep: Reputation: 30
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).
 
Old 06-29-2005, 03:01 PM   #5
jdupre
Member
 
Registered: Sep 2003
Distribution: LFS6.1, FC3, RH9
Posts: 36

Original Poster
Rep: Reputation: 15
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.

- Joe
 
Old 06-29-2005, 03:46 PM   #6
jdupre
Member
 
Registered: Sep 2003
Distribution: LFS6.1, FC3, RH9
Posts: 36

Original Poster
Rep: Reputation: 15
Sorry, the correct command is:

# lvm lvreduce -L10G /dev/VolGroup00/LogVol00

lvreduce is a symlink not available on the rescue filesystem.

- J
 
Old 06-29-2005, 08:03 PM   #7
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHL9;F1-10; CentOS4-5; DebianSarge-Squeeze
Posts: 1,151

Rep: Reputation: 46
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.
 
Old 06-30-2005, 01:05 AM   #8
uberNUT69
Member
 
Registered: Jan 2005
Location: Tasmania
Distribution: Xen Debian Lenny/Sid
Posts: 578

Rep: Reputation: 30
I seem to remember the instructions mention multiplying the reported (used) size of the filesystem by 1.1 ... for a "minimum" shrink.
 
Old 04-10-2006, 06:02 PM   #9
voip_tech_2004
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
I tried lvm lvreduce command and it LOOked like it was working but didnt see the results I was looking for when I did df -h....

Can someone please tell me what's going on with resizing in LVM2???


[root@d400-image ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 2.0G 1.5G 389M 80% /
none 252M 0 252M 0% /dev/shm
/dev/hdc 4.8M 4.8M 0 100% /media/cdrecorder
/dev/mapper/lvm--hdx-lvm0
504M 11M 468M 3% /test_vol

[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 ~]# mount /dev/lvm-hdx/lvm0 /test_vol
[root@d400-image ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 2.0G 1.5G 389M 80% /
none 252M 0 252M 0% /dev/shm
/dev/hdc 4.8M 4.8M 0 100% /media/cdrecorder
/dev/mapper/lvm--hdx-lvm0
504M 11M 468M 3% /test_vol


i umounted again and then tried but got below

[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
 
Old 04-10-2006, 08:20 PM   #10
uberNUT69
Member
 
Registered: Jan 2005
Location: Tasmania
Distribution: Xen Debian Lenny/Sid
Posts: 578

Rep: Reputation: 30
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 ?
 
Old 04-11-2006, 12:07 AM   #11
voip_tech_2004
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
resize2fs doesn't exist in lvm2... how do resize the filesystem?????
 
Old 08-19-2006, 10:12 AM   #12
bboy-mass
Member
 
Registered: Aug 2006
Location: England
Posts: 39

Rep: Reputation: 15
Hi,

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?

BTW, Im using FC5, could this be the problem?
 
Old 08-27-2006, 04:45 AM   #13
bboy-mass
Member
 
Registered: Aug 2006
Location: England
Posts: 39

Rep: Reputation: 15
All sorted.

Followed jdupre's guide and it worked a treat.

I put this on the white board at work, and everyone thinks im wonderfull now.

Thanks.
 
Old 01-25-2007, 08:50 AM   #14
dhru
LQ Newbie
 
Registered: Jan 2007
Posts: 1

Rep: Reputation: 0
hi

command to enter into volume
i want the command to check the size of files and folders which are in volume
 
Old 09-27-2008, 08:48 AM   #15
gerardw
LQ Newbie
 
Registered: Apr 2004
Posts: 1

Rep: Reputation: 0
Easy now

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.
 
  


Reply

Tags
lvm, resize


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
How do I resize LVM volume group? rconan Fedora 5 04-22-2009 07:45 PM
how to reduce logical volume LinuxLover Linux - Enterprise 2 10-29-2005 08:26 AM
lvm extending logical partation Ammad Linux - General 0 09-25-2005 04:39 AM
LVM (logical volumnes) calutateo Linux - Newbie 2 07-13-2005 07:32 PM
resizing a logical volume nicentral AIX 2 06-11-2005 04:03 PM


All times are GMT -5. The time now is 05:15 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration