Q I run Fedora 9 on my PC, which has two 80GB hard drives configured with LVM [logical volume management]. I would like to create a home partition on one of them, but can't figure out how to do it. GParted doesn't work with logical volumes, so I'm a bit stumped as to what to do - can I remove or disable LVM?
A Removing or resizing LVM to make room for another filesystem defeats the whole point of using LVMs. Is your volume group completely full? (I hope Fedora doesn't set it up like that). If not, you can add a new logical volume and use that as your home partition. Run vgs in a root terminal to see how much space is available on your volume group; you should see something like this
% sudo vgs VG #PV #LV #SN Attr VSize VFree eee 2 5 0 wz--n- 17.45G 4.96G
which shows that we have one volume group (called eee) with just under 5GB available (as you can guess from the volume group name, this is on an Eee PC, hence the small numbers). So we can create a 4GB volume called home with the following:
lvcreate --size 4G --name home eee
that will then be at /dev/eee/home, and I can format and mount it as I see fit. If your volume group is full, you'll need to resize one of the existing logical volumes before you can create a new one. The first step is to reduce the size of the filesystem, so that it is slightly smaller than the final size of the logical volume. Let's say you have a volume called 'myvol' on a volume group called 'myvg' - the lvs command will show you a breakdown of all your volumes and groups. If, for example, you want to resize it to 10GB, you can use the following commands:
fsck -f /dev/myvg/myvol resize2fs /dev/myvg/myvol 9G lvresize --size 10G /dev/myvg/myvol resize2fs /dev/myvg/myvol
Resizing an ext2 or ext3 filesystem requires that you run fsck on it first. The next command shrinks the filesystem on the logical volume to 9GB, to make sure the volume is never smaller than the filesystem, then we resize the volume to 10GB and the final resize2fs command has no size given, so it expands it to fill the volume size. Now you have free space that you can use to create your home partition.
You cannot run these commands on a mounted filesystem, so do it all while booted from a live CD such as Knoppix or System Rescue CD. If you have plenty of free space available, you should create volumes at only the size you need. While reducing volume sizes can be a bit of a fiddle, increasing them is very simple and can be done while they are in use, so make them the size you need then leave the rest of the space unallocated until you need it. If you're not comfortable with the command line, you can use Webmin to manipulate filesystem and LVM objects, but the command line approach is faster, and easier once you are used to it.
- Rearranging LVM
- Fedora software installation problem: 'unable to retrieve software information'
- Configuring RAID arrays
- SoundBlaster Live not working in SUSE Linux
- Best laid plans...