0

I am new on linux, I have windows 10 and Fedora dual booted on my laptop. I finished the space in the /home folder and I am trying to resolve this problem. I allocated a free space on my disk to fedora using this guide: Increase Linux partition with unused Windows partition space on dualbooot system. But now I would like to move my /home partition to the new space. It's possible? How can I do it? usefull information are:

Output of lsblk command: enter image description here and the output of df -lh and parted -l commands enter image description here pvs output:

 PV         VG     Fmt  Attr PSize   PFree  
  /dev/sda6  fedora lvm2 a--  <50,33g      0 
  /dev/sda7  fedora lvm2 a--  <30,00g <30,00g

  • It's sooo much easier for us to read what comes from a terminal if you copy it all then paste it into the question, instead of taking pictures. However, of all the screenshot pictures I have seen this year, yours are undoubtedly the clearest. – K7AAY Sep 9 at 21:53
0

Assuming that you've followed the guide you linked exactly, then /dev/sda7 should be your new free space.

Since Fedora is using LVM, this is going to be easy. You don't actually have to move your /home filesystem (i.e. the /dev/mapper/fedora-home logical volume to /dev/sda7 to extend it: as soon as you add /dev/sda7 to the fedora Volume Group, you can extend any of the logical volumes (LVs for short) inside it.

First, boot into your regular Fedora and become root. (Yes, all the remaining steps can be done in regular Fedora, without GParted Live or similar!)

To make /dev/sda7 useful for LVM, you'll first need to use pvcreate on it. This will effectively destroy any existing data on the partition it's aimed at, so be careful.

pvcreate /dev/sda7

This makes /dev/sda7 into a new LVM Physical Volume, or PV for short. The next step is to add it into your fedora volume group (VG):

vgextend fedora /dev/sda7

At this point, you can use the pvs and vgs commands to confirm that /dev/sda7 now registers as a LVM PV that is a member of fedora VG. You'll also see that the VG will have some unallocated space available.

Now, if you really want to move your /home filesystem to /dev/sda7, you can do it with the following command:

pvmove -n home /dev/sda6 /dev/sda7

Yes, you can do this while /home is still mounted and in use!

But if you don't have any strange special requirement that your /home filesystem must be physically contiguous, you don't have to do that.

As long as you have unallocated space in your VG, you can extend any of the LVs inside that VG. LVM will present the space allocated to the LV as a single logically contiguous unit to the filesystem driver, even if the disk space is physically in separate PVs, or even on separate physical disks. You could just extend your /home LV by whatever amount you wish, up to the amount of unallocated space available within the VG. For example, to extend your /home filesystem by 32 gigabytes, you need just one more command:

lvextend -r -L +32G /dev/mapper/fedora-home

This operation can also be done on-line, while the /home filesystem is mounted and in use.

Just remember that while many filesystem can be extended, even on-line, it does not necessarily mean the filesystem can be shrunk as easily. In particular, the XFS filesystem type allows on-line extensions just fine, but shrinking - even off-line shrinking - may not be possible at all. (I think there are fairly recent developments in this area, but not necessarily production quality yet!)

  • Thank you to have been so exhaustive, no I don't need that /home have to be countiguous, but when i try to use pvcreate it says to me: "Can't initialize physical volume "/dev/sda7" of volume group "fedora" without -ff /dev/sda7: physical volume not initialized." So i have to add -ff? I think it's to force, maybe I am doing something wrong... – simone castellitto Sep 10 at 16:23
  • "Can't initialize.. without -ff" means pvcreate thinks the partition is already in use by something. Be very careful, don't proceed unless you're absolutely sure it's unused. Please add the output of pvs to your question. – telcoM Sep 11 at 7:48
  • Ok, I added pvs output to the question, it seems free space, but I wait for your confirmation. – simone castellitto Sep 11 at 9:12
  • /dev/sda7 is already a member of the fedora VG, so effectively, the pvcreate and vgextend steps are already done. You can just proceed with lvextend (or pvmove, if you wish). – telcoM Sep 11 at 9:49
  • This is the output [root@localhost simonecastellitto]# lvextend -r -L +30G /dev/mapper/fedora-lvhome Logical volume lvhome not found in volume group fedora. – simone castellitto Sep 11 at 9:55
0

There are 3 old options;

  1. fstab
  2. mount --bind
  3. ln -s

zfs/brtfs have other tools but you are not using them.

as you are using fstab on lvm something like

lvextend /dev/mapper/fedora-home
resize2fs /dev/mapper/fedora-home

would work but you should post output of

pvs;vgs;lvs;pvdispay;vgdisplay;lvdisplay

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.