Reinstalling Fedora while keeping /home partition

It might be useful to describe my situation:

It was late at night and I was very, very tired, recovering deleted photos using photorec. After it had finished, it made root-owned folders with lots of deleted photos, which I could not remove even using sudo. So, I went to “sudo su” and typed, out of bad habit, sudo rm -rf /*. I realized my horrible mistake 3 seconds later, pressed Ctrl + C, and shutdown my computer.

I booted into the computer with a live fedora usb, mounted my drive read-only, to discover that all had remained was /home and /root with some files that I hope were untouched. During my original installation, I made a separate /home partition. So can I just reinstall Fedora while not wiping my /home, and how would I do that? Any other advice is appreciated. Thanks :grin:

Not a direct answer to your question, but you could make a backup of /home, then do a fresh install and restore the files. While in the live USB environment, you should be able to rsync the files to somewhere or maybe even attach an external disk, create a BTRFS filesystem on it, and try to take a snapshot of what’s remaining of the old file system and btrfs send it to the external disk. All of this assumes there’s still enough left of /home to backup.

This is why one should ALWAYS proofread the commands before pressing enter.
You are not the first to make this type of error so don’t feel too bad about it.

The suggestion above seems the simplest, though I have seen posts here that suggest that one may do a reinstall even with a btrfs file system and reuse the existing home subvolume. I have not committed to btrfs yet so cannot provide better info.

Thanks for the responses. As @eddiejennings suggested, I’ll definitely make a backup of my /home directory. In the meanwhile, I’ll continue to look around to see if I can reinstall while reusing the /home subvolume and keeping it intact (or whatever’s left of it, at least).

In order to preserve /home, you will need to manually partition your new install. Choose existing /home, set mount point to /home, but DO NOT MARK to format it.

3 Likes

See also

What I was suggesting was while in a Live USB session, copying the /home data elsewhere and then restoring it, if you wanted to start anew, but Arturas’s suggestion will get you what you want.

Thanks all. I was able to create a new Fedora system while keeping my previous /home directory with all my files, via in the installer going to Custom, marking the /root btrfs subvolume to delete, using existing home subvolume mounted as /home, and creating new mountpoints for /root, /boot, etc. However, getting back all my packages and drivers were a chore :smiling_face_with_tear:

1 Like

See Need help with dnf commands for listing and installing packages to & from a txt file - #3 by computersavvy

to create a list of installed packages that can easily be re-installed.

I want to open this comment saying this:
Thank you, to OP for making the issue, to the other users for helping in, and for Arturas B. for giving THE solution.

This solution quite literally saved me[1], but it lacks some important context[2], so I HAVE, out of duty, respect, and love for anyone else in the same position to easily understand what the heckarony is going on and thus learn how to deal with this not-so-friendly installer (to be frank tho, Windows’ ain’t that friendly either, it will just bulldoze through and delete important stuff without asking :slight_smile: ):

There are 3 options to chose in the Live USB Boot after selecting the drive/s one wants to install Fedora on:

  1. The easy automatic one.
  2. The “I have no idea what I am looking at”.
  3. And the “oh lord, this is not where I belong”.

The second option (“personalized install” or whatever it’s called) is the one to chose, the one with the most “UI” feeling to it, since the first is just a sledgehammer and the third is impossible for humans to understand.


Using the third I managed to understand (since it was NOT said in plain english anywhere on the internet for normies) that / and /home are subpartitions of the same Btrsf “Fedora” partition.

This means that to reinstall Fedora without losing data (the /home one) but the installed files one has to do this:

  1. Start the install process from the Live USB Boot.
  2. Create the same Account/User_Profile (Admin) as it was in the previous install (the same name will make “the ID” overlap, solving that issue), and once you will finally boot back in the FIXED old data+account so do the same for any other account which may have also been there (this one PC is used by multiple people).
  3. The place, data and keyboard options (or whatever) can remain default. I GUESS you maybe should match what they were for the previous install, but it’s your PC, so you’d get them to be the same regardless.
  4. NOW FOR THE STORAGE SELECTION: select the same drive as “before”, and select the “personalized” install. There it’ll ask you “delete for space, create new Btrfs partition”. You WILL notice that / and /home have the same size, that’s because the UI fails to tell you those are SUBpartitions, and thus that DELETING ONE WILL NOT AFFECT THE DATA OF THE OTHER!!! .
    Click on the /home one, and select mount_point as “/boot”; then select / and delete it with the - (minus) symbol close to the bottom-left of the screen, after that re-create it and give it the same size as it had before (same size as /home ). After you have done that go to /boot and /boot/efi; you have to “mount them as their own names, like /home was”, but contrary to home you have to check the box asking to “reformat them”. This will basically swipe them clean and recreate them.
  5. Now, if you didn’t want extra partitions, like Ext4 ones (for any reason), you are done. Even if you wanted to add them, I believe it’s safer to do it AFTER you saved your murdered install, the small ri-partitioning can wait for KDE_Partition_Manager. You can click the “done” button (I installed it in italian, it’s “Fatto” for me) and the install will proceed pretty fast.

And now you are done.
I hope whoever needs to do this can find THIS post with THAT answer (and this small clarification) before Google vomits them stuff which is WAY MORE COMPLEX and which DID NOT EVEN WORK FOR ME.

Here’s links of things which didn’t help because the commands didn’t work:

  1. This was basically the first one that I’ve found.
    Without pasting in “the papyrus of text”[3] that was on the Konsole, I’ll just say that “it didn’t work 1/3rd or 1/4 of the way in, with commands not responding”.
  1. This one is not that direct to this issue, it’s actually the last link I tested before coming back to this post.
  1. This was just overcomplicated, couldn’t understand a thing.

  1. I wanted to install W10 as secondary OS because I wanted to test GT 1030 stuff. Since it’s easier and safer to do it BEFORE W10 dies this 14th of october I decided to do it now. That damn OS REFUSED to install itself before I just literally unplugged all the sata cables but its one! It just whined giving errors like “me no likey! me can not make new partition here! waaa!!”. That’s what I get for thrusting Devs, expecting humans to make tools which are easy to use and understand by other humans… ↩︎

  2. This other post How to Reinstall (Clean Install) Fedora 34 without losing data (/home)?
    helped me figure it out ↩︎

  3. Italian say. ↩︎