Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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've just recently installed FC3 on my machine containing 2 80Gb drives, and by default, it set up the partitions as follows, using the Logical Volume Manager (which is what I was wanting):
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
155269068 3663744 143718068 3% /
/dev/hde1 101086 12340 83527 13% /boot
none 517764 0 517764 0% /dev/shm
Without really thinking hard about it, I accepted the defaults and proceeded with the install. Now that I look back, I don't really want a stupidly-large '/' partition of around 150GB - so I'm now quite keen to shrink this so I can add another LV for data, etc.
I've read the LVM HOWTO and understand all of the basic concepts. According to it, reducing the size of a LV requires shrinking the size of the filesystem within it before shrinking the LV itself, i.e., the commands I need to run are something like:
Of course, being the root partition, things are a bit more complicated than that, as I can't umount the '/' partition while the machine is running.
I did a bit more reading, and I read that you need to boot from the FC3 rescue-cd and *not* mount the partitions - then resizing should be possible. However - once I did this I was unsure how to refer to device '/dev/mapper/VolGroup00-LogVol00' as it was not present.
Is what I am trying to do even possible? Am I on the right track, or do I need to re-install / re-partition everything again?
Help!
Here's some output from running some other LVM commands:
# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 152.53 GB
PE Size 32.00 MB
Total PE 4881
Alloc PE / Size 4876 / 152.38 GB
Free PE / Size 5 / 160.00 MB
VG UUID pVaPp7-V0G2-tk9o-N3hU-aAJ8-4JkJ-a6RqC5
# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID Ph4HyB-YVDU-u3UC-Oppa-YUjp-s2P9-AyU0w0
LV Write Access read/write
LV Status available
# open 1
LV Size 150.44 GB
Current LE 4814
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID mkZsuo-MEtD-DzDs-P4PV-vIC6-67au-zIDe91
LV Write Access read/write
LV Status available
# open 1
LV Size 1.94 GB
Current LE 62
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1
# fdisk -l
Disk /dev/hde: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hde1 * 1 13 104391 83 Linux
/dev/hde2 14 9964 79931407+ 8e Linux LVM
Disk /dev/hdg: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdg1 * 1 9964 80035798+ 8e Linux LVM
Ok, I've figured this out ... so just in case anyone wants to know how to do it:
1. Write the FC rescue disk ISO onto a CD, and reboot the machine from it.
2. Do not mount the file systems.
3. At the prompt, type:
lvm
4. Within LVM, run these commands (comments are after the '#'s):
lvm> vgscan # Will show the name of the Volume Group
lvm> vgchange --available y VolGroup00 # Activates the VG and the LVs in it
lvm> lvscan # Should show the LVs as "ACTIVE"; the devices in /dev it mentions should now exist
lvm> exit # Quit, return to the prompt
5. Now resize the filesystem with this command (e.g., using device /dev/VolGoup00/LogVol00):
e2fsck -f /dev/VolGoup00/LogVol00 # fsck on the filesystem
resize2fs /dev/VolGoup00/LogVol00 nnG # resize the fs to nn GB; nn should be less than the current fs size
e2fsck -f /dev/VolGoup00/LogVol00 # Do another fsck on the filesystem; fix any errors which appear
6. Run lvm again and type:
lvm> lvreduce -LnnG /dev/VolGoup00/LogVol00 # Resize the LV to nn GB; nn should be the same as above
lvm> exit # Quit, return to the prompt
7. Finally, do another filesystem check:
e2fsck -f /dev/VolGoup00/LogVol00 # Do another fsck on the filesystem; fix any errors which appear
Here it is, five years after your post. However, it contains just the information that I needed to fix my Fedora 13.
Here's how I got myself in trouble... I decided I wanted to experiment with LVM. I created a logical volume. Then I looked around for a volume group that I could add it to. Gee, the root vg was already set up (saving me some work), why not add my new logical volume to the root volume group?
A few mouse clicks later, and it was done. OK, that was simple enough, now lets try removing it. WHAT DO YOU MEAN THE ROOT VOLUME HAS TO BE UNMOUNTED FIRST ???
That's when the panic set in!!
Your post really bailed me out. Thank you so much.
Here it is again, 6.5 years after you post. Your steps worked perfectly on Fedora 15.
I'm a bit of n00b with LVM and I had configured my / LV at 500GB. WAY too big for actual needs. Storing the dd image was going to be a problem as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.