PDA

View Full Version : [SOLVED] Remove and Edit Partitions Inside a LVM



WillM
3rd September 2014, 04:13 PM
Hey guys

I got a new hard drive and cables, so I installed that in my system. I then moved the home directory from a Fedora GNOME live USB, edited the fstab and rebooted. All working fine :dance:

I realised I have a 24 GB partition still inside the LVM (the system is in a LVM). The system HDD is 80 GB so it is a slight loss. I was wondering if I could remove the 24 GB partition and add it back to the root (/) directory. I rebooted back into the live USB and couldn't edit the partitions inside the LVM.

So my question is:

Is there a easy way to edit partitions inside a LVM?

Thanks,

Will

WillM
3rd September 2014, 10:36 PM
Bump. No one know how to do this?

Kobuck
3rd September 2014, 11:15 PM
In my case I'm a little confused by your description.

It appears you have booted from a live USB. ( what version of Linux ?)

Then installed to a harddrive on a Logical volume. (correct?)

Then booted from the harddrive installation (? )

If I am correct so far, I'm not sure, is it:

a) there is 24GB not used on the hard drive
b) 24GB of free space in the Logical volume after the O/S install
c) neither of above ( please provide more clarification)

if you could also provide the output of:


# lsblk
# lsblk -f
# pvdisplay


from both the live USB boot and the harddrive boot.

bourbonsipper
3rd September 2014, 11:21 PM
Try running: "system-config-lvm" it is a GUI used to manipulate LVGs.
or,
you could do the editing in a terminal using commands like lvresize.

WillM
4th September 2014, 12:24 PM
@Kobuck:

The live USB is Fedora 20 GNOME

The partition setup on the system HDD is the default selection in the anaconda installer (It chose LVM by default?)

I am posting this from the hard drive installation.


The 24 GB was my old home partition that anaconda made before I got the new HDD, which I made the new home partition. I want to remove the 24 GB and resize the root partition to fill that. The root partition is in the LVM as is the 24 GB.


lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 74.5G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 74G 0 part
├─fedora-swap 253:0 0 5.9G 0 lvm [SWAP]
├─fedora-root 253:1 0 45.8G 0 lvm /
└─fedora-home 253:2 0 22.4G 0 lvm
sdb 8:16 0 232.9G 0 disk
└─sdb1 8:17 0 232.9G 0 part /home
sr0 11:0 1 1024M 0 rom


lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 ext4 148d0a9f-bc03-40c7-9d71-64842e8eb19f /boot
└─sda2 LVM2_member FhtvRn-zN41-2pvD-ClkD-UV6Q-okEE-eno51M
├─fedora-swap swap 2eaf28b5-2ddc-4c7a-b7b8-327d42ac0411 [SWAP]
├─fedora-root ext4 30d86044-9f7d-42fa-aa20-81daf87f3530 /
└─fedora-home ext4 037b29a9-4ad4-43f2-8ea5-9da59e4b1572
sdb
└─sdb1 xfs 5ba3ad0d-82e4-44c6-92be-c33562ce86a7 /home
sr0


pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name fedora
PV Size 74.04 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 18954
Free PE 0
Allocated PE 18954
PV UUID FhtvRn-zN41-2pvD-ClkD-UV6Q-okEE-eno51M

@bourbonsnipper:

I tried that command, which didn't exist. I also searched yum for it, and it didn't exist there either.

Thanks for the replies :)

Kobuck
4th September 2014, 04:18 PM
Ok, this shows:

/home is now a 232.9G xfs filesystem on /dev/sdb1 and there is an unmounted 22.4G lvm partition on /dev/sda2.

Restating the problem as I understand:
There is an unmounted lvm partition labeled fedora-home on sda2. This partition was what was created during your original install and you now want to remove it. Then resize the lvm partition labeled fedora-root on sda2 to use the space.


I haven't used LVM for quite a while. Apparently the GUI tools have been completely dropped and only CLI tools are available in F20. You can get information on commands available by opening a terminal and looking at the following man info:



$ man lvm
$ man lvs
$ man lvremove
$ man lvextend



I would suggest you start by using "lvs" to get the correct labels/names .

Again be careful, I've not used any of these myself. I'm sure the following will require you work at root level.

Then "lvremove" the old fedora-home partition and "lvextend" the existing fedora-root partition to use the space.

Maybe someone with recent experience can chip in:)

WillM
4th September 2014, 10:01 PM
Thanks Kobuck. I'll give it a go :)

WillM
4th September 2014, 10:15 PM
Well, after removing the partition with command line, I managed to get stuck with resizing. (I know its not long after my last post)

I went looking for system-config-lvm. I managed to find a Fedora 19 package and thought I would try installing it. It was successful :D

Here is what I did to install it:


su -

yum install https://kojipkgs.fedoraproject.org//packages/system-config-lvm/1.1.18/1.fc19/noarch/system-config-lvm-1.1.18-1.fc19.noarch.rpm

system-config-lvm

I resized the root partition, and it worked like a charm. Thanks for the help! Everything is working great now :) (I also performed this inside the installed system)




lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 74.5G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 74G 0 part
├─fedora-swap 253:0 0 5.9G 0 lvm [SWAP]
└─fedora-root 253:1 0 68.2G 0 lvm /
sdb 8:16 0 232.9G 0 disk
└─sdb1 8:17 0 232.9G 0 part /home
sr0 11:0 1 562.1M 0 rom

dd_wizard
27th December 2014, 01:14 AM
It looks like Fedora is working on a replacement (http://fedoramagazine.org/manage-your-partitions-like-in-anaconda-with-blivet-gui/) for system-config-lvm. If you have dnf installed, you can just follow the link to the COPR repository page from my link and install the COPR repo. Then install blivet-gui from the new repo. So far, it's working as advertised.

dd_wizard

morrisbit
1st February 2019, 03:35 AM
su -

yum install https://kojipkgs.fedoraproject.org//packages/system-config-lvm/1.1.18/1.fc19/noarch/system-config-lvm-1.1.18-1.fc19.noarch.rpm

system-config-lvm

I am very grateful for this. I have spent many hours deep in the bowls of Fedora attempting to get access to an LVM created through VirtualBox. So many failed attempts....so many... Well it is 2019 now and I am on Fedora 29. This solution STILL works. Thanks again. Hope this comment gets your attention. !!WORKING!! as of 2019. Fedora 29.

bob
1st February 2019, 03:51 AM
Yes, but it's a thread that's over 4 years old and marked Solved. Best to simply leave it die in peace. (In other words, please don't post on ancient threads).