Ask Your Question
2

Resizing fedora-home to create free space

asked 2019-03-22 13:47:46 -0500

0novanta gravatar image

updated 2019-03-22 14:56:19 -0500

I need to create some free space from the fedora-home partition. I read that is necessary to unmount it and then resize it with lvreduce.
This is the df -h output:

Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G   14M  1.9G   1% /dev/shm
tmpfs                    1.9G  1.7M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/fedora-root   50G   23G   25G  49% /
tmpfs                    1.9G   32K  1.9G   1% /tmp
/dev/mapper/fedora-home  405G  117G  268G  31% /home
/dev/sda2                477M  176M  273M  40% /boot
/dev/sda1                200M  8.0M  192M   4% /boot/efi
tmpfs                    385M   32K  385M   1% /run/user/1000

This is the sudo fdisk -l output:

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5EED7839-21BB-4567-A5F0-B29559081F29

Device       Start       End   Sectors   Size Type
/dev/sda1     2048    411647    409600   200M EFI System
/dev/sda2   411648   1435647   1024000   500M Linux filesystem
/dev/sda3  1435648 976773119 975337472 465.1G Linux LVM




Disk /dev/mapper/fedora-root: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/fedora-swap: 3.9 GiB, 4160749568 bytes, 8126464 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/fedora-home: 411.2 GiB, 441517604864 bytes, 862339072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Is there a way to do this safely without unmounting or, if not, without a backup? Because I can't do a backup, I do not have an external hard disk.

EDIT:

These are screenshots from gparted:

image description

image description

edit retag flag offensive close merge delete

Comments

What do you want to do by reducing the size of the partition?

simmon gravatar imagesimmon ( 2019-03-22 22:01:49 -0500 )edit

Partition changes are sensitive, so if possible, use additional storage to make space for your needs rather than adjusting existing partitions. I do not recommend to try it without a backup.

simmon gravatar imagesimmon ( 2019-03-23 01:17:31 -0500 )edit

I may need some space (20 GB more or less) to install Ubuntu

0novanta gravatar image0novanta ( 2019-03-23 04:47:03 -0500 )edit
1

use...virtualbox.. and it's a stable to use in Fedora...i do not recommend resize partition.

simmon gravatar imagesimmon ( 2019-03-23 20:28:24 -0500 )edit

Why do you want to run Ubuntu (especially since you have Fedora running)? Is there some specific objective? Why not run Ubuntu in a virtual machine? dnf install boxes then run boxes and install Ubuntu into it.

wallyk gravatar imagewallyk ( 2019-03-23 22:44:12 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted
1

answered 2019-03-22 23:05:53 -0500

cmurf gravatar image

updated 2019-03-23 16:19:22 -0500

I don't think gparted will work on LVM. (Update OK I'm wrong, it does have support for it, but I'm not really sure of the extent of it compared to blivet-gui.)

I suggest booting from Fedora 29 Live media, and then install blivet-gui which is in Fedora repo. You can use either dnf or gnome-software to install it. The LiveOS will let you install software in the RAM based overlay. Blivet-gui uses the same storage backend as the Fedora installer, so it's completely capable of doing LVM resize for you.

If you want free space in the existing VG, it's very straightforward. If you're looking to get free space out of LVM entirely, into its own partition that's more complicated, and I'm not sure off hand if blivet-gui can do a VG and PV shrink.

Update 1: Several shrinks must happen in the proper order: ext4 > LV > PV > partition. The first two can be done by blivet-gui, but I couldn't figure out a way to get it to resize the PV or partition. And trying that, I broke the root file system somehow, not sure at which resize stage the mistake happened. Fortunately it was done on a test system but it's total data loss, and I'll have to figure out if that was user error (likely) or a bug.

Anyway, I suggest considering Gnome Boxes if you're using Fedora Workstation. You can find it in Gnome Software. This is an easy to use VM, and it'll put Ubuntu in a VM file on /home, and you don't have to do any resizing.

Update 2: OK so it was user error, I had the partition resize wrong, so I fixed that, manually activated the root LV, ran fsck on it which fixed nothing (it was fine), and rebooted and it works. But yeah, it's a little non-trivial. I used pvresize to resize the PV and gdisk to delete and recreate a new sized partition to match the PV size. Looks important to do a pvdisplay --unit m to get MiB units for the PV size, and use that value (rounding up if necessary), for gdisk. i.e. accept the start LBA making sure it's the same as it was before deleting the partition, and then for end LBA type in +12345m - substituting the value you got from pvdisplay. For goofy reasons, LVM sometimes uses SI units (1000) and othertimes uses IEC units (1024) where gdisk only uses IEC. So check your units!

edit flag offensive delete link more

Comments

I need to reduce the space in fedora-home and make it free space so that I can install Ubuntu, so that I will have both Fedora and Ubuntu.

0novanta gravatar image0novanta ( 2019-03-23 04:48:52 -0500 )edit

@cmurf about update 2, could you be more specific about the procedure to follow? about update 1, i've considered a vm but the main problem is that i can't find a image with less than 500gb of virtual memory which is a lot given that my laptop is just an i3

0novanta gravatar image0novanta ( 2019-03-23 17:12:18 -0500 )edit
0

answered 2019-03-24 01:51:41 -0500

cpetepf gravatar image

I followed these instructions here and it worked okay for me.

https://pingtool.org/online-resize-lv...

edit flag offensive delete link more
0

answered 2019-03-22 21:38:24 -0500

I've recently followed the instructions on this page which I found to be fantastic.

https://www.rootusers.com/lvm-resize-...

edit flag offensive delete link more
-1

answered 2019-03-22 14:23:09 -0500

updated 2019-03-28 13:33:26 -0500

Have a nice day....! @0novanta

It is advisable to save important data through backup. Still ... Please backup and run. use...virtualbox.. and it's a stable to use in Fedora...i do not recommend resize partition.

VM is useful like a Dual core and higher cpu, also enough memory to run system. If you are proficient, you can modify the partition information, but try to use vm instead of taking the system loss and build the system if it works.

You can install gparted as a related program, and use that program to adjust partitions. This program is possible without changing your existing status

 Question Case     # lvreduce -L 420GB /dev/mapper/fedora-home
 reference for other answer
 https://ask.fedoraproject.org/en/question/134329/resize-root-folder

 Sample [10.63 GB 1 lvm Disk ] 
 lvm reduce -> gparted resize->lvm file system with gparted ->vgcreate->lvcreate->mkfs.xfs

 # lvreduce -L 5GB /dev/mapper/pink-pony
 gparted use - resize second partition and lvm file system with gprated
 # vgcreate pink /dev/sdb2
 # lvcreate -l 100%FREE -n osen rose
 # mkfs.xfs /dev/mapper/rose-osen

image description

I mentioned gparted to confirm the information through the program and to help set up. In the case of lvm, partition settings and adjustments can be adjusted via lvextend and lvreduce, but incorrect adjustments to those settings can cause serious problems at boot up. Therefore, it is recommended to add more disk space to try to change the existing partition without backing up.

If you make a mistake in adjusting an existing root partition for a partition change, the system may hang after booting. Storage devices always take precautionary measures and do not trust a single storage device.

The size of the disk set with lvm can be easily adjusted. However, since the lvm setting of the disk itself is controlled by fdisk, you need to change the disk setting using a program such as gparted to adjust the size of the disk.

I use gparted to make it easier to tune disks of other file types and to make them useful. It is a really useful program that can not question gparted.

edit flag offensive delete link more

Comments

Thanks for replying, could you explain more about using gparted? My system is LVM. I've also added some infos from a gparted point of view.

0novanta gravatar image0novanta ( 2019-03-22 14:53:15 -0500 )edit

@simmon thank you for all of this information!

0novanta gravatar image0novanta ( 2019-03-27 13:35:53 -0500 )edit

Partitioning can have a serious impact on your system, so be sure to back it up so you can defend it in case of problems. VMs such as VritualBox will work well. @0novanta have fun & great day!!

simmon gravatar imagesimmon ( 2019-03-27 21:06:43 -0500 )edit

How VirtualBox would help me with backup?

0novanta gravatar image0novanta ( 2019-03-28 06:07:09 -0500 )edit

no.it just do,.before change partition....

simmon gravatar imagesimmon ( 2019-03-28 06:13:19 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-03-22 13:47:46 -0500

Seen: 163 times

Last updated: Mar 28