How can you create a separate home partition using LVM?
I'm currently using Fedora 34 and want to install Fedora 35 while keeping around just my home folder. Currently I don't have a separate home partition, but I read online that it's easy to make one even after installation if your system is using LVM. After looking it up in Fedora's documentation, it looks like LVM is used with the default partitioning scheme, which is what I used when I installed Fedora. However when I checked my partitions using both Gnome Disks and the KDE partition manager. I didn't see any mention of LVM, just a /boot
and /
partition.
What I want to know is how I can separate /home
into its own partition so that I can just reformat everything but that partition when I install Fedora 35. I tried using vgdisplay
to see if I'm really even using LVM in the first place, but it outputs nothing when I use sudo, and errors when run as a normal user.
1 answer
I don't use Fedora myself, but from the documentation, it looks like it doesn't use LVM unless you explicitly set that up during installation, but rather Btrfs by default. How your system is actually set up could however very well depend on what the defaults were for the distribution version you initially installed; if your installation has been around for a while and upgraded along the way, this could trivially be different.
Please note that I'm not familiar with Btrfs, so I'm going here by what I can find in documentation. That said:
To see whether you're using Btrfs, try btrfs filesystem show --mounted
(see also).
It looks like another possible way to determine whether your system is using Btrfs by looking at /etc/fstab
for entries with the btrfs
file system type; for example:
$ awk '$3 == "btrfs" { print }' </etc/fstab
If your system is using Btrfs and isn't set up already with /home
on a subvolume of its own, it should be relatively simple to just move /home
onto one (you'll want to do that in single-user mode, but that's about it), and simply not touch that subvolume during the Fedora 35 installation. You may need to fiddle some with the system configuration afterwards to get it to mount instead of the /home
content created during the installation, and of course your /etc/passwd
and friends will have to match for it to be of much actual use.
Make sure to back up anything you care about before doing the installation; OS installations (and in-place upgrades) are always a high-risk operation, especially when they involve file system twiddling and fighting the defaults!
If your system is using plain ext* file systems on partitions directly on the underlying storage with basically just a single-root partition scheme, it's probably going to be difficult to convert to LVM in-place. One possible way would be to shrink the root file system, then set up a LV group in the freed-up space and create a brand new /home
file system within a logical volume within that group, but I fail to see what advantage you would get from the additional complexity of using LVM in such a scenario.
However, since you already said that you want to wipe everything but /home
anyway, you might not need to. Rather, to end up in such a state, I would consider backing up /home
and then starting with a clean slate with LVM, then restoring your backup. I say it again: make sure to back up what you care about! As a bonus, after the installation, you'll have a good starting point for implementing regular backups, which are a very good thing to have in any case.
I suggest to also keep in mind that by going with something other than the actual current defaults, especially for something as central as partitioning and file system types, you place yourself in a worse situation in getting advice from people who actually use the distribution and may run into edge cases that aren't tested for, or tested as well (even more so than in general with how Fedora is rather bleeding edge and an early adopter to begin with).
0 comment threads